[libc-commits] [libc] f3c3a9b - [libc][cmake] error if user disables sanitizers but wants scudo (#123834)
via libc-commits
libc-commits at lists.llvm.org
Wed Jan 22 09:33:12 PST 2025
Author: Nick Desaulniers
Date: 2025-01-22T09:33:08-08:00
New Revision: f3c3a9b8829760b730b6651e460f9035065dd4c5
URL: https://github.com/llvm/llvm-project/commit/f3c3a9b8829760b730b6651e460f9035065dd4c5
DIFF: https://github.com/llvm/llvm-project/commit/f3c3a9b8829760b730b6651e460f9035065dd4c5.diff
LOG: [libc][cmake] error if user disables sanitizers but wants scudo (#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.
Added:
Modified:
libc/CMakeLists.txt
Removed:
################################################################################
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 6f1c180a3f192e..e5ac842edf56ec 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -323,6 +323,9 @@ if(LLVM_LIBC_INCLUDE_SCUDO)
if (NOT ("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS OR "compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES))
message(FATAL_ERROR "SCUDO cannot be included without adding compiler-rt to LLVM_ENABLE_PROJECTS or LLVM_ENABLE_RUNTIMES")
endif()
+ if (DEFINED COMPILER_RT_BUILD_SANITIZERS AND NOT COMPILER_RT_BUILD_SANITIZERS)
+ message(FATAL_ERROR "Disabling COMPILER_RT_BUILD_SANITIZERS will produce a libc without malloc/free")
+ endif()
endif()
option(LIBC_INCLUDE_DOCS "Build the libc documentation." ${LLVM_INCLUDE_DOCS})
More information about the libc-commits
mailing list