[clang] [llvm] [Windows] Fix plugin registry symbols not exported/linked with CLANG_LINK_CLANG_DYLIB (PR #163391)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 17 01:10:58 PDT 2025
================
@@ -105,6 +105,11 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration):
# Skip X86GenMnemonicTables functions, they are not exposed from llvm/include/.
elif re.match(r"\?is[A-Z0-9]*@X86 at llvm", symbol):
return None
+ # Keep Registry<T>::Head and Registry<T>::Tail static members for plugin support.
+ # Pattern matches: ?Head@?$Registry@<template_args>@llvm@@ or ?Tail@?$Registry at ...
+ elif ("?$Registry@" in symbol and "@llvm@@" in symbol and
+ (symbol.startswith("?Head@") or symbol.startswith("?Tail@"))):
+ return symbol
----------------
zmodem wrote:
Just targeting these two feels a bit hacky, but I suppose the alternative of exporting all global variables might be too much.
Ideally we'd rely on the dllimport/export annotations (the plugin registry is marked imported/exported here:) https://github.com/llvm/llvm-project/blob/7bbb4a51035aa491313b1242a779d52fd12904c6/clang/include/clang/Frontend/FrontendPluginRegistry.h#L28
Can you check if your build might work without `-DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON`?
https://github.com/llvm/llvm-project/pull/163391
More information about the cfe-commits
mailing list