[builtins] Allow compiling the builtins without libc headers
When compiled with -ffreestanding, we should not assume that headers declaring functions such as abort() are available. While the compiler may still emit calls to those functions [1], we should not require the headers to build compiler-rt since that can result in a cyclic dependency graph: The compiler-rt functions might be required to build libc.so, but the libc headers such as stdlib.h might only be available once libc has been built. [1] From https://gcc.gnu.org/onlinedocs/gcc/Standards.html: GCC requires the freestanding environment provide memcpy, memmove, memset and memcmp. Finally, if __builtin_trap is used, and the target does not implement the trap pattern, then GCC emits a call to abort. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D103876
Loading
Please sign in to comment