Changeset View
Changeset View
Standalone View
Standalone View
compiler-rt/lib/builtins/CMakeLists.txt
Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | set(GENERIC_SOURCES | ||||
udivti3.c | udivti3.c | ||||
umoddi3.c | umoddi3.c | ||||
umodsi3.c | umodsi3.c | ||||
umodti3.c | umodti3.c | ||||
) | ) | ||||
# Build BF16 files only when "__bf16" is available. | # Build BF16 files only when "__bf16" is available. | ||||
if(COMPILER_RT_HAS_BFLOAT16 AND NOT APPLE) | if(COMPILER_RT_HAS_BFLOAT16 AND NOT APPLE) | ||||
set(GENERIC_SOURCES | set(GENERIC_BF_SOURCES | ||||
${GENERIC_SOURCES} | |||||
truncdfbf2.c | truncdfbf2.c | ||||
truncsfbf2.c | truncsfbf2.c | ||||
) | ) | ||||
set(GENERIC_SOURCES | |||||
${GENERIC_SOURCES} | |||||
${GENERIC_BF_SOURCES} | |||||
) | |||||
endif() | endif() | ||||
# TODO: Several "tf" files (and divtc3.c, but not multc3.c) are in | # TODO: Several "tf" files (and divtc3.c, but not multc3.c) are in | ||||
# GENERIC_SOURCES instead of here. | # GENERIC_SOURCES instead of here. | ||||
set(GENERIC_TF_SOURCES | set(GENERIC_TF_SOURCES | ||||
addtf3.c | addtf3.c | ||||
comparetf2.c | comparetf2.c | ||||
divtc3.c | divtc3.c | ||||
▲ Show 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | if (NOT MSVC) | ||||
if (WIN32) | if (WIN32) | ||||
set(i386_SOURCES | set(i386_SOURCES | ||||
${i386_SOURCES} | ${i386_SOURCES} | ||||
i386/chkstk.S | i386/chkstk.S | ||||
i386/chkstk2.S | i386/chkstk2.S | ||||
) | ) | ||||
endif() | endif() | ||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") | |||||
# Do not build bfloat16 sources i386-freebsd, as it is not supported. | |||||
list(REMOVE_ITEM i386_SOURCES ${GENERIC_BF_SOURCES}) | |||||
endif() | |||||
else () # MSVC | else () # MSVC | ||||
# Use C versions of functions when building on MSVC | # Use C versions of functions when building on MSVC | ||||
# MSVC's assembler takes Intel syntax, not AT&T syntax. | # MSVC's assembler takes Intel syntax, not AT&T syntax. | ||||
# Also use only MSVC compilable builtin implementations. | # Also use only MSVC compilable builtin implementations. | ||||
set(x86_64_SOURCES | set(x86_64_SOURCES | ||||
${GENERIC_SOURCES} | ${GENERIC_SOURCES} | ||||
${x86_ARCH_SOURCES} | ${x86_ARCH_SOURCES} | ||||
x86_64/floatdidf.c | x86_64/floatdidf.c | ||||
▲ Show 20 Lines • Show All 362 Lines • ▼ Show 20 Lines | |||||
else () | else () | ||||
set(BUILTIN_CFLAGS "") | set(BUILTIN_CFLAGS "") | ||||
add_security_warnings(BUILTIN_CFLAGS 0) | add_security_warnings(BUILTIN_CFLAGS 0) | ||||
if (COMPILER_RT_HAS_FCF_PROTECTION_FLAG) | if (COMPILER_RT_HAS_FCF_PROTECTION_FLAG) | ||||
append_list_if(COMPILER_RT_ENABLE_CET -fcf-protection=full BUILTIN_CFLAGS) | append_list_if(COMPILER_RT_ENABLE_CET -fcf-protection=full BUILTIN_CFLAGS) | ||||
endif() | endif() | ||||
append_list_if(COMPILER_RT_HAS_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS) | |||||
append_list_if(COMPILER_RT_HAS_STD_C11_FLAG -std=c11 BUILTIN_CFLAGS) | append_list_if(COMPILER_RT_HAS_STD_C11_FLAG -std=c11 BUILTIN_CFLAGS) | ||||
# These flags would normally be added to CMAKE_C_FLAGS by the llvm | # These flags would normally be added to CMAKE_C_FLAGS by the llvm | ||||
# cmake step. Add them manually if this is a standalone build. | # cmake step. Add them manually if this is a standalone build. | ||||
if(COMPILER_RT_STANDALONE_BUILD) | if(COMPILER_RT_STANDALONE_BUILD) | ||||
if(COMPILER_RT_BUILTINS_ENABLE_PIC) | if(COMPILER_RT_BUILTINS_ENABLE_PIC) | ||||
append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC BUILTIN_CFLAGS) | append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC BUILTIN_CFLAGS) | ||||
endif() | endif() | ||||
Show All 30 Lines | if (CAN_TARGET_${arch}) | ||||
else() | else() | ||||
# Exclude any double-precision builtins if VFP is single-precision-only | # Exclude any double-precision builtins if VFP is single-precision-only | ||||
try_compile_only(COMPILER_RT_HAS_${arch}_VFP_DP | try_compile_only(COMPILER_RT_HAS_${arch}_VFP_DP | ||||
SOURCE "#if !(__ARM_FP & 0x8) | SOURCE "#if !(__ARM_FP & 0x8) | ||||
#error No double-precision support! | #error No double-precision support! | ||||
#endif | #endif | ||||
int main(void) { return 0; }") | int main(void) { return 0; }") | ||||
if(NOT COMPILER_RT_HAS_${arch}_VFP_DP) | if(NOT COMPILER_RT_HAS_${arch}_VFP_DP) | ||||
list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES}) | list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES}) | ||||
pengfei: Should move the removal of `GENERIC_BF_SOURCES` in this loop like this (Just wild guess. I'm… | |||||
endif() | endif() | ||||
endif() | endif() | ||||
endif() | endif() | ||||
# Remove a generic C builtin when an arch-specific builtin is specified. | # Remove a generic C builtin when an arch-specific builtin is specified. | ||||
filter_builtin_sources(${arch}_SOURCES ${arch}) | filter_builtin_sources(${arch}_SOURCES ${arch}) | ||||
# Needed for clear_cache on debug mode, due to r7's usage in inline asm. | # Needed for clear_cache on debug mode, due to r7's usage in inline asm. | ||||
Show All 13 Lines | if (CAN_TARGET_${arch}) | ||||
lse_builtin_symlinks | lse_builtin_symlinks | ||||
BYPRODUCTS ${lse_builtins} | BYPRODUCTS ${lse_builtins} | ||||
${arm64_lse_commands} | ${arm64_lse_commands} | ||||
) | ) | ||||
set(deps_aarch64 lse_builtin_symlinks) | set(deps_aarch64 lse_builtin_symlinks) | ||||
endif() | endif() | ||||
# Do not enable float16 on i386-freebsd, as it is not supported. | |||||
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" AND ${arch} STREQUAL "i386")) | |||||
append_list_if(COMPILER_RT_HAS_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS) | |||||
endif() | |||||
add_compiler_rt_runtime(clang_rt.builtins | add_compiler_rt_runtime(clang_rt.builtins | ||||
STATIC | STATIC | ||||
ARCHS ${arch} | ARCHS ${arch} | ||||
DEPS ${deps_${arch}} | DEPS ${deps_${arch}} | ||||
SOURCES ${${arch}_SOURCES} | SOURCES ${${arch}_SOURCES} | ||||
DEFS ${BUILTIN_DEFS} | DEFS ${BUILTIN_DEFS} | ||||
CFLAGS ${BUILTIN_CFLAGS_${arch}} | CFLAGS ${BUILTIN_CFLAGS_${arch}} | ||||
PARENT_TARGET builtins) | PARENT_TARGET builtins) | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |
Should move the removal of GENERIC_BF_SOURCES in this loop like this (Just wild guess. I'm neither familiar with compiler-rt nor cmake)