aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-06-05 02:11:43 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-06-05 02:19:46 +0530
commit264ce6c0bc27d2998368b7652b1c12729f088d3a (patch)
tree4e4087c99c87ca106b35fa50980f310496115f35 /mesonbuild/compilers.py
parentd79bdb9b6bc915f146ce2ab2cfdf17d077953f5d (diff)
downloadmeson-264ce6c0bc27d2998368b7652b1c12729f088d3a.zip
meson-264ce6c0bc27d2998368b7652b1c12729f088d3a.tar.gz
meson-264ce6c0bc27d2998368b7652b1c12729f088d3a.tar.bz2
Use absolute RPATHs while linking due to a binutils bug
Use -rpath-link with the absolute paths to the respective build dirs to work around a binutils bug that causes $ORIGIN to not be used while linking. Includes a unit test that manually checks the RPATH value written out to ensure that it uses $ORIGIN. See: https://sourceware.org/bugzilla/show_bug.cgi?id=16936 Closes https://github.com/mesonbuild/meson/issues/1897
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r--mesonbuild/compilers.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 06b0a59..595be60 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -337,7 +337,12 @@ def build_unix_rpath_args(build_dir, from_dir, rpath_paths, install_rpath):
paths = padding
else:
paths = paths + ':' + padding
- return ['-Wl,-rpath,' + paths]
+ # Rpaths to use while linking must be absolute. These are not used
+ # while running and are not written to the binary.
+ # https://github.com/mesonbuild/meson/issues/1897
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=16936
+ linkpaths = ':'.join([os.path.join(build_dir, p) for p in rpath_paths])
+ return ['-Wl,-rpath,' + paths, '-Wl,-rpath-link,' + linkpaths]
class CrossNoRunException(MesonException):
pass