llvm-libc exhibits a C interface but its source is C++.
This patch explicitly disables the use of exceptions and RTTI when compiling the entrypoints.
Differential Revision: https://reviews.llvm.org/D118889
if(NOT ${LIBC_TARGET_OS} STREQUAL "windows")
set(compile_options ${compile_options} -fpie -ffreestanding)
endif()
+ if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+ list(APPEND compile_options "-fno-exceptions")
+ list(APPEND compile_options "-fno-unwind-tables")
+ list(APPEND compile_options "-fno-asynchronous-unwind-tables")
+ list(APPEND compile_options "-fno-rtti")
+ elseif(MSVC)
+ list(APPEND compile_options "/EHs-c-")
+ list(APPEND compile_options "/GR-")
+ endif()
set(${output_var} ${compile_options} PARENT_SCOPE)
endfunction()