[compiler-rt] 9faca1e - [compiler-rt/darwin] Disable building sanitizers on platforms without fork(). (#83485)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 12:55:40 PST 2024


Author: rohit-rao
Date: 2024-03-05T15:55:36-05:00
New Revision: 9faca1e4015582534028f9a5cd14eed7063dbedd

URL: https://github.com/llvm/llvm-project/commit/9faca1e4015582534028f9a5cd14eed7063dbedd
DIFF: https://github.com/llvm/llvm-project/commit/9faca1e4015582534028f9a5cd14eed7063dbedd.diff

LOG: [compiler-rt/darwin] Disable building sanitizers on platforms without fork(). (#83485)

The watchOS and tvOS sanitizers do not compile with publicly-available
SDKs, failing on calls such as fork() and posix_spawn(). Updating the
darwin_test_archs test program to include a call to fork() allows cmake
to exclude those platforms when compiling runtimes. This allows public
builds to enable watchOS/tvOS and compile builtins but not sanitizers.

Added: 
    

Modified: 
    compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
index 6a62d3bf7adced..1882893ad42c0c 100644
--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -116,7 +116,7 @@ function(darwin_test_archs os valid_archs)
   if(NOT TEST_COMPILE_ONLY)
     message(STATUS "Finding valid architectures for ${os}...")
     set(SIMPLE_C ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.c)
-    file(WRITE ${SIMPLE_C} "#include <stdio.h>\nint main(void) { printf(__FILE__); return 0; }\n")
+    file(WRITE ${SIMPLE_C} "#include <stdio.h>\n#include <unistd.h>\nint main(void) { printf(__FILE__); fork(); return 0; }\n")
 
     set(os_linker_flags)
     foreach(flag ${DARWIN_${os}_LINK_FLAGS})


        


More information about the llvm-commits mailing list