Skip to content

Commit cd2cce1

Browse files
zondaokblast
authored andcommitted
[Windows] Fix Registry static data members not exported by extract_symbols.py in static builds with plugin support (llvm#163391)
When building LLVM statically (without BUILD_SHARED_LIBS) on Windows with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, external plugins cannot register through llvm::Registry<clang::PluginASTAction> because: Static data members (Head, Tail) are filtered out during symbol export by extract_symbols.py because they don't match the function signature patterns that the script looks for. This patch fixes the issue by adding pattern matching to extract_symbols.py to recognize and export Registry static data members. Note: When LLVM is built with /Zc:dllexportInlines-, inlined functions aren't exported as symbols, and the plugin must also compile with /Zc:dllexportInlines- to inline them instead of referencing non-exported symbols. Fixes llvm#163367
1 parent c9d2ee2 commit cd2cce1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/utils/extract_symbols.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration):
105105
# Skip X86GenMnemonicTables functions, they are not exposed from llvm/include/.
106106
elif re.match(r"\?is[A-Z0-9]*@X86@llvm", symbol):
107107
return None
108+
# Keep Registry<T>::Head and Registry<T>::Tail static members for plugin support.
109+
# Pattern matches: ?Head@?$Registry@<template_args>@llvm@@ or ?Tail@?$Registry@...
110+
elif (
111+
"?$Registry@" in symbol
112+
and "@llvm@@" in symbol
113+
and (symbol.startswith("?Head@") or symbol.startswith("?Tail@"))
114+
):
115+
return symbol
108116
# Keep mangled llvm:: and clang:: function symbols. How we detect these is a
109117
# bit of a mess and imprecise, but that avoids having to completely demangle
110118
# the symbol name. The outermost namespace is at the end of the identifier

0 commit comments

Comments
 (0)