[compiler-rt] [compiler-rt] Allow building builtins.a without a libc (PR #86737)
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 26 14:02:01 PDT 2024
================
@@ -235,9 +235,10 @@ set(COMPILER_RT_SUPPORTED_ARCH)
# Try to compile a very simple source file to ensure we can target the given
# platform. We use the results of these tests to build only the various target
# runtime libraries supported by our current compilers cross-compiling
-# abilities.
+# abilities. Checks a libc header (possibly provided by clang) is available
+# and does not need to link against an existing libc to run.
set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
-file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <stdio.h>\nint main(void) { printf(\"hello, world\"); }\n")
+file(WRITE ${SIMPLE_SOURCE} "#include <stdint.h>\nint main(void) { return 0; }\n")
----------------
petrhosek wrote:
Do we need to pull in any headers at all? Why not just use `int main(void) { return 0; }`?
https://github.com/llvm/llvm-project/pull/86737
More information about the llvm-commits
mailing list