Skip to content

Commit 4504c68

Browse files
authored
Merge pull request #214 from haampie/feature/use-wl-rpath-instead-of-wl-r
GNU: use -Wl,-rpath,<dir> instead of -Wl,-R<dir>
2 parents 0f23a0e + 91cb327 commit 4504c68

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

distutils/tests/test_unixccompiler.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ def gcv(v):
153153
return 'yes'
154154

155155
sysconfig.get_config_var = gcv
156-
assert self.cc.rpath_foo() == '-Wl,--enable-new-dtags,-R/foo'
156+
assert self.cc.rpath_foo() == [
157+
'-Wl,--enable-new-dtags',
158+
'-Wl,-rpath,/foo',
159+
]
157160

158161
def gcv(v):
159162
if v == 'CC':
@@ -162,7 +165,10 @@ def gcv(v):
162165
return 'yes'
163166

164167
sysconfig.get_config_var = gcv
165-
assert self.cc.rpath_foo() == '-Wl,--enable-new-dtags,-R/foo'
168+
assert self.cc.rpath_foo() == [
169+
'-Wl,--enable-new-dtags',
170+
'-Wl,-rpath,/foo',
171+
]
166172

167173
# GCC non-GNULD
168174
sys.platform = 'bar'
@@ -187,7 +193,10 @@ def gcv(v):
187193
return 'yes'
188194

189195
sysconfig.get_config_var = gcv
190-
assert self.cc.rpath_foo() == '-Wl,--enable-new-dtags,-R/foo'
196+
assert self.cc.rpath_foo() == [
197+
'-Wl,--enable-new-dtags',
198+
'-Wl,-rpath,/foo',
199+
]
191200

192201
# non-GCC GNULD
193202
sys.platform = 'bar'
@@ -199,7 +208,10 @@ def gcv(v):
199208
return 'yes'
200209

201210
sysconfig.get_config_var = gcv
202-
assert self.cc.rpath_foo() == '-Wl,--enable-new-dtags,-R/foo'
211+
assert self.cc.rpath_foo() == [
212+
'-Wl,--enable-new-dtags',
213+
'-Wl,-rpath,/foo',
214+
]
203215

204216
# non-GCC non-GNULD
205217
sys.platform = 'bar'

distutils/unixccompiler.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,14 @@ def runtime_library_dir_option(self, dir):
310310
"-L" + dir,
311311
]
312312

313-
# For all compilers, `-Wl` is the presumed way to
314-
# pass a compiler option to the linker and `-R` is
315-
# the way to pass an RPATH.
313+
# For all compilers, `-Wl` is the presumed way to pass a
314+
# compiler option to the linker
316315
if sysconfig.get_config_var("GNULD") == "yes":
317-
# GNU ld needs an extra option to get a RUNPATH
318-
# instead of just an RPATH.
319-
return "-Wl,--enable-new-dtags,-R" + dir
316+
return [
317+
# Force RUNPATH instead of RPATH
318+
"-Wl,--enable-new-dtags",
319+
"-Wl,-rpath," + dir,
320+
]
320321
else:
321322
return "-Wl,-R" + dir
322323

0 commit comments

Comments
 (0)