[clang] ede975d - [SSAF] Fix a stage2 test failure with ASan-instrumented clang - continued (#217799)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 11:02:48 PDT 2026


Author: Ziqing Luo
Date: 2026-08-21T11:02:44-07:00
New Revision: ede975d9f046441b9793e02bab190bd0bafb1fa2

URL: https://github.com/llvm/llvm-project/commit/ede975d9f046441b9793e02bab190bd0bafb1fa2
DIFF: https://github.com/llvm/llvm-project/commit/ede975d9f046441b9793e02bab190bd0bafb1fa2.diff

LOG: [SSAF] Fix a stage2 test failure with ASan-instrumented clang - continued (#217799)

The previous effort in #211432 that disables ASan for one static global
is not sufficient. This commit disables ASan for the whole test plugin.

rdar://182623740

Added: 
    

Modified: 
    clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/CMakeLists.txt
    clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/CMakeLists.txt b/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/CMakeLists.txt
index 7f170be16d2cc..dbcb1e4c37ad9 100644
--- a/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/CMakeLists.txt
+++ b/clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/CMakeLists.txt
@@ -14,3 +14,13 @@ target_include_directories(SSAFTestTransformationPlugin PRIVATE
   $<TARGET_PROPERTY:clangScalableStaticAnalysisCore,INTERFACE_INCLUDE_DIRECTORIES>
   $<TARGET_PROPERTY:clangScalableStaticAnalysisSourceTransformation,INTERFACE_INCLUDE_DIRECTORIES>
   )
+
+# The plugin is loaded into a clang that may be built with sanitizers (e.g. the
+# stage-2 -DLLVM_USE_SANITIZER=Address bots), but does not need instrumenting
+# itself. With ASan, -Wl,-dead_strip drops anonymous constants that ASan's
+# metadata still references, leaving dangling flat-namespace binds that break
+# dlopen ("symbol not found in flat namespace 'l___unnamed_NNNN'"). Opt out.
+if(LLVM_USE_SANITIZER)
+  target_compile_options(SSAFTestTransformationPlugin PRIVATE -fno-sanitize=all)
+  target_link_options(SSAFTestTransformationPlugin PRIVATE -fno-sanitize=all)
+endif()

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..d3edc34882cef 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
@@ -94,10 +94,7 @@ namespace clang::ssaf {
 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");


        


More information about the cfe-commits mailing list