diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -163,11 +163,6 @@ void addLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label); - /// addLocalLabelAddress - Add a dwarf label attribute data and value using - /// DW_FORM_addr only. - void addLocalLabelAddress(DIE &Die, dwarf::Attribute Attribute, - const MCSymbol *Label); - DwarfCompileUnit &getCU() override { return *this; } unsigned getOrCreateSourceID(const DIFile *File) override; diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -67,13 +67,19 @@ /// DW_FORM_addr or DW_FORM_GNU_addr_index. void DwarfCompileUnit::addLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label) { - // Don't use the address pool in non-fission or in the skeleton unit itself. - if ((!DD->useSplitDwarf() || !Skeleton) && DD->getDwarfVersion() < 5) - return addLocalLabelAddress(Die, Attribute, Label); - if (Label) DD->addArangeLabel(SymbolCU(this, Label)); + // Don't use the address pool in non-fission or in the skeleton unit itself. + if ((!DD->useSplitDwarf() || !Skeleton) && DD->getDwarfVersion() < 5) { + if (Label) + addAttribute(Die, Attribute, dwarf::DW_FORM_addr, DIELabel(Label)); + else + addAttribute(Die, Attribute, dwarf::DW_FORM_addr, DIEInteger(0)); + + return; + } + bool UseAddrOffsetFormOrExpressions = DD->useAddrOffsetForm() || DD->useAddrOffsetExpressions(); @@ -105,18 +111,6 @@ DD->getAddressPool().getIndex(Base), Label, Base)); } -void DwarfCompileUnit::addLocalLabelAddress(DIE &Die, - dwarf::Attribute Attribute, - const MCSymbol *Label) { - if (Label) - DD->addArangeLabel(SymbolCU(this, Label)); - - if (Label) - addAttribute(Die, Attribute, dwarf::DW_FORM_addr, DIELabel(Label)); - else - addAttribute(Die, Attribute, dwarf::DW_FORM_addr, DIEInteger(0)); -} - unsigned DwarfCompileUnit::getOrCreateSourceID(const DIFile *File) { // If we print assembly, we can't separate .file entries according to // compile units. Thus all files will belong to the default compile unit. @@ -505,7 +499,7 @@ // FIXME: when writing dwo, we need to avoid relocations. Probably // the "right" solution is to treat globals the way func and data // symbols are (with entries in .debug_addr). - // For now, since we only ever use index 0, this should work as-is. + // For now, since we only ever use index 0, this should work as-is. addUInt(*Loc, dwarf::DW_FORM_data4, FrameBase.Location.WasmLoc.Index); } addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);