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

Jake Egan via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 26 10:11:51 PST 2026


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

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. 

>From a60521f20d2a16733aac8b5233bef0b53fc13d0d Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Mon, 26 Jan 2026 12:43:23 -0500
Subject: [PATCH] Disable strict init checking on AIX

---
 compiler-rt/lib/asan/asan_flags.cpp                          | 5 +++++
 .../test/asan/TestCases/initialization-bug-no-global.cpp     | 3 +++
 2 files changed, 8 insertions(+)

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;



More information about the llvm-commits mailing list