Index: tools/clang/scripts/update.py |
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py |
index e7abcb704bca7bf7335005c6bfce08b61ee05717..75a5c0e376f26e36cf4d229735227676501a7c52 100755 |
--- a/tools/clang/scripts/update.py |
+++ b/tools/clang/scripts/update.py |
@@ -34,7 +34,7 @@ if use_head_revision: |
CLANG_REVISION = 'HEAD' |
# This is incremented when pushing a new build of Clang at the same revision. |
-CLANG_SUB_REVISION=1 |
+CLANG_SUB_REVISION=2 |
PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION) |
@@ -66,11 +66,10 @@ LLVM_BUILD_TOOLS_DIR = os.path.abspath( |
os.path.join(LLVM_DIR, '..', 'llvm-build-tools')) |
STAMP_FILE = os.path.normpath( |
os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision')) |
-BINUTILS_DIR = os.path.join(THIRD_PARTY_DIR, 'binutils') |
-BINUTILS_BIN_DIR = os.path.join(BINUTILS_DIR, BINUTILS_DIR, |
- 'Linux_x64', 'Release', 'bin') |
-BFD_PLUGINS_DIR = os.path.join(BINUTILS_DIR, 'Linux_x64', 'Release', |
- 'lib', 'bfd-plugins') |
+BINUTILS_DIR = os.path.join(THIRD_PARTY_DIR, 'binutils', 'Linux_x64', 'Release') |
+BINUTILS_BIN_DIR = os.path.join(BINUTILS_DIR, 'bin') |
+BINUTILS_LIB_DIR = os.path.join(BINUTILS_DIR, 'lib') |
+BFD_PLUGINS_DIR = os.path.join(BINUTILS_LIB_DIR, 'bfd-plugins') |
VERSION = '5.0.0' |
ANDROID_NDK_DIR = os.path.join( |
CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk') |
@@ -503,7 +502,7 @@ def UpdateClang(args): |
binutils_incdir = '' |
if sys.platform.startswith('linux'): |
- binutils_incdir = os.path.join(BINUTILS_DIR, 'Linux_x64/Release/include') |
+ binutils_incdir = os.path.join(BINUTILS_DIR, 'include') |
if args.bootstrap: |
print 'Building bootstrap compiler' |
@@ -565,6 +564,11 @@ def UpdateClang(args): |
os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'lib', 'LLVMgold.so'), |
os.path.join(BFD_PLUGINS_DIR, 'LLVMgold.so')]) |
+ # Link against binutils's copy of tcmalloc to speed up the linker by ~10%. |
+ tcmalloc_ldflags = [ |
+ '-L' + BINUTILS_LIB_DIR, '-ltcmalloc_minimal', |
+ '-Wl,-rpath,\\$ORIGIN/../../../binutils/Linux_x64/Release/lib'] |
hans
2017/04/28 23:23:26
Does package.py need an update to include the .so?
pcc1
2017/04/28 23:27:16
The .so is part of binutils, so wouldn't it come w
|
+ |
lto_cflags = ['-flto=thin'] |
lto_ldflags = ['-fuse-ld=lld'] |
if args.gcc_toolchain: |
@@ -577,7 +581,7 @@ def UpdateClang(args): |
'-DCMAKE_CXX_COMPILER=' + cxx, |
'-DCMAKE_C_FLAGS=' + ' '.join(lto_cflags), |
'-DCMAKE_CXX_FLAGS=' + ' '.join(lto_cflags), |
- '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(lto_ldflags), |
+ '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(lto_ldflags + tcmalloc_ldflags), |
'-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(lto_ldflags), |
'-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(lto_ldflags)] |
@@ -585,6 +589,10 @@ def UpdateClang(args): |
lto_env = os.environ.copy() |
lto_env['PATH'] = BINUTILS_BIN_DIR + os.pathsep + lto_env.get('PATH', '') |
+ # Also need to make sure that tblgen can find the tcmalloc DSO. |
+ lto_env['LD_LIBRARY_PATH'] = \ |
+ BINUTILS_LIB_DIR + os.pathsep + lto_env.get('LD_LIBRARY_PATH', '') |
+ |
RmCmakeCache('.') |
RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR], env=lto_env) |
RunCommand(['ninja', 'LLVMgold', 'lld'], env=lto_env) |