Skip to content

Commit e5371ed

Browse files
[compiler-rt] Don't build SME routines if __arm_cpu_features is not initialised. (#119703)
According to the conversation [here](#119414 (comment)), some platforms don't enable `__arm_cpu_features` with a global constructor, but rather do so lazily when called from the FMV resolver. PR #119414 removed the CMake guard to check to see if the targetted platform is baremetal or supports sys/auxv. Without this check, the routines rely on `__arm_cpu_features` being initialised when they may not be, depending on the platform. This PR simply avoids building the SME routines for those platforms for now.
1 parent 6c8f41d commit e5371ed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler-rt/lib/builtins/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,10 @@ set(aarch64_SOURCES
572572
aarch64/fp_mode.c
573573
)
574574

575+
set(COMPILER_RT_AARCH64_FMV_USES_GLOBAL_CONSTRUCTOR NOT(FUCHSIA OR APPLE))
576+
575577
if (COMPILER_RT_HAS_AARCH64_SME)
576-
if (NOT COMPILER_RT_DISABLE_AARCH64_FMV AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
578+
if (NOT COMPILER_RT_DISABLE_AARCH64_FMV AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG AND COMPILER_RT_AARCH64_FMV_USES_GLOBAL_CONSTRUCTOR)
577579
list(APPEND aarch64_SOURCES aarch64/sme-abi.S aarch64/sme-libc-mem-routines.S aarch64/sme-abi-assert.c aarch64/sme-libc-routines.c)
578580
message(STATUS "AArch64 SME ABI routines enabled")
579581
set_source_files_properties(aarch64/sme-libc-routines.c PROPERTIES COMPILE_FLAGS "-fno-builtin")

0 commit comments

Comments
 (0)