Commit ba2227d2 authored by Hans Wennborg's avatar Hans Wennborg Committed by Commit Bot

Clang build script: link against rpmalloc on Windows

This makes LLD faster, especially when performing ThinLTO.
Reduces link time of chrome.dll with 34% in official builds
with ThinLTO enabled.

It also makes regular (non-goma) builds 6% faster.

Bug: 1111798
Change-Id: I12870d5b14bf559b333260347dbb93c7e4fe8a5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2398685
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Auto-Submit: Hans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807644}
parent 42536514
......@@ -290,6 +290,28 @@ def AddZlibToPath():
return zlib_dir
def DownloadRPMalloc():
"""Download rpmalloc."""
rpmalloc_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'rpmalloc')
if os.path.exists(rpmalloc_dir):
RmTree(rpmalloc_dir)
# Using rpmalloc bc1923f rather than the latest release (1.4.1) because
# it contains the fix for https://github.com/mjansson/rpmalloc/pull/186
# which would cause lld to deadlock.
# The zip file was created and uploaded as follows:
# $ mkdir rpmalloc
# $ curl -L https://github.com/mjansson/rpmalloc/archive/bc1923f436539327707b08ef9751a7a87bdd9d2f.tar.gz \
# | tar -C rpmalloc --strip-components=1 -xzf -
# $ GZIP=-9 tar vzcf rpmalloc-bc1923f.tgz rpmalloc
# $ gsutil.py cp -n -a public-read rpmalloc-bc1923f.tgz \
# gs://chromium-browser-clang/tools/
zip_name = 'rpmalloc-bc1923f.tgz'
DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR)
rpmalloc_dir = rpmalloc_dir.replace('\\', '/')
return rpmalloc_dir
def MaybeDownloadHostGcc(args):
"""Download a modern GCC host compiler on Linux."""
if not sys.platform.startswith('linux') or args.gcc_toolchain:
......@@ -569,6 +591,10 @@ def main():
cxxflags.append('-I' + zlib_dir)
ldflags.append('-LIBPATH:' + zlib_dir)
# Use rpmalloc. For faster ThinLTO linking.
rpmalloc_dir = DownloadRPMalloc()
base_cmake_args.append('-DLLVM_INTEGRATED_CRT_ALLOC=' + rpmalloc_dir)
if sys.platform != 'win32':
# libxml2 is required by the Win manifest merging tool used in cross-builds.
base_cmake_args.append('-DLLVM_ENABLE_LIBXML2=FORCE_ON')
......
......@@ -39,7 +39,7 @@ import zipfile
# Reverting problematic clang rolls is safe, though.
# This is the output of `git describe` and is usable as a commit-ish.
CLANG_REVISION = 'llvmorg-12-init-5627-gf086e85e'
CLANG_SUB_REVISION = 1
CLANG_SUB_REVISION = 2
PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION)
RELEASE_VERSION = '12.0.0'
......
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