[llvm-branch-commits] [llvm] release/23.x: [Windows] Don't export clang::interp symbols for plugins (#221295) (PR #222642)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Sep 10 06:02:43 PDT 2026


https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/222642

Backport be215a25f00139d68517589d78a79c3aa7a7eb26

Requested by: @rvandermeulen

>From 70ca9b378b0da4326d2df29cbb4880345b3e54a6 Mon Sep 17 00:00:00 2001
From: Ryan VanderMeulen <ryanvm at gmail.com>
Date: Thu, 10 Sep 2026 03:11:40 -0400
Subject: [PATCH] [Windows] Don't export clang::interp symbols for plugins
 (#221295)

With `LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON`, `clang.exe` built from the
23.x release branch exports 66679 symbols on x86_64 Windows, over the
65535 limit of the PE export table, so it no longer links:

```
lld-link: error: too many exported symbols (got 66679, max 65535)
```

For comparison, the same configuration on 22.1.8 exports 65465 symbols,
so the headroom was already almost gone.

`clang::interp`, the constant expression bytecode interpreter, accounts
for roughly 4500 of the exported symbols (counted with `llvm-readobj
--coff-exports` on a linked aarch64 23.1.0 `clang.exe`). Its headers
live in `clang/lib/AST/ByteCode` and are not installed; the only mention
in a public header is the forward declaration of `interp::Context` in
`ASTContext.h`. A plugin cannot call into it, so there is no reason to
keep exporting it. Filtering it out follows the existing
`dump`/`dumpColor`/`printPretty` exclusions in
`should_keep_microsoft_symbol`.

Related: #87865 (open; earlier rounds #60109, #56109). This does not get
the MSVC-with-examples configuration from that issue under the limit by
itself, but it removes the largest block of symbols that can never be
used by a plugin, and is what gets the Firefox clang 23 toolchain
(x86_64-pc-windows-msvc, X86;ARM;AArch64;WebAssembly,
clang+lld+clang-tools-extra) from 66679 to roughly 62100 exports.

---
**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,
the patch was reviewed and tested by the author in Firefox's CI, and the
author is accountable for and able to answer questions about it. Commits
carry an `Assisted-by:` trailer.

(cherry picked from commit be215a25f00139d68517589d78a79c3aa7a7eb26)
---
 llvm/utils/extract_symbols.py | 4 ++++
 1 file changed, 4 insertions(+)
 mode change 100755 => 100644 llvm/utils/extract_symbols.py

diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py
old mode 100755
new mode 100644
index 40a43d3655552..6aeef4b2cddca
--- a/llvm/utils/extract_symbols.py
+++ b/llvm/utils/extract_symbols.py
@@ -155,6 +155,10 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration):
         # because they are used for debugging only.
         if symbol.startswith(("?dump@", "?dumpColor@", "?printPretty@")):
             return None
+        # Remove clang::interp:: symbols: the bytecode interpreter's headers are
+        # private to clang/lib/AST/ByteCode, so no plugin can reference them.
+        if "@interp at clang@@" in symbol:
+            return None
         return symbol
     # Keep mangled global variables and static class members in llvm:: namespace.
     # These have a type mangling that looks like (this is derived from



More information about the llvm-branch-commits mailing list