[compiler-rt] [llvm] [LLVM][compiler-rt] Fix build with LLVM_USE_SANITIZER=Undefined (PR #120006)

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 08:11:08 PST 2024


================
@@ -707,8 +707,15 @@ endif( LLVM_USE_PERF )
 set(LLVM_USE_SANITIZER "" CACHE STRING
   "Define the sanitizer used to build binaries and tests.")
 option(LLVM_OPTIMIZE_SANITIZED_BUILDS "Pass -O1 on debug sanitizer builds" ON)
+
+if( CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
+  set(LLVM_UBSAN_FLAGS_CLANG "-fno-sanitize=function")
+else()
+  # gcc doesn't know about -fsanitize=function
+  set(LLVM_UBSAN_FLAGS_CLANG)
----------------
jroelofs wrote:

Current GCC does support `-fsanitize=`: https://clang.godbolt.org/z/nT3bPW766

Something else must be wrong with your build. Maybe it's an old version?

https://github.com/llvm/llvm-project/pull/120006


More information about the llvm-commits mailing list