Skip to content

Commit f3c3a9b

Browse files
[libc][cmake] error if user disables sanitizers but wants scudo (llvm#123834)
I found this out the hard way...though we don't suggest in our docs setting or unsetting COMPILER_RT_BUILD_SANITIZERS, I had this explicitly disabled in a cmake script I was using to setup an llvm-libc based sysroot. While the libc compiled, hello world failed to link due to missing references to malloc at link time. Though I had set the cmake variables to opt into using scudo, apparently explicitly disabling sanitizers will still prevent scudo from being built... Check for this at configure time and stop the build then.
1 parent 2476417 commit f3c3a9b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libc/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ if(LLVM_LIBC_INCLUDE_SCUDO)
323323
if (NOT ("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS OR "compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES))
324324
message(FATAL_ERROR "SCUDO cannot be included without adding compiler-rt to LLVM_ENABLE_PROJECTS or LLVM_ENABLE_RUNTIMES")
325325
endif()
326+
if (DEFINED COMPILER_RT_BUILD_SANITIZERS AND NOT COMPILER_RT_BUILD_SANITIZERS)
327+
message(FATAL_ERROR "Disabling COMPILER_RT_BUILD_SANITIZERS will produce a libc without malloc/free")
328+
endif()
326329
endif()
327330

328331
option(LIBC_INCLUDE_DOCS "Build the libc documentation." ${LLVM_INCLUDE_DOCS})

0 commit comments

Comments
 (0)