[compiler-rt] [FMV][compiler-rt] Fix cpu features initialization. (PR #95149)

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 07:34:32 PDT 2024


================
@@ -23,14 +23,18 @@ extern bool __aarch64_has_sme_and_tpidr2_el0;
 #pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
 #endif
 __attribute__((constructor(90))) static void get_aarch64_cpu_features(void) {
-  if (!__aarch64_cpu_features.features)
-    __init_cpu_features();
+  if (__atomic_load_n(&__aarch64_cpu_features.features, __ATOMIC_RELAXED))
+    return;
+
+  __init_cpu_features();
 }
 
 __attribute__((target("sve"))) long
 __arm_get_current_vg(void) __arm_streaming_compatible {
----------------
jroelofs wrote:

cc @aemerson @sdesmalen-arm

can this ever get called before `__init_cpu_features()`?

https://github.com/llvm/llvm-project/pull/95149


More information about the llvm-commits mailing list