https://github.com/ziqingluo-90 created 
https://github.com/llvm/llvm-project/pull/217799

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

rdar://182623740

>From 8c78d4bac200d3564227b136d1cf59f9708e6e87 Mon Sep 17 00:00:00 2001
From: Ziqing Luo <[email protected]>
Date: Thu, 20 Aug 2026 18:29:56 -0700
Subject: [PATCH] [SSAF] Fix a stage2 test failure with ASan-instrumented clang
 - continued

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

rdar://182623740
---
 .../Plugins/TestTransformationPlugin/CMakeLists.txt | 13 +++++++++++++
 .../TestTransformationPlugin/TestTransformation.cpp |  3 ---
 2 files changed, 13 insertions(+), 3 deletions(-)

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..b08f27ef0165f 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,16 @@ 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()
+  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");

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to