Bug 1755415 - Use compiler-rt artifacts for clang PGO. r=firefox-build-system-reviewers,mhentges

Instead of building compiler-rt alongside clang, we reuse the clang
repack logic to put compiler-rts in place when building clang stage2
(which requires the profiling runtime).

The repack logic is unified to handle all platforms as well, and now
that compiler-rt is not built in clang, we also need to copy everything
that is not lib/* from the compiler-rt artifacts, so we now also ensure
that they're not diverging between those compiler-rt artifacts (except
for darwin libs, which need to be unified into universal libraries).

And as a bonus, we can also cross-build the mac clang toolchains with
the stage1 clang and the clang runtime for the target platform.

Differential Revision: https://phabricator.services.mozilla.com/D138748
This commit is contained in:
Mike Hommey
2022-02-16 08:24:40 +00:00
parent 915de7997e
commit 83b844ed6f
7 changed files with 59 additions and 88 deletions

View File

@@ -242,7 +242,6 @@ def build_one_stage(
# libc++ doesn't build with MSVC because of the use of #include_next.
if is_final_stage and os.path.basename(cc[0]).lower() != "cl.exe":
cmake_args += [
"-DLLVM_FORCE_BUILD_RUNTIME=ON",
"-DLLVM_TOOL_LIBCXX_BUILD=%s" % ("ON" if build_libcxx else "OFF"),
# libc++abi has conflicting definitions between the shared and static
# library on Windows because of the import library for the dll having
@@ -252,13 +251,9 @@ def build_one_stage(
]
if not is_final_stage:
cmake_args += [
"-DLLVM_ENABLE_PROJECTS=clang;compiler-rt",
"-DLLVM_ENABLE_PROJECTS=clang",
"-DLLVM_INCLUDE_TESTS=OFF",
"-DLLVM_TOOL_LLI_BUILD=OFF",
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF",
"-DCOMPILER_RT_BUILD_XRAY=OFF",
"-DCOMPILER_RT_BUILD_MEMPROF=OFF",
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF",
]
# There is no libxml2 on Windows except if we build one ourselves.
@@ -512,7 +507,6 @@ def main():
extra_source_dir = source_dir + "/clang-tools-extra"
clang_source_dir = source_dir + "/clang"
lld_source_dir = source_dir + "/lld"
compiler_rt_source_dir = source_dir + "/compiler-rt"
libcxx_source_dir = source_dir + "/libcxx"
libcxxabi_source_dir = source_dir + "/libcxxabi"
@@ -647,13 +641,10 @@ def main():
for p in config.get("patches", []):
patch(p, source_dir)
compiler_rt_source_link = llvm_source_dir + "/projects/compiler-rt"
symlinks = [
(clang_source_dir, llvm_source_dir + "/tools/clang"),
(extra_source_dir, llvm_source_dir + "/tools/clang/tools/extra"),
(lld_source_dir, llvm_source_dir + "/tools/lld"),
(compiler_rt_source_dir, compiler_rt_source_link),
(libcxx_source_dir, llvm_source_dir + "/projects/libcxx"),
(libcxxabi_source_dir, llvm_source_dir + "/projects/libcxxabi"),
(source_dir + "/cmake", llvm_source_dir + "/projects/cmake"),