[llvm] [BOLT] Retain certain local symbols (PR #184074)

YongKang Zhu via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 21:52:56 PST 2026


================
@@ -5352,20 +5352,40 @@ void RewriteInstance::updateELFSymbolTable(
     } else {
       // Check if the function symbol matches address inside a function, i.e.
       // it marks a secondary entry point.
+      // Also look up local NOTYPE symbols inside functions so we can
+      // update their addresses to reflect the output layout.
+      // Skip AArch64 marker symbols ($d, $x) inside functions —
+      // BOLT generates its own via addExtraSymbols.
+      auto IsAArch64MarkerSymbol = [&]() {
+        return BC->isAArch64() &&
+               (SymbolName->starts_with("$d") || SymbolName->starts_with("$x"));
+      };
----------------
yozhu wrote:

This check should also be applied to RISC-V. Here we want to skip such marker symbols.

https://github.com/llvm/llvm-project/pull/184074


More information about the llvm-commits mailing list