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

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 04:47:27 PDT 2026


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

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.)

>From 7c05f4fb91918de6be9e656cc064f7ab31ee1b18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Fri, 10 Apr 2026 14:45:06 +0300
Subject: [PATCH] [clang][ssaf] Don't try to link SSAFExamplePlugin on Windows

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.)
---
 .../ScalableStaticAnalysisFramework/Plugins/CMakeLists.txt   | 5 ++++-
 clang/test/CMakeLists.txt                                    | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

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
     )



More information about the cfe-commits mailing list