Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: third_party/binutils/build-one.sh

Issue 1330433002: binutils: Embed a relative path to the LLVM lib directory in binaries' rpaths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/binutils/build-one.sh
diff --git a/third_party/binutils/build-one.sh b/third_party/binutils/build-one.sh
index 1ae62d10c7967b533d0353bdab69ac6b44c06d4f..5ca40cf8a6b1e1e6f13fd8fd2e8fbc559633bae7 100755
--- a/third_party/binutils/build-one.sh
+++ b/third_party/binutils/build-one.sh
@@ -14,7 +14,27 @@ if [ -z "$1" ]; then
fi
cd "$1"
+
+# Ask the dynamic loader to load libstdc++ from the LLVM build directory if
+# available. That copy of libstdc++ is required by the gold plugin in the same
+# directory. The dynamic loader expects the relative path to start with $ORIGIN,
+# but because of escaping issues
+# (https://sourceware.org/ml/binutils/2009-05/msg00252.html)
+# we embed a dummy path with $ replaced with z and fix it up later.
+export LDFLAGS='-Wl,-rpath,zORIGIN/../../../../llvm-build/Release+Asserts/lib'
+
./configure --enable-gold=default --enable-threads --enable-plugins \
--prefix=/build/output
make -j8 all
make install
+
+# Fix up zORIGIN -> $ORIGIN.
+bins="`echo /build/output/*/bin/*`"
krasin 2015/09/02 03:09:53 I believe that generally "$(echo /build/output/*/b
pcc 2015/09/05 03:10:06 Done.
+sed -i.orig 's,zORIGIN/\.\.,$ORIGIN/..,g' $bins
krasin 2015/09/02 03:09:53 1) why do we need this trick with echo?
pcc 2015/09/05 03:10:06 The sed -i command will leave .orig files behind.
+
krasin 2015/09/02 03:09:53 2) can you please explain how did you chose the se
pcc 2015/09/05 03:10:06 Yes it can be that instead. I wrote the longer sed
+# Verify that we changed only one byte per executable.
+for bin in $bins; do
+ test "`cmp -l $bin.orig $bin | wc -l`" = 1
krasin 2015/09/02 03:09:54 Can you please make this script to output some mes
pcc 2015/09/05 03:10:06 Done.
+done
+
+rm /build/output/*/bin/*.orig
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698