[llvm] [BOLT] Emit synthetic FILE symbol for local cold fragments of global symbols (PR #89794)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 17:08:40 PDT 2024


================
@@ -4551,6 +4553,20 @@ void RewriteInstance::updateELFSymbolTable(
       Symbols.emplace_back(ICFSymbol);
     }
     if (Function.isSplit()) {
+      // Prepend synthetic FILE symbol to prevent local cold fragments from
+      // colliding with existing symbols with the same name.
+      if (!EmittedColdFileSymbol &&
+          FunctionSymbol.getBinding() == ELF::STB_GLOBAL) {
+        ELFSymTy FileSymbol;
+        FileSymbol.st_shndx = ELF::SHN_ABS;
+        FileSymbol.st_name = AddToStrTab("bolt_cold.o");
----------------
maksfb wrote:

nit: "bolt-code.o" or "bolt-pseudo.o" to be consistent with "ld-temp.o".

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


More information about the llvm-commits mailing list