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

Unified Diff: tools/clang/scripts/update.py

Issue 2569323002: Revert of Clang toolchain: link Gold plugin with lld. (Closed)
Patch Set: Created 4 years 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: tools/clang/scripts/update.py
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
index a51c515c6e6dd61097f1c85b642535227d501206..6ab466f292de03ed7c34efcf6131f94735a682d9 100755
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
@@ -69,6 +69,8 @@
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')
VERSION = '4.0.0'
ANDROID_NDK_DIR = os.path.join(
CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk')
@@ -555,30 +557,36 @@
EnsureDirExists(LLVM_LTO_GOLD_PLUGIN_DIR)
os.chdir(LLVM_LTO_GOLD_PLUGIN_DIR)
+ # Create a symlink to LLVMgold.so build in the previous step so that ar
+ # and ranlib could find it while linking LLVMgold.so with LTO.
+ EnsureDirExists(BFD_PLUGINS_DIR)
+ RunCommand(['ln', '-sf',
+ os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'lib', 'LLVMgold.so'),
+ os.path.join(BFD_PLUGINS_DIR, 'LLVMgold.so')])
+
lto_cflags = ['-flto']
- lto_ldflags = ['-fuse-ld=lld']
+ lto_ldflags = ['-fuse-ld=gold']
if args.gcc_toolchain:
# Tell the bootstrap compiler to use a specific gcc prefix to search
# for standard library headers and shared object files.
lto_cflags += ['--gcc-toolchain=' + args.gcc_toolchain]
lto_cmake_args = base_cmake_args + [
'-DLLVM_BINUTILS_INCDIR=' + binutils_incdir,
- '-DCMAKE_AR=' + os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR,
- 'bin', 'llvm-ar'),
- '-DCMAKE_RANLIB=' + os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR,
- 'bin', 'llvm-ranlib'),
- '-DLLVM_ENABLE_LTO=ON',
'-DCMAKE_C_COMPILER=' + cc,
'-DCMAKE_CXX_COMPILER=' + cxx,
'-DCMAKE_C_FLAGS=' + ' '.join(lto_cflags),
- '-DCMAKE_CXX_FLAGS=' + ' '.join(lto_cflags + ['-std=c++11']),
+ '-DCMAKE_CXX_FLAGS=' + ' '.join(lto_cflags),
'-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(lto_ldflags),
'-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(lto_ldflags),
'-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(lto_ldflags)]
+ # We need to use the proper binutils which support LLVM Gold plugin.
+ lto_env = os.environ.copy()
+ lto_env['PATH'] = BINUTILS_BIN_DIR + os.pathsep + lto_env.get('PATH', '')
+
RmCmakeCache('.')
- RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR])
- RunCommand(['ninja', 'LLVMgold'])
+ RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR], env=lto_env)
+ RunCommand(['ninja', 'LLVMgold'], env=lto_env)
# LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
« 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