1*810390e3Srobertinclude(BuiltinTests) 2*810390e3Srobertinclude(CheckCSourceCompiles) 3*810390e3Srobert 4*810390e3Srobert# Make all the tests only check the compiler 5*810390e3Srobertset(TEST_COMPILE_ONLY On) 6*810390e3Srobert 7*810390e3Srobertbuiltin_check_c_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG) 8*810390e3Srobertbuiltin_check_c_compiler_flag(-std=c11 COMPILER_RT_HAS_STD_C11_FLAG) 9*810390e3Srobertbuiltin_check_c_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC) 10*810390e3Srobertbuiltin_check_c_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG) 11*810390e3Srobertbuiltin_check_c_compiler_flag(-fno-profile-generate COMPILER_RT_HAS_FNO_PROFILE_GENERATE_FLAG) 12*810390e3Srobertbuiltin_check_c_compiler_flag(-fno-profile-instr-generate COMPILER_RT_HAS_FNO_PROFILE_INSTR_GENERATE_FLAG) 13*810390e3Srobertbuiltin_check_c_compiler_flag(-fno-profile-instr-use COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG) 14*810390e3Srobert 15*810390e3Srobertif(ANDROID) 16*810390e3Srobert set(OS_NAME "Android") 17*810390e3Srobertelse() 18*810390e3Srobert set(OS_NAME "${CMAKE_SYSTEM_NAME}") 19*810390e3Srobertendif() 20*810390e3Srobert 21*810390e3Srobertset(ARM64 aarch64) 22*810390e3Srobertset(ARM32 arm armhf) 23*810390e3Srobertset(HEXAGON hexagon) 24*810390e3Srobertset(X86 i386) 25*810390e3Srobertset(X86_64 x86_64) 26*810390e3Srobertset(LOONGARCH64 loongarch64) 27*810390e3Srobertset(PPC32 powerpc powerpcspe) 28*810390e3Srobertset(PPC64 powerpc64 powerpc64le) 29*810390e3Srobertset(RISCV32 riscv32) 30*810390e3Srobertset(RISCV64 riscv64) 31*810390e3Srobertset(VE ve) 32*810390e3Srobert 33*810390e3Srobertset(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC32} 34*810390e3Srobert ${PPC64} ${RISCV32} ${RISCV64} ${VE} ${HEXAGON} ${LOONGARCH64}) 35*810390e3Srobert 36*810390e3Srobertinclude(CompilerRTUtils) 37*810390e3Srobert 38*810390e3Srobertif(NOT APPLE) 39*810390e3Srobert if(COMPILER_RT_CRT_STANDALONE_BUILD) 40*810390e3Srobert test_targets() 41*810390e3Srobert endif() 42*810390e3Srobert # Architectures supported by compiler-rt crt library. 43*810390e3Srobert filter_available_targets(CRT_SUPPORTED_ARCH ${ALL_CRT_SUPPORTED_ARCH}) 44*810390e3Srobert message(STATUS "Supported architectures for crt: ${CRT_SUPPORTED_ARCH}") 45*810390e3Srobertendif() 46*810390e3Srobert 47*810390e3Srobertif (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux" AND NOT LLVM_USE_SANITIZER) 48*810390e3Srobert set(COMPILER_RT_HAS_CRT TRUE) 49*810390e3Srobertelse() 50*810390e3Srobert set(COMPILER_RT_HAS_CRT FALSE) 51*810390e3Srobertendif() 52