From 4f4087edb1823d943ae9b5e4128e2a4e6ef983dd Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh@glandium.org>
Date: Wed, 25 Feb 2026 17:45:30 +0900
Subject: [PATCH] [Windows] Adjust exported symbols to filter out profile
 symbols (#167985)

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 61e2021f0175..40a43d365555 100755
--- a/llvm/utils/extract_symbols.py
+++ b/llvm/utils/extract_symbols.py
@@ -128,6 +128,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

