tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

llvmorg-22-init-11861-gfbcd82aab5ff.patch (2181B)


      1 From fbcd82aab5ff4b762bd476618857a26e576c76f0 Mon Sep 17 00:00:00 2001
      2 From: zond <zondolfin@gmail.com>
      3 Date: Tue, 21 Oct 2025 14:20:26 +0200
      4 Subject: [PATCH] [Windows] Fix Registry static data members not exported by
      5 extract_symbols.py in static builds with plugin support (#163391)
      6 
      7 When building LLVM statically (without BUILD_SHARED_LIBS) on Windows with
      8 LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, external plugins cannot register through
      9 llvm::Registry<clang::PluginASTAction> because:
     10 
     11 Static data members (Head, Tail) are filtered out during symbol export by
     12 extract_symbols.py because they don't match the function signature patterns
     13 that the script looks for.
     14 
     15 This patch fixes the issue by adding pattern matching to extract_symbols.py
     16 to recognize and export Registry static data members.
     17 
     18 Note: When LLVM is built with /Zc:dllexportInlines-, inlined functions
     19 aren't exported as symbols, and the plugin must also compile with
     20 /Zc:dllexportInlines- to inline them instead of referencing non-exported
     21 symbols.
     22 
     23 Fixes #163367
     24 ---
     25 llvm/utils/extract_symbols.py | 8 ++++++++
     26 1 file changed, 8 insertions(+)
     27 
     28 diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py
     29 index 388723421d66..0cbfd2e2910e 100755
     30 --- a/llvm/utils/extract_symbols.py
     31 +++ b/llvm/utils/extract_symbols.py
     32 @@ -105,6 +105,14 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration):
     33     # Skip X86GenMnemonicTables functions, they are not exposed from llvm/include/.
     34     elif re.match(r"\?is[A-Z0-9]*@X86@llvm", symbol):
     35         return None
     36 +    # Keep Registry<T>::Head and Registry<T>::Tail static members for plugin support.
     37 +    # Pattern matches: ?Head@?$Registry@<template_args>@llvm@@ or ?Tail@?$Registry@...
     38 +    elif (
     39 +        "?$Registry@" in symbol
     40 +        and "@llvm@@" in symbol
     41 +        and (symbol.startswith("?Head@") or symbol.startswith("?Tail@"))
     42 +    ):
     43 +        return symbol
     44     # Keep mangled llvm:: and clang:: function symbols. How we detect these is a
     45     # bit of a mess and imprecise, but that avoids having to completely demangle
     46     # the symbol name. The outermost namespace is at the end of the identifier
     47 -- 
     48 2.51.0.1.g7a422dac74