From 3e2a1810c156db3a1fc6ae340091207a0a546d67 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 14 Nov 2025 09:17:05 +0900 Subject: [PATCH] [Windows] Adjust exported symbols to filter out profile symbols When building Clang for Windows with clang-cl with -fprofile-generate and LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, the build fails with lld-link: error: too many exported symbols (got 76137, max 65535) Removing the symbols generated from the use of that flag removes about 13K symbols. --- llvm/utils/extract_symbols.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py index 5254d16e410d..0aff8096bfc4 100755 --- a/llvm/utils/extract_symbols.py +++ b/llvm/utils/extract_symbols.py @@ -123,6 +123,9 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration): and (symbol.startswith("?Head@") or symbol.startswith("?Tail@")) ): return symbol + # Skip symbols added by the compiler with -fprofile-generate. + elif symbol.startswith("__prof"): + return None # Keep mangled llvm:: and clang:: function symbols. How we detect these is a # bit of a mess and imprecise, but that avoids having to completely demangle # the symbol name. The outermost namespace is at the end of the identifier -- 2.52.0