Skip to content

Commit e2445ea

Browse files
committed
[compiler-rt] [CMake] Only configure sanitizer-common if _BUILD_ and _HAS_ a dep
LLVM_ENABLE_RUNTIMES uses the default build target for building compiler-rt, which means a bunch of stuff gets built that isn't necessarily depended upon (and wasn't getting built under LLVM_ENABLE_PROJECTS). Right now, we configure sanitizer_common (and thus it gets built in the default build) based on COMPILER_RT_BUILD_* options. However, compiler_rt_build_runtime also uses the _HAS option to determine whether to configure a project. Thus, there are cases where we are configuring (and building with the default target) sanitizer-common when we do not need it. This change helps to slim down builds of compiler-rt that do not need sanitizer-common built.
1 parent 220ad03 commit e2445ea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler-rt/lib/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ include(SanitizerUtils)
99
#
1010
#TODO: Refactor sanitizer_common into smaller pieces (e.g. flag parsing, utils).
1111
if (COMPILER_RT_HAS_SANITIZER_COMMON AND
12-
(COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY OR COMPILER_RT_BUILD_MEMPROF OR COMPILER_RT_BUILD_CTX_PROFILE))
12+
(COMPILER_RT_BUILD_SANITIZERS OR
13+
(COMPILER_RT_HAS_XRAY AND COMPILER_RT_BUILD_XRAY) OR
14+
(COMPILER_RT_HAS_MEMPROF AND COMPILER_RT_BUILD_MEMPROF) OR
15+
(COMPILER_RT_HAS_CTX_PROFILE AND COMPILER_RT_BUILD_CTX_PROFILE)))
1316
add_subdirectory(sanitizer_common)
1417
endif()
1518

0 commit comments

Comments
 (0)