[compiler-rt] [compiler-rt] Disable building sanitizers on platforms without fork(). (PR #83485)
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 16:11:51 PST 2024
================
@@ -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>\nint main(void) { printf(__FILE__); fork(); return 0; }\n")
----------------
nico wrote:
I think this needs an `#include <unistd.h>\n` too, else it will disable the sanitizers on macOS too:
```sh
% cat test.c
#include <stdio.h>
int main() { fork(); }
% clang -c test.c
test.c:3:14: error: call to undeclared function 'fork'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
int main() { fork(); }
^
1 error generated.
```
https://github.com/llvm/llvm-project/pull/83485
More information about the llvm-commits
mailing list