[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 21:02:48 PST 2026


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

>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 1/4] 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;

>From ca14bc2a85096049d8e8f770c9913a89097c448a Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Mon, 26 Jan 2026 23:42:33 -0500
Subject: [PATCH 2/4] Add test

---
 .../test/asan/TestCases/AIX/strict-init-order-warning.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 compiler-rt/test/asan/TestCases/AIX/strict-init-order-warning.cpp

diff --git a/compiler-rt/test/asan/TestCases/AIX/strict-init-order-warning.cpp b/compiler-rt/test/asan/TestCases/AIX/strict-init-order-warning.cpp
new file mode 100644
index 0000000000000..2b7ef9b96ecb9
--- /dev/null
+++ b/compiler-rt/test/asan/TestCases/AIX/strict-init-order-warning.cpp
@@ -0,0 +1,8 @@
+// RUN: %clangxx_asan %s -o %t
+// RUN: %env_asan_opts=strict_init_order=true %run %t 2>&1 | FileCheck %s
+
+// CHECK: WARNING: strict_init_order is not supported on AIX.
+
+int main() {
+  return 0;
+}

>From 3ceb3728854e21090056a97dbf7a0b461eb6643b Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Mon, 26 Jan 2026 23:46:11 -0500
Subject: [PATCH 3/4] Fix test formatting

---
 .../test/asan/TestCases/AIX/strict-init-order-warning.cpp     | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/compiler-rt/test/asan/TestCases/AIX/strict-init-order-warning.cpp b/compiler-rt/test/asan/TestCases/AIX/strict-init-order-warning.cpp
index 2b7ef9b96ecb9..14e8fefcc8b44 100644
--- a/compiler-rt/test/asan/TestCases/AIX/strict-init-order-warning.cpp
+++ b/compiler-rt/test/asan/TestCases/AIX/strict-init-order-warning.cpp
@@ -3,6 +3,4 @@
 
 // CHECK: WARNING: strict_init_order is not supported on AIX.
 
-int main() {
-  return 0;
-}
+int main() { return 0; }

>From f97f7c598244ad1648c60f9b783aa430a741f64b Mon Sep 17 00:00:00 2001
From: Jake Egan <jake.egan at ibm.com>
Date: Tue, 27 Jan 2026 00:02:19 -0500
Subject: [PATCH 4/4] Add AIX test config

---
 compiler-rt/test/asan/TestCases/AIX/lit.local.cfg.py | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 compiler-rt/test/asan/TestCases/AIX/lit.local.cfg.py

diff --git a/compiler-rt/test/asan/TestCases/AIX/lit.local.cfg.py b/compiler-rt/test/asan/TestCases/AIX/lit.local.cfg.py
new file mode 100644
index 0000000000000..ff18751505b83
--- /dev/null
+++ b/compiler-rt/test/asan/TestCases/AIX/lit.local.cfg.py
@@ -0,0 +1,9 @@
+def getRoot(config):
+    if not config.parent:
+        return config
+    return getRoot(config.parent)
+
+root = getRoot(config)
+
+if root.target_os not in ["AIX"]:
+    config.unsupported = True



More information about the llvm-commits mailing list