Skip to content

Commit 8669225

Browse files
[compiler-rt] Allow building builtins.a without a libc (#86737)
compiler-rt may depend on libc (memset etc). Likewise a libc built by clang may depend on compiler-rt builtins. This circular dependency doesn't matter much once they're both compiled. The easy compilation order to build both from source is: 1. install libc headers somewhere 2. build compiler-rt builtins against those headers 3. build libc against compiler-rt builtins This patch relaxes the cmake sanity check to pass without requiring a libc library. That allows the above sequence to work. Otherwise one needs to build a static libc, then use that to pass the compiler-rt cmake check, then build a normal libc.
1 parent 80bba17 commit 8669225

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler-rt/cmake/config-ix.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ set(COMPILER_RT_SUPPORTED_ARCH)
235235
# Try to compile a very simple source file to ensure we can target the given
236236
# platform. We use the results of these tests to build only the various target
237237
# runtime libraries supported by our current compilers cross-compiling
238-
# abilities.
238+
# abilities. Avoids using libc as that may not be available yet.
239239
set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
240-
file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <stdio.h>\nint main(void) { printf(\"hello, world\"); }\n")
240+
file(WRITE ${SIMPLE_SOURCE} "int main(void) { return 0; }\n")
241241

242242
# Detect whether the current target platform is 32-bit or 64-bit, and setup
243243
# the correct commandline flags needed to attempt to target 32-bit and 64-bit.

0 commit comments

Comments
 (0)