[lld] [llvm] [MC, COFF] Change how we handle section symbols (PR #96459)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 24 11:39:51 PDT 2024
================
@@ -842,12 +847,21 @@ void WinCOFFWriter::executePostLayoutBinding(MCAssembler &Asm,
defineSection(static_cast<const MCSectionCOFF &>(Section), Layout);
}
- if (Mode != DwoOnly)
- for (const MCSymbol &Symbol : Asm.symbols())
- // Define non-temporary or temporary static (private-linkage) symbols
- if (!Symbol.isTemporary() ||
- cast<MCSymbolCOFF>(Symbol).getClass() == COFF::IMAGE_SYM_CLASS_STATIC)
- DefineSymbol(Symbol, Asm, Layout);
+ auto isSectionSymbol = [](const MCSymbol &Sym) {
+ return Sym.isInSection() && Sym.getSection().getBeginSymbol() == &Sym;
+ };
+
+ for (const MCSymbol &Sym : Asm.symbols())
+ if (isSectionSymbol(Sym))
+ DefineSymbol(Sym, Asm, Layout);
+ if (Mode == DwoOnly)
+ return;
+ for (const MCSymbol &Sym : Asm.symbols())
----------------
MaskRay wrote:
Split DWARF places `.debug*.dwo` sections in a separate file `a.dwo`. When split DWARF is used, the first loop ensures that the `.debug*.dwo` symbols are present in `a.dwo`.
In addition, two loops also allow us to reduce the number of updated tests..
https://github.com/llvm/llvm-project/pull/96459
More information about the llvm-commits
mailing list