[clang] [SSAF] Fix stage-2 clang build error on TestTransformationPlugin (PR #219081)
Ziqing Luo via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 26 18:04:28 PDT 2026
https://github.com/ziqingluo-90 created https://github.com/llvm/llvm-project/pull/219081
The plugin code defines the extern variable
SSAFTestTransformationAnchorSource, which is supposed to be used to force static linking, so not needed here.
The variable definition should undoubtedly be removed, as doing so solves the build issue locally. The explanation below regarding why this variable causes the issue was provided by Claude. I repeatedly asked Claude questions, and he revised his reasoning several times until it became consistent. However, we should still take the following explanation with a grain of salt:
ASan created a private alias symbol for the extern variable SSAFTestTransformationAnchorSource. The linker, when in '-flat_namespace' mode, treated the symbol as a name-based bind, which later failed to be resolved through name searching by the loader.
rdar://185749574
Assisted by Claude
>From ad5c4a25d6bbc1b168a224a719e3ec06f524d0ad Mon Sep 17 00:00:00 2001
From: Ziqing Luo <ziqing_luo at apple.com>
Date: Wed, 26 Aug 2026 17:06:57 -0700
Subject: [PATCH] [SSAF] Fix stage-2 clang build error on
TestTransformationPlugin
The plugin code defines the extern variable
SSAFTestTransformationAnchorSource, which is supposed to be used to
force static linking, so not needed here.
The variable definition should undoubtedly be removed, as doing so
solves the build issue locally. The explanation below regarding why
this variable causes the issue was provided by Claude. I repeatedly
asked Claude questions, and he revised his reasoning several times
until it became consistent. However, we should still take the
following explanation with a grain of salt:
ASan created a private alias symbol for the extern variable
SSAFTestTransformationAnchorSource. The linker, when in
'-flat_namespace' mode, treated the symbol as a name-based bind, which
later failed to be resolved through name searching by the loader.
rdar://185749574
Assisted by Claude
---
.../TestTransformationPlugin/TestTransformation.cpp | 8 --------
.../Scalable/source-edit-generation/coexistence.cpp | 2 --
.../Scalable/source-edit-generation/happy-path.cpp | 3 ---
.../Scalable/source-edit-generation/write-failure.cpp | 2 --
4 files changed, 15 deletions(-)
diff --git a/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp b/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
index 33a8319cd5b6a..2909cdfc5821b 100644
--- a/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
+++ b/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
@@ -89,15 +89,7 @@ class TestTransformation final : public Transformation {
} // namespace
-namespace clang::ssaf {
-// NOLINTNEXTLINE(misc-use-internal-linkage)
-volatile int SSAFTestTransformationAnchorSource = 0;
-} // namespace clang::ssaf
-
-// This global causes issue in stage2 with ASan-instrumented clang so
-// adding the no-ASan attribute.
static TransformationRegistry::Add<TestTransformation>
- __attribute__((no_sanitize("address")))
RegisterTestTransformation("test-transformation",
"Test transformation for the SSAF "
"source-edit-generation lit suite");
diff --git a/clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp b/clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp
index 410022caaa3a9..f93eafa9e3ab1 100644
--- a/clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp
+++ b/clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp
@@ -6,8 +6,6 @@
// REQUIRES: plugins
-// UNSUPPORTED: target={{.*}}
-
// RUN: rm -rf %t && mkdir -p %t
// RUN: %clang_cc1 -load %llvmshlibdir/SSAFTestTransformationPlugin%pluginext \
// RUN: --ssaf-extract-summaries=CallGraph \
diff --git a/clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp b/clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp
index a0e6ab0de7a88..d22c901217c31 100644
--- a/clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp
+++ b/clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp
@@ -7,9 +7,6 @@
// REQUIRES: plugins
-// UNSUPPORTED: target={{.*}}
-
-
// RUN: rm -rf %t && mkdir -p %t
// RUN: %clang_cc1 -load %llvmshlibdir/SSAFTestTransformationPlugin%pluginext \
// RUN: --ssaf-source-transformation=test-transformation \
diff --git a/clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp b/clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp
index 4c077702b1014..74ef0421045a8 100644
--- a/clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp
+++ b/clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp
@@ -5,8 +5,6 @@
// REQUIRES: plugins
-// UNSUPPORTED: target={{.*}}
-
// RUN: rm -rf %t && mkdir -p %t
// =============================================================================
More information about the cfe-commits
mailing list