[compiler-rt] [asan] Disable strict init checking on AIX (PR #178012)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 26 10:12:26 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Jake Egan (jakeegan)

<details>
<summary>Changes</summary>

The `__cxa_atexit` interceptor is disabled for `SANITIZER_AIX` because Clang on AIX neither uses `__cxa_atexit` nor links against a library with such. This interceptor calls `StopInitOrderChecking()`, which is needed to prevent false positives for the `initialization-order-fiasco` error. For now, we'll disable the check, but we'll look to support it in the future by implementing an `exit` interceptor or some other alternative. 

---
Full diff: https://github.com/llvm/llvm-project/pull/178012.diff


2 Files Affected:

- (modified) compiler-rt/lib/asan/asan_flags.cpp (+5) 
- (modified) compiler-rt/test/asan/TestCases/initialization-bug-no-global.cpp (+3) 


``````````diff
diff --git a/compiler-rt/lib/asan/asan_flags.cpp b/compiler-rt/lib/asan/asan_flags.cpp
index 190a89345dd18..d9bda6c551064 100644
--- a/compiler-rt/lib/asan/asan_flags.cpp
+++ b/compiler-rt/lib/asan/asan_flags.cpp
@@ -160,7 +160,12 @@ static void ProcessFlags() {
   // Make "strict_init_order" imply "check_initialization_order".
   // TODO(samsonov): Use a single runtime flag for an init-order checker.
   if (f->strict_init_order) {
+#ifdef SANITIZER_AIX
+    Report("WARNING: strict_init_order is not supported on AIX.\n");
+    f->strict_init_order = false;
+#else
     f->check_initialization_order = true;
+#endif
   }
   CHECK_LE((uptr)common_flags()->malloc_context_size, kStackTraceMax);
   CHECK_LE(f->min_uar_stack_size_log, f->max_uar_stack_size_log);
diff --git a/compiler-rt/test/asan/TestCases/initialization-bug-no-global.cpp b/compiler-rt/test/asan/TestCases/initialization-bug-no-global.cpp
index 26dc0f0d29a6d..1d4fd5040ecd3 100644
--- a/compiler-rt/test/asan/TestCases/initialization-bug-no-global.cpp
+++ b/compiler-rt/test/asan/TestCases/initialization-bug-no-global.cpp
@@ -9,6 +9,9 @@
 // Fails on some Darwin bots, probably iOS.
 // XFAIL: ios
 
+// Strict init order checking is not supported on AIX
+// UNSUPPORTED: target={{.*aix.*}}
+
 #include <stdio.h>
 
 extern int y;

``````````

</details>


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


More information about the llvm-commits mailing list