[clang] [clang][ssaf] Don't try to link SSAFExamplePlugin on Windows (PR #191401)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 04:47:58 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-ssaf

Author: Martin Storsjö (mstorsjo)

<details>
<summary>Changes</summary>

This plugin currently seems to expect to be linked with undefined references (rather than linking against the libclang-cpp dylib).

Linking a shared library with undefined references is not supported on Windows. (Plugins in general can be built on Windows in mingw mode, if linking against libLLVM and libclang-cpp as dylibs.)

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


2 Files Affected:

- (modified) clang/lib/ScalableStaticAnalysisFramework/Plugins/CMakeLists.txt (+4-1) 
- (modified) clang/test/CMakeLists.txt (+1-1) 


``````````diff
diff --git a/clang/lib/ScalableStaticAnalysisFramework/Plugins/CMakeLists.txt b/clang/lib/ScalableStaticAnalysisFramework/Plugins/CMakeLists.txt
index d5bec9f7f38b3..b77ffc49c0f9f 100644
--- a/clang/lib/ScalableStaticAnalysisFramework/Plugins/CMakeLists.txt
+++ b/clang/lib/ScalableStaticAnalysisFramework/Plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS)
+if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS AND NOT WIN32)
   # Plugins must never bring LLVM or Clang libraries in statically.
   # clang-ssaf-analyzer already loads clangScalableStaticAnalysisFrameworkCore
   # and LLVM into the process; a second static copy would produce duplicate
@@ -8,5 +8,8 @@ if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS)
   # tool that will load it, and pull only include paths (not link deps) from
   # the libraries whose headers are needed. All symbols are resolved from the
   # tool's address space when the plugin is loaded via --load.
+  #
+  # This plugin is intended to be linked with undefined references; this isn't
+  # supported on PE-COFF.
   add_subdirectory(ExamplePlugin)
 endif()
diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 9bd21c013b092..cb1f34d2e49bc 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -207,7 +207,7 @@ if(CLANG_ENABLE_STATIC_ANALYZER)
   endif()
 endif()
 
-if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS)
+if(CLANG_PLUGIN_SUPPORT AND LLVM_ENABLE_PLUGINS AND NOT WIN32)
   list(APPEND CLANG_TEST_DEPS
     SSAFExamplePlugin
     )

``````````

</details>


https://github.com/llvm/llvm-project/pull/191401


More information about the cfe-commits mailing list