diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index 0b9e9bd7a2956e..6778ae1c352633 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -561,12 +561,23 @@ set(aarch64_SOURCES aarch64/fp_mode.c ) -if(COMPILER_RT_HAS_AARCH64_SME AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG AND (COMPILER_RT_HAS_AUXV OR COMPILER_RT_BAREMETAL_BUILD)) - list(APPEND aarch64_SOURCES aarch64/sme-abi.S aarch64/sme-abi-init.c aarch64/sme-abi-vg.c aarch64/sme-libc-routines.c) - message(STATUS "AArch64 SME ABI routines enabled") - set_source_files_properties(aarch64/sme-libc-routines.c PROPERTIES COMPILE_FLAGS "-fno-builtin") -else() - message(STATUS "AArch64 SME ABI routines disabled") +if (COMPILER_RT_HAS_AARCH64_SME) + if (NOT COMPILER_RT_DISABLE_AARCH64_FMV AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG AND (COMPILER_RT_HAS_AUXV OR COMPILER_RT_BAREMETAL_BUILD)) + list(APPEND aarch64_SOURCES aarch64/sme-abi.S aarch64/sme-abi-init.c aarch64/sme-abi-vg.c aarch64/sme-libc-routines.c) + message(STATUS "AArch64 SME ABI routines enabled") + set_source_files_properties(aarch64/sme-libc-routines.c PROPERTIES COMPILE_FLAGS "-fno-builtin") + else() + if(COMPILER_RT_DISABLE_AARCH64_FMV) + message(WARNING "AArch64 SME ABI routines require function multiversioning support.") + endif() + if(NOT COMPILER_RT_HAS_FNO_BUILTIN_FLAG) + message(WARNING "AArch64 SME ABI routines require '-fno-builtin'") + endif() + if(NOT (COMPILER_RT_HAS_AUXV OR COMPILER_RT_BAREMETAL_BUILD)) + message(WARNING "AArch64 SME ABI routines requires sys/auxv.h or COMPILER_RT_BAREMETAL_BUILD flag") + endif() + message(STATUS "AArch64 SME ABI routines disabled") + endif() endif() # Generate outline atomics helpers from lse.S base