[lld] [llvm] [MC] Rename temporary symbols of empty name to ".L0" (PR #89693)

Luís Marques via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 02:54:42 PDT 2024


================
@@ -725,7 +725,13 @@ void ELFWriter::computeSymbolTable(
         HasLargeSectionIndex = true;
     }
 
+    // Temporary symbols generated for certain assembler features (.eh_frame,
+    // .debug_line) of an empty name may be referenced by relocations due to
+    // linker relaxation. Rename them to ".L0" to match the gas fake label name
+    // and allow ld/objcopy --discard-locals to discard such symbols.
     StringRef Name = Symbol.getName();
+    if (Name.empty())
+      Name = ".L0";
----------------
luismarques wrote:

Oh, interesting point. If these symbols are "discarded after linking by default", is that `symbol_is_valid` filtering relevant only when the defaults are overridden and they are not being discarded?

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


More information about the llvm-commits mailing list