Bug 1730078 - Don't build some things during early stages of the clang compilation. r=firefox-build-system-reviewers,andi,mhentges

Building sanitizers in older versions of clang emit errors when built with
newer GCC because of some narrowing conversions. We only really need the
sanitizers in the final stage anyways, so we force-disable them (and
everything else that might enable "sanitizer-common") in early stages.

Building the lli tool (also used in tests) fails as well, and we don't
need it until the final stage (where we need it to ship it).

Differential Revision: https://phabricator.services.mozilla.com/D125159
This commit is contained in:
Mike Hommey 2021-09-15 02:39:52 +00:00
parent 3631977b63
commit d03a4d2efb
3 changed files with 55 additions and 2 deletions

View File

@ -270,7 +270,15 @@ def build_one_stage(
"-DCLANG_REPOSITORY_STRING=taskcluster-%s" % os.environ["TASK_ID"],
]
if not is_final_stage:
cmake_args += ["-DLLVM_ENABLE_PROJECTS=clang;compiler-rt"]
cmake_args += [
"-DLLVM_ENABLE_PROJECTS=clang;compiler-rt",
"-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",
]
if build_wasm:
cmake_args += ["-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly"]
if is_linux() and not osx_cross_compile:

View File

@ -6,5 +6,7 @@
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"patches": []
"patches": [
"profile-g4a10504e1f70c.patch"
]
}

View File

@ -0,0 +1,43 @@
commit 4a10504e1f70c70c049fc439c4fce37a12de5941
Author: Vedant Kumar <vsk@apple.com>
Date: Mon Sep 18 18:13:47 2017 +0000
[cmake] Make it possible to build and test profile without sanitizers
This should fix an issue which arises when running check-compiler-rt on
the coverage bot:
http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1590/
The bot doesn't build the sanitizers, but the check-compiler-rt target
always expects the profile runtime to exist.
llvm-svn: 313549
diff --git a/compiler-rt/lib/CMakeLists.txt b/compiler-rt/lib/CMakeLists.txt
index 025320f473f5..a92d0a3f082d 100644
--- a/compiler-rt/lib/CMakeLists.txt
+++ b/compiler-rt/lib/CMakeLists.txt
@@ -39,7 +39,9 @@ if(COMPILER_RT_BUILD_SANITIZERS)
foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})
compiler_rt_build_runtime(${sanitizer})
endforeach()
+endif()
+if (COMPILER_RT_HAS_PROFILE)
compiler_rt_build_runtime(profile)
endif()
diff --git a/compiler-rt/test/CMakeLists.txt b/compiler-rt/test/CMakeLists.txt
index 6bc7cdbecf6a..e691eab7d4a7 100644
--- a/compiler-rt/test/CMakeLists.txt
+++ b/compiler-rt/test/CMakeLists.txt
@@ -71,7 +71,8 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS)
compiler_rt_test_runtime(${sanitizer})
endif()
endforeach()
-
+ endif()
+ if (COMPILER_RT_HAS_PROFILE)
compiler_rt_test_runtime(profile)
endif()
if(COMPILER_RT_BUILD_XRAY)