[compiler-rt] e5371ed - [compiler-rt] Don't build SME routines if __arm_cpu_features is not initialised. (#119703)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 12 07:59:52 PST 2024
Author: Sander de Smalen
Date: 2024-12-12T15:59:48Z
New Revision: e5371eded9c22ec4854634c9c58df793562f782d
URL: https://github.com/llvm/llvm-project/commit/e5371eded9c22ec4854634c9c58df793562f782d
DIFF: https://github.com/llvm/llvm-project/commit/e5371eded9c22ec4854634c9c58df793562f782d.diff
LOG: [compiler-rt] Don't build SME routines if __arm_cpu_features is not initialised. (#119703)
According to the conversation
[here](https://github.com/llvm/llvm-project/pull/119414#issuecomment-2536495859),
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.
Added:
Modified:
compiler-rt/lib/builtins/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index b32b42423f6a90..3a868c11e72885 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -572,8 +572,10 @@ set(aarch64_SOURCES
aarch64/fp_mode.c
)
+set(COMPILER_RT_AARCH64_FMV_USES_GLOBAL_CONSTRUCTOR NOT(FUCHSIA OR APPLE))
+
if (COMPILER_RT_HAS_AARCH64_SME)
- if (NOT COMPILER_RT_DISABLE_AARCH64_FMV AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
+ if (NOT COMPILER_RT_DISABLE_AARCH64_FMV AND COMPILER_RT_HAS_FNO_BUILTIN_FLAG AND COMPILER_RT_AARCH64_FMV_USES_GLOBAL_CONSTRUCTOR)
list(APPEND aarch64_SOURCES aarch64/sme-abi.S aarch64/sme-libc-mem-routines.S aarch64/sme-abi-assert.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")
More information about the llvm-commits
mailing list