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

Side by Side Diff: third_party/binutils/build-one.sh

Issue 1670073003: Link binutils with tcmalloc_minimal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Script to build binutils found in /build/binutils-XXXX when inside a chroot. 6 # Script to build binutils found in /build/binutils-XXXX when inside a chroot.
7 # Don't call this script yourself, instead use the build-all.sh script. 7 # Don't call this script yourself, instead use the build-all.sh script.
8 8
9 set -e 9 set -e
10 10
11 if [ -z "$1" ]; then 11 if [ -z "$1" ]; then
12 echo "Directory of binutils not given." 12 echo "Directory of binutils not given."
13 exit 1 13 exit 1
14 fi 14 fi
15 15
16 cd "$1" 16 cd "$1"
17 17
18 # First, we need to build libtcmalloc_minimal
19
20 cd ../gperftools/
21 ./autogen.sh
22 ./configure --disable-static --enable-minimal --disable-heap-checker \
23 --disable-heap-profiler --disable-cpu-profiler
24 make -j8
25
26 cd "$1"
27
18 # Ask the dynamic loader to load libstdc++ from the LLVM build directory if 28 # Ask the dynamic loader to load libstdc++ from the LLVM build directory if
19 # available. That copy of libstdc++ is required by the gold plugin in the same 29 # available. That copy of libstdc++ is required by the gold plugin in the same
20 # directory. The dynamic loader expects the relative path to start with $ORIGIN, 30 # directory. The dynamic loader expects the relative path to start with $ORIGIN,
21 # but because of escaping issues 31 # but because of escaping issues
22 # (https://sourceware.org/ml/binutils/2009-05/msg00252.html) 32 # (https://sourceware.org/ml/binutils/2009-05/msg00252.html)
23 # we embed a dummy path with $ replaced with z and fix it up later. 33 # we embed a dummy path with $ replaced with z and fix it up later.
24 export LDFLAGS='-Wl,-rpath,zORIGIN/../../../../llvm-build/Release+Asserts/lib' 34
35 export LDFLAGS="-Wl,-rpath,zORIGIN/../../../../llvm-build/Release+Asserts/lib:zO RIGIN/../lib -L$(pwd)/../gperftools/.libs/"
Lei Zhang 2016/02/05 21:21:00 Can you update the comment above to mention the ad
Lei Zhang 2016/02/05 21:21:00 It would be nice to keep this at 80 chars / line.
krasin1 2016/02/05 21:51:53 Done.
krasin1 2016/02/05 21:51:53 Done.
36 export LIBS='-ltcmalloc_minimal'
25 37
26 ./configure --enable-gold=default --enable-threads --enable-plugins \ 38 ./configure --enable-gold=default --enable-threads --enable-plugins \
27 --prefix=/build/output 39 --prefix=/build/output
40
28 make -j8 all 41 make -j8 all
29 make install 42 make install
30 43
44 # Copy libtcmalloc_minimal library and symlinks to the install lib dir.
45 cp -a ../gperftools/.libs/libtcmalloc_minimal.so* /build/output/*/lib/
46
31 # Save the list of binaries. The sed -i command will leave .orig files behind. 47 # Save the list of binaries. The sed -i command will leave .orig files behind.
32 # We don't want them to appear in the for loop below. 48 # We don't want them to appear in the for loop below.
33 bins="$(echo /build/output/*/bin/*)" 49 bins="$(echo /build/output/*/bin/*)"
34 50
35 # Fix up zORIGIN -> $ORIGIN. 51 # Fix up zORIGIN -> $ORIGIN.
36 sed -i.orig 's,zORIGIN,$ORIGIN,g' $bins 52 sed -i.orig 's,zORIGIN,$ORIGIN,g' $bins
37 53
38 # Verify that we changed only one byte per executable. 54 # Verify that we changed only two bytes per executable.
39 for bin in $bins; do 55 for bin in $bins; do
40 test "`cmp -l $bin.orig $bin | wc -l`" = 1 || \ 56 test "`cmp -l $bin.orig $bin | wc -l`" = 2 || \
41 (echo "$bin: verification failed" && exit 1) 57 (echo "$bin: verification failed" && exit 1)
42 done 58 done
43 59
44 rm /build/output/*/bin/*.orig 60 rm /build/output/*/bin/*.orig
OLDNEW
« third_party/binutils/build-all.sh ('K') | « third_party/binutils/build-all.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698