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(PPC32 powerpc powerpcspe)
28 set(PPC64 powerpc64 powerpc64le)
33 set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC32}
34 ${PPC64} ${RISCV32} ${RISCV64} ${VE} ${HEXAGON} ${LOONGARCH64})
36 include(CompilerRTUtils)
39 if(COMPILER_RT_CRT_STANDALONE_BUILD)
42 # Architectures supported by compiler-rt crt library.
43 filter_available_targets(CRT_SUPPORTED_ARCH ${ALL_CRT_SUPPORTED_ARCH})
44 message(STATUS "Supported architectures for crt: ${CRT_SUPPORTED_ARCH}")
47 if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux" AND NOT LLVM_USE_SANITIZER)
48 set(COMPILER_RT_HAS_CRT TRUE)
50 set(COMPILER_RT_HAS_CRT FALSE)