2 include(CheckCSourceCompiles)
4 # Make all the tests only check the compiler
5 set(TEST_COMPILE_ONLY On)
7 builtin_check_c_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)
8 builtin_check_c_compiler_flag(-std=c11 COMPILER_RT_HAS_STD_C11_FLAG)
9 builtin_check_c_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
10 builtin_check_c_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
11 builtin_check_c_compiler_flag(-fno-profile-generate COMPILER_RT_HAS_FNO_PROFILE_GENERATE_FLAG)
12 builtin_check_c_compiler_flag(-fno-profile-instr-generate COMPILER_RT_HAS_FNO_PROFILE_INSTR_GENERATE_FLAG)
13 builtin_check_c_compiler_flag(-fno-profile-instr-use COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)
16 set(OS_NAME "Android")
18 set(OS_NAME "${CMAKE_SYSTEM_NAME}")
26 set(LOONGARCH64 loongarch64)
27 set(MIPS32 mips mipsel)
28 set(MIPS64 mips64 mips64el)
29 set(PPC32 powerpc powerpcspe)
30 set(PPC64 powerpc64 powerpc64le)
35 set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC32}
36 ${PPC64} ${RISCV32} ${RISCV64} ${VE} ${HEXAGON} ${LOONGARCH64}
37 ${MIPS32} ${MIPS64} ${SPARC} ${SPARCV9})
39 include(CompilerRTUtils)
42 if(COMPILER_RT_CRT_STANDALONE_BUILD)
45 # Architectures supported by compiler-rt crt library.
46 filter_available_targets(CRT_SUPPORTED_ARCH ${ALL_CRT_SUPPORTED_ARCH})
47 message(STATUS "Supported architectures for crt: ${CRT_SUPPORTED_ARCH}")
50 if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux|SerenityOS" AND NOT LLVM_USE_SANITIZER)
51 set(COMPILER_RT_HAS_CRT TRUE)
53 set(COMPILER_RT_HAS_CRT FALSE)