Commit 7e67e227 authored by Arthur Eubanks's avatar Arthur Eubanks Committed by Commit Bot

Allow building Clang with ThinLTO

Change-Id: I463cff653ea55218500f61594fa2a35f2dbef2e8
Bug: 1108051
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2309653Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Arthur Eubanks <aeubanks@google.com>
Cr-Commit-Position: refs/heads/master@{#790692}
parent cbf7dd6e
...@@ -382,6 +382,9 @@ def main(): ...@@ -382,6 +382,9 @@ def main():
'building; --gcc-toolchain=/opt/foo picks ' 'building; --gcc-toolchain=/opt/foo picks '
'/opt/foo/bin/gcc') '/opt/foo/bin/gcc')
parser.add_argument('--pgo', action='store_true', help='build with PGO') parser.add_argument('--pgo', action='store_true', help='build with PGO')
parser.add_argument('--thinlto',
action='store_true',
help='build with ThinLTO')
parser.add_argument('--llvm-force-head-revision', action='store_true', parser.add_argument('--llvm-force-head-revision', action='store_true',
help='build the latest revision') help='build the latest revision')
parser.add_argument('--run-tests', action='store_true', parser.add_argument('--run-tests', action='store_true',
...@@ -416,8 +419,8 @@ def main(): ...@@ -416,8 +419,8 @@ def main():
print('Removing old lib dir: ' + old_lib_dir) print('Removing old lib dir: ' + old_lib_dir)
RmTree(old_lib_dir) RmTree(old_lib_dir)
if args.pgo and not args.bootstrap: if (args.pgo or args.thinlto) and not args.bootstrap:
print('--pgo requires --bootstrap') print('--pgo/--thinlto requires --bootstrap')
return 1 return 1
if args.with_android and not os.path.exists(ANDROID_NDK_DIR): if args.with_android and not os.path.exists(ANDROID_NDK_DIR):
print('Android NDK not found at ' + ANDROID_NDK_DIR) print('Android NDK not found at ' + ANDROID_NDK_DIR)
...@@ -698,6 +701,8 @@ def main(): ...@@ -698,6 +701,8 @@ def main():
if cc is not None: instrument_args.append('-DCMAKE_C_COMPILER=' + cc) if cc is not None: instrument_args.append('-DCMAKE_C_COMPILER=' + cc)
if cxx is not None: instrument_args.append('-DCMAKE_CXX_COMPILER=' + cxx) if cxx is not None: instrument_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
if lld is not None: instrument_args.append('-DCMAKE_LINKER=' + lld) if lld is not None: instrument_args.append('-DCMAKE_LINKER=' + lld)
if args.thinlto:
instrument_args.append('-DLLVM_ENABLE_LTO=Thin')
RunCommand(['cmake'] + instrument_args + [os.path.join(LLVM_DIR, 'llvm')], RunCommand(['cmake'] + instrument_args + [os.path.join(LLVM_DIR, 'llvm')],
msvc_arch='x64') msvc_arch='x64')
...@@ -857,6 +862,8 @@ def main(): ...@@ -857,6 +862,8 @@ def main():
'-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)] '-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)]
if args.pgo: if args.pgo:
cmake_args.append('-DLLVM_PROFDATA_FILE=' + LLVM_PROFDATA_FILE) cmake_args.append('-DLLVM_PROFDATA_FILE=' + LLVM_PROFDATA_FILE)
if args.thinlto:
cmake_args.append('-DLLVM_ENABLE_LTO=Thin')
if sys.platform == 'win32': if sys.platform == 'win32':
cmake_args.append('-DLLVM_ENABLE_ZLIB=FORCE_ON') cmake_args.append('-DLLVM_ENABLE_ZLIB=FORCE_ON')
if sys.platform == 'darwin': if sys.platform == 'darwin':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment