[all-commits] [llvm/llvm-project] bc6c76: [Windows] Export Registry<T> members and accessors...
Ryan VanderMeulen via All-commits
all-commits at lists.llvm.org
Thu Sep 10 00:14:45 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bc6c76a4d4f8b4f6d5e9b663736703f91fcbb6ed
https://github.com/llvm/llvm-project/commit/bc6c76a4d4f8b4f6d5e9b663736703f91fcbb6ed
Author: Ryan VanderMeulen <ryanvm at gmail.com>
Date: 2026-09-10 (Thu, 10 Sep 2026)
Changed paths:
A llvm/test/tools/extract_symbols/Inputs/lib-itanium.s
A llvm/test/tools/extract_symbols/Inputs/lib-msvc.s
A llvm/test/tools/extract_symbols/Inputs/user-itanium.s
A llvm/test/tools/extract_symbols/Inputs/user-msvc.s
A llvm/test/tools/extract_symbols/lit.local.cfg
A llvm/test/tools/extract_symbols/registry-itanium.test
A llvm/test/tools/extract_symbols/registry-microsoft.test
M llvm/utils/extract_symbols.py
Log Message:
-----------
[Windows] Export Registry<T> members and accessors for plugins again (#221296)
Since #185141 reworked `llvm::Registry`, the registered-node list lives
behind the explicitly specialized
`llvm::detail::getRegistryLinkListInstance<R>()` accessor defined by
`LLVM_DEFINE_REGISTRY`, and the `Head`/`Tail` static data members that
used to be referenced across objects are gone (#163391 had special-cased
those).
`extract_symbols.py` handles neither. The accessor is a `??$` function
template specialization, which the script drops on the assumption that
it can be instantiated in the importing translation unit; here it
cannot, it is defined once by `LLVM_DEFINE_REGISTRY`. And `Registry<T>`
members are only exported when some object references the `Registry`
template, which nothing does anymore because every use goes through the
accessor. On a static clang.exe built with
`LLVM_EXPORT_SYMBOLS_FOR_PLUGINS`, the export table went from 11
`Registry<clang::PluginASTAction>` symbols on 22.1.8 to zero on 23.1.0,
and linking a plugin fails:
```
lld-link: error: undefined symbol: __declspec(dllimport) public: static void __cdecl llvm::Registry<class clang::PluginASTAction>::add_node(class llvm::Registry<class clang::PluginASTAction>::node *)
>>> referenced by host_Registration.obj:(_GLOBAL__sub_I_Registration.cpp)
```
Keep the accessor specializations, and treat a reference to an accessor
as a reference to the `Registry` template so its explicitly instantiated
members are exported as they were before. Verified on the 23.1.0 static
libraries: `Registry<PluginASTAction>::add_node`, the node/iterator
members and the accessor come back for every registry (PluginASTAction,
PragmaHandler, GCStrategy, GCMetadataPrinter, ...), 141 symbols in total
in the Itanium run over the clang libraries. The `Head`/`Tail` rule from
#163391 no longer matches anything and is dropped.
Related: #163367 / #163391 (the previous Registry export fix), #87865.
---
**AI tool use disclosure** (per the [LLVM AI Tool Use
Policy](https://llvm.org/docs/AIToolPolicy.html)): this change was
developed with Claude Code assisting in the analysis and drafting. The
root cause was established against real 23.1.0 binaries and libraries,
and the fix was verified by running extract_symbols.py over the 23.1.0
clang static libraries (the Registry members and accessors come back)
and against MSVC-mangled test objects; Firefox's Windows clang-plugin
and mozsearch builds link and run against a clang.exe built with it.
`llvm/test/tools/extract_symbols/` adds lit coverage for both manglings.
The author reviewed the change and is accountable for and able to answer
questions about it. Commits carry an `Assisted-by:` trailer.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list