llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Ziqing Luo (ziqingluo-90)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/217799.diff


2 Files Affected:

- (modified) 
clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/CMakeLists.txt
 (+13) 
- (modified) 
clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
 (-3) 


``````````diff
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");

``````````

</details>


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

Reply via email to