Index: llvm/include/llvm/DWARFLinker/DWARFLinker.h =================================================================== --- llvm/include/llvm/DWARFLinker/DWARFLinker.h +++ llvm/include/llvm/DWARFLinker/DWARFLinker.h @@ -97,6 +97,10 @@ /// Emit the string table described by \p Pool into .debug_line_str table. virtual void emitLineStrings(const NonRelocatableStringpool &Pool) = 0; + /// Emit the address described by \p Addrs into the .debug_addr section. + virtual void emitAddrs(const SmallVector &Addrs, + uint8_t AddrSize) = 0; + /// Emit DWARF debug names. virtual void emitDebugNames(AccelTable &Table) = 0; @@ -133,6 +137,9 @@ /// Emit debug locations (.debug_loc, .debug_loclists) header. virtual MCSymbol *emitDwarfDebugLocListHeader(const CompileUnit &Unit) = 0; + /// Emit .debug_addr header. + virtual MCSymbol *emitDwarfDebugAddrHeader(const CompileUnit &Unit) = 0; + /// Emit debug locations (.debug_loc, .debug_loclists) fragment. virtual void emitDwarfDebugLocListFragment( const CompileUnit &Unit, @@ -143,6 +150,10 @@ virtual void emitDwarfDebugLocListFooter(const CompileUnit &Unit, MCSymbol *EndLabel) = 0; + /// Emit .debug_addr footer. + virtual void emitDwarfDebugAddrFooter(const CompileUnit &Unit, + MCSymbol *EndLabel) = 0; + /// Emit .debug_aranges entries for \p Unit virtual void emitDwarfDebugArangesTable(const CompileUnit &Unit, @@ -626,6 +637,31 @@ OffsetsStringPool &DebugStrPool; OffsetsStringPool &DebugLineStrPool; + struct DebugAddrPool { + DenseMap AddrIndexMap; + SmallVector Addrs; + uint64_t Index; + + DebugAddrPool() : Index(0) {} + + void clear() { + AddrIndexMap.clear(); + Addrs.clear(); + Index = 0; + } + + uint64_t getAddrIndex(uint64_t Addr) { + DenseMap::iterator It = AddrIndexMap.find(Addr); + if (It == AddrIndexMap.end()) { + It = AddrIndexMap.insert(std::make_pair(Addr, Addrs.size())).first; + Addrs.push_back(Addr); + } + return It->second; + } + }; + + DebugAddrPool AddrPool; + /// Allocator used for all the DIEValue objects. BumpPtrAllocator &DIEAlloc; @@ -792,6 +828,9 @@ void generateUnitLocations(CompileUnit &Unit, const DWARFFile &File, ExpressionHandlerRef ExprHandler) const; + void emitDebugAddrSection(CompileUnit &Unit, + SmallVector &Addrs) const; + /// Emit the accelerator entries for \p Unit. void emitAcceleratorEntriesForUnit(CompileUnit &Unit); Index: llvm/include/llvm/DWARFLinker/DWARFStreamer.h =================================================================== --- llvm/include/llvm/DWARFLinker/DWARFStreamer.h +++ llvm/include/llvm/DWARFLinker/DWARFStreamer.h @@ -84,6 +84,9 @@ /// Emit the string table described by \p Pool into .debug_line_str table. void emitLineStrings(const NonRelocatableStringpool &Pool) override; + /// Emit the addresses described by \p Pool into .debug_addr table. + void emitAddrs(const SmallVector &Addrs, uint8_t AddrSize) override; + /// Emit the swift_ast section stored in \p Buffer. void emitSwiftAST(StringRef Buffer) override; @@ -107,6 +110,9 @@ /// Emit debug locations(.debug_loc, .debug_loclists) header. MCSymbol *emitDwarfDebugLocListHeader(const CompileUnit &Unit) override; + /// Emit .debug_addr header. + MCSymbol *emitDwarfDebugAddrHeader(const CompileUnit &Unit) override; + /// Emit debug ranges(.debug_loc, .debug_loclists) fragment. void emitDwarfDebugLocListFragment( const CompileUnit &Unit, @@ -117,6 +123,10 @@ void emitDwarfDebugLocListFooter(const CompileUnit &Unit, MCSymbol *EndLabel) override; + /// Emit .debug_addr footer. + void emitDwarfDebugAddrFooter(const CompileUnit &Unit, + MCSymbol *EndLabel) override; + /// Emit .debug_aranges entries for \p Unit void emitDwarfDebugArangesTable(const CompileUnit &Unit, const AddressRanges &LinkedRanges) override; @@ -277,6 +287,7 @@ uint64_t DebugInfoSectionSize = 0; uint64_t MacInfoSectionSize = 0; uint64_t MacroSectionSize = 0; + uint64_t AddrSectionSize = 0; /// Keep track of emitted CUs and their Unique ID. struct EmittedUnit { Index: llvm/lib/DWARFLinker/DWARFLinker.cpp =================================================================== --- llvm/lib/DWARFLinker/DWARFLinker.cpp +++ llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -1384,25 +1384,15 @@ *Addr += Info.PCOffset; } - switch (AttrSpec.Form) { - case dwarf::DW_FORM_addrx: - case dwarf::DW_FORM_addrx1: - case dwarf::DW_FORM_addrx2: - case dwarf::DW_FORM_addrx3: - case dwarf::DW_FORM_addrx4: { - // DWARFLinker does not use addrx forms since it generates relocated - // addresses. Replace DW_FORM_addrx* with DW_FORM_addr here. - AttrSpec.Form = dwarf::DW_FORM_addr; - break; - } - default: - // Nothing to do. - break; - } - Die.addValue(DIEAlloc, static_cast(AttrSpec.Attr), - AttrSpec.Form, DIEInteger(*Addr)); - return Unit.getOrigUnit().getAddressByteSize(); + AttrSpec.Form, + DIEInteger(AddrAttribute->getForm() != dwarf::DW_FORM_addr + ? AddrPool.getAddrIndex(*Addr) + : *Addr)); + + return AttrSpec.Form == dwarf::DW_FORM_addr + ? Unit.getOrigUnit().getAddressByteSize() + : AttrSize; } unsigned DWARFLinker::DIECloner::cloneScalarAttribute( @@ -1667,8 +1657,7 @@ case dwarf::DW_AT_ranges: return !Update && SkipPC; case dwarf::DW_AT_addr_base: - // In case !Update the .debug_addr table is not generated/preserved. - return !Update; + return false; case dwarf::DW_AT_rnglists_base: // In case !Update the .debug_addr table is not generated/preserved. // Thus instead of DW_FORM_rnglistx the DW_FORM_sec_offset is used. @@ -2002,6 +1991,16 @@ TheDwarfEmitter->emitDwarfDebugLocListFooter(Unit, EndLabel); } +void DWARFLinker::emitDebugAddrSection(CompileUnit &Unit, + SmallVector &Addrs) const { + if (LLVM_UNLIKELY(Options.Update)) + return; + + MCSymbol *EndLabel = TheDwarfEmitter->emitDwarfDebugAddrHeader(Unit); + TheDwarfEmitter->emitAddrs(Addrs, Unit.getOrigUnit().getAddressByteSize()); + TheDwarfEmitter->emitDwarfDebugAddrFooter(Unit, EndLabel); +} + /// Insert the new line info sequence \p Seq into the current /// set of already linked line info \p Rows. static void insertLineSequence(std::vector &Seq, @@ -2567,6 +2566,9 @@ IsLittleEndian); }; Linker.generateUnitLocations(*CurrentUnit, File, ProcessExpr); + if (DwarfVersion >= 5) + Linker.emitDebugAddrSection(*CurrentUnit, AddrPool.Addrs); + AddrPool.clear(); } } Index: llvm/lib/DWARFLinker/DWARFStreamer.cpp =================================================================== --- llvm/lib/DWARFLinker/DWARFStreamer.cpp +++ llvm/lib/DWARFLinker/DWARFStreamer.cpp @@ -270,6 +270,16 @@ } } +/// Emit the debug_addr section stored in \p Pool. +void DwarfStreamer::emitAddrs(const SmallVector &Addrs, + uint8_t AddrSize) { + Asm->OutStreamer->switchSection(MOFI->getDwarfAddrSection()); + for (auto Addr : Addrs) { + Asm->OutStreamer->emitIntValue(Addr, AddrSize); + AddrSectionSize += AddrSize; + } +} + void DwarfStreamer::emitDebugNames( AccelTable &Table) { if (EmittedUnits.empty()) @@ -540,6 +550,38 @@ return EndLabel; } +/// Emit .debug_addr header. +MCSymbol *DwarfStreamer::emitDwarfDebugAddrHeader(const CompileUnit &Unit) { + if (Unit.getOrigUnit().getVersion() < 5) + return nullptr; + + // Make .debug_addr the current section. + MS->switchSection(MC->getObjectFileInfo()->getDwarfAddrSection()); + + MCSymbol *BeginLabel = Asm->createTempSymbol("Bdebugaddr"); + MCSymbol *EndLabel = Asm->createTempSymbol("Edebugaddr"); + unsigned AddrSize = Unit.getOrigUnit().getAddressByteSize(); + + // emit length. + Asm->emitLabelDifference(EndLabel, BeginLabel, sizeof(uint32_t)); + Asm->OutStreamer->emitLabel(BeginLabel); + AddrSectionSize += sizeof(uint32_t); + + // emit version + Asm->emitInt16(5); + AddrSectionSize += 2; + + // emit address size. + Asm->emitInt8(AddrSize); + AddrSectionSize += 1; + + // emit segment size. + Asm->emitInt8(0); + AddrSectionSize += 1; + + return EndLabel; +} + /// Emit debug locations(.debug_loc, .debug_loclists) fragment. void DwarfStreamer::emitDwarfDebugLocListFragment( const CompileUnit &Unit, @@ -566,6 +608,19 @@ Asm->OutStreamer->emitLabel(EndLabel); } +/// Emit .debug_addr footer. +void DwarfStreamer::emitDwarfDebugAddrFooter(const CompileUnit &Unit, + MCSymbol *EndLabel) { + if (Unit.getOrigUnit().getVersion() < 5) + return; + + // Make .debug_addr the current section. + MS->switchSection(MC->getObjectFileInfo()->getDwarfAddrSection()); + + if (EndLabel != nullptr) + Asm->OutStreamer->emitLabel(EndLabel); +} + /// Emit piece of .debug_loc for \p LinkedLocationExpression. void DwarfStreamer::emitDwarfDebugLocTableFragment( const CompileUnit &Unit, Index: llvm/test/tools/dsymutil/ARM/dwarf5-addrx-0x0-last.test =================================================================== --- llvm/test/tools/dsymutil/ARM/dwarf5-addrx-0x0-last.test +++ llvm/test/tools/dsymutil/ARM/dwarf5-addrx-0x0-last.test @@ -31,7 +31,7 @@ CHECK-NOT: error: DEBUGINFO: DW_TAG_subprogram -DEBUGINFO: DW_AT_low_pc [DW_FORM_addr] (0x0000000100003f4c) +DEBUGINFO: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000100003f4c) DEBUGINFO: DW_AT_high_pc [DW_FORM_data4] (0x00000054) DEBUGINFO: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000011c] = "main") Index: llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test =================================================================== --- llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test +++ llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test @@ -39,23 +39,23 @@ CHECK-NEXT: Abbrev table for offset: 0x00000000 CHECK: .debug_info contents: -CHECK: 0x00000000: Compile Unit: length = 0x00000064, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 +CHECK: 0x00000000: Compile Unit: length = 0x00000061, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]] CHECK-NEXT: [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]])) -CHECK: 0x00000033: DW_TAG_subprogram [2] * (0x0000000c) -CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,LOCLIST_LOWPC:]]) -CHECK: 0x00000050: DW_TAG_formal_parameter [3] (0x00000033) +CHECK: 0x00000037: DW_TAG_subprogram [2] * (0x0000000c) +CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[#%.16x,LOCLIST_LOWPC:]]) +CHECK: 0x0000004d: DW_TAG_formal_parameter [3] (0x00000037) CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOCLIST_OFFSET:[0-9a-f]+]]: CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]] CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]]) -CHECK: 0x00000068: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 +CHECK: 0x00000065: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 CHECK: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,RANGE_LOWPC:]]) CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000 CHECK-NEXT: [0x[[#%.16x,RANGE_START:]], 0x[[#%.16x,RANGE_END:]])) -CHECK:0x0000009a: DW_TAG_subprogram [2] * (0x00000073) +CHECK: 0x00000097: DW_TAG_subprogram [6] * (0x00000070) CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,LOC_LOWPC:]]) -CHECK:0x000000b7: DW_TAG_formal_parameter [3] (0x0000009a) +CHECK: 0x000000b4: DW_TAG_formal_parameter [3] (0x00000097) CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]: CHECK-NEXT: [0x[[#%.16x,LOC_PAIR_START:]], 0x[[#%.16x,LOC_PAIR_END:]]): [[LOC_EXPR:.*]] CHECK-NEXT: [0x[[#%.16x,LOC_PAIR_START2:]], 0x[[#%.16x,LOC_PAIR_END2:]]): [[LOC_EXPR2:.*]]) Index: llvm/test/tools/dsymutil/ARM/dwarf5-macho.test =================================================================== --- llvm/test/tools/dsymutil/ARM/dwarf5-macho.test +++ llvm/test/tools/dsymutil/ARM/dwarf5-macho.test @@ -25,12 +25,12 @@ CHECK-NEXT: Abbrev table for offset: 0x00000000 CHECK: .debug_info contents: -CHECK-NEXT: 0x00000000: Compile Unit: length = 0x00000064, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 +CHECK-NEXT: Compile Unit: length = 0x00000061, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]] CHECK-NEXT: [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]])) -CHECK: 0x00000033: DW_TAG_subprogram [2] * (0x0000000c) -CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,LOCLIST_LOWPC:]]) -CHECK: 0x00000050: DW_TAG_formal_parameter [3] (0x00000033) +CHECK: 0x00000037: DW_TAG_subprogram [2] * (0x0000000c) +CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[#%.16x,LOCLIST_LOWPC:]]) +CHECK: 0x0000004d: DW_TAG_formal_parameter [3] (0x00000037) CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]: CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]] CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]]) Index: llvm/test/tools/dsymutil/X86/dwarf5-addrx.test =================================================================== --- llvm/test/tools/dsymutil/X86/dwarf5-addrx.test +++ llvm/test/tools/dsymutil/X86/dwarf5-addrx.test @@ -56,45 +56,44 @@ DWARF: DW_TAG_compile_unit DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "dwarf5-addrx.c" -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000eb0) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000100000eb0) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000103) DWARF: DW_TAG_subprogram -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000eb0) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000100000eb0) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010) DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo1" DWARF: DW_TAG_subprogram -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ec0) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000100000ec0) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010) DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo2" DWARF: DW_TAG_subprogram -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ed0) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000100000ed0) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010) DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo3" DWARF: DW_TAG_subprogram -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ee0) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000100000ee0) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010) DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo4" DWARF: DW_TAG_subprogram -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ef0) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000004) address = 0x0000000100000ef0) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010) DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo5" DWARF: DW_TAG_subprogram -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f00) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000005) address = 0x0000000100000f00) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010) DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo6" DWARF: DW_TAG_subprogram -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f10) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000006) address = 0x0000000100000f10) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010) DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo7" DWARF: DW_TAG_subprogram -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f20) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000007) address = 0x0000000100000f20) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010) DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo8" DWARF: DW_TAG_subprogram -DWARF: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f30) +DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000008) address = 0x0000000100000f30) DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000083) DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "main" -DWARF-NOT: .debug_addr contents UPDATE-DWARF: DW_TAG_compile_unit UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "dwarf5-addrx.c" Index: llvm/test/tools/dsymutil/X86/dwarf5-dw-op-addrx.test =================================================================== --- llvm/test/tools/dsymutil/X86/dwarf5-dw-op-addrx.test +++ llvm/test/tools/dsymutil/X86/dwarf5-dw-op-addrx.test @@ -57,7 +57,6 @@ #DWARF-CHECK: DW_TAG_variable #DWARF-CHECK: DW_AT_name {{.*}}"arr9" #DWARF-CHECK: DW_AT_location {{.*}}(DW_OP_addr 0x100009000) -#DWARF-CHECK-NOT: .debug_addr #UPD-DWARF-CHECK: DW_TAG_compile_unit #UPD-DWARF-CHECK: DW_AT_name {{.*}}"dwarf5-dw-op-addrx.c" Index: llvm/test/tools/dsymutil/X86/dwarf5-rnglists.test =================================================================== --- llvm/test/tools/dsymutil/X86/dwarf5-rnglists.test +++ llvm/test/tools/dsymutil/X86/dwarf5-rnglists.test @@ -44,14 +44,12 @@ #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x0000000c #DWARF-CHECK: [0x0000000100000f79, 0x0000000100000f96) #DWARF-CHECK: [0x0000000100000fad, 0x0000000100000fb4)) -#DWARF-CHECK-NOT: debug_addr #DWARF-CHECK: .debug_rnglists contents: #DWARF-CHECK: 0x00000000: range list header: length = 0x0000001d, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 #DWARF-CHECK: ranges: #DWARF-CHECK: 0x0000000c: [DW_RLE_start_length]: 0x0000000100000f79, 0x000000000000001d => [0x0000000100000f79, 0x0000000100000f96) #DWARF-CHECK: 0x00000016: [DW_RLE_start_length]: 0x0000000100000fad, 0x0000000000000007 => [0x0000000100000fad, 0x0000000100000fb4) #DWARF-CHECK: 0x00000020: [DW_RLE_end_of_list ] -#DWARF-CHECK-NOT: debug_addr # #UPD-DWARF-CHECK: DW_TAG_compile_unit #UPD-DWARF-CHECK: DW_TAG_lexical_block Index: llvm/test/tools/dsymutil/X86/op-convert-offset.test =================================================================== --- llvm/test/tools/dsymutil/X86/op-convert-offset.test +++ llvm/test/tools/dsymutil/X86/op-convert-offset.test @@ -34,12 +34,12 @@ OBJ: DW_AT_name ("b") OBJ: DW_AT_type (0x000000af "_Bool") -DSYM: 0x000000ae: DW_TAG_base_type +DSYM: 0x0000009a: DW_TAG_base_type DSYM: DW_AT_name ("DW_ATE_unsigned_1") DSYM: DW_AT_encoding (DW_ATE_unsigned) DSYM: DW_AT_byte_size (0x01) -DSYM: 0x000000d5: DW_TAG_formal_parameter -DSYM: DW_AT_location (DW_OP_breg2 RCX+0, DW_OP_constu 0xff, DW_OP_and, DW_OP_convert (0x000000ae) "DW_ATE_unsigned_1", DW_OP_convert (0x000000b5) "DW_ATE_unsigned_8", DW_OP_stack_value) +DSYM: 0x000000ba: DW_TAG_formal_parameter +DSYM: DW_AT_location (DW_OP_breg2 RCX+0, DW_OP_constu 0xff, DW_OP_and, DW_OP_convert (0x0000009a) "DW_ATE_unsigned_1", DW_OP_convert (0x000000a1) "DW_ATE_unsigned_8", DW_OP_stack_value) DSYM: DW_AT_name ("b") -DSYM: DW_AT_type (0x000000f3 "_Bool") +DSYM: DW_AT_type (0x000000d8 "_Bool") Index: llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-addresses.test =================================================================== --- llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-addresses.test +++ llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-addresses.test @@ -25,31 +25,31 @@ #DWARF-CHECK: DW_TAG_compile_unit #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "CU1" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001130) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000060) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo1" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001130) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo2" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001140) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000001140) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo3" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001150) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000001150) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo4" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001160) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx1] (indexed (00000003) address = 0x0000000000001160) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo5" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001170) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx2] (indexed (00000004) address = 0x0000000000001170) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo6" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001180) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx4] (indexed (00000005) address = 0x0000000000001180) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_variable #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "var1" Index: llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-rnglists.test =================================================================== --- llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-rnglists.test +++ llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-rnglists.test @@ -20,42 +20,48 @@ #DWARF-CHECK: DW_TAG_compile_unit #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "CU1" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001130) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130) #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[CURANGE_OFF:[0-9a-f]*]] #DWARF-CHECK: [0x0000000000001130, 0x0000000000001170)) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo1" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001130) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_lexical_block #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F1RANGE_OFF:[0-9a-f]*]] #DWARF-CHECK: [0x0000000000001130, 0x0000000000001140)) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo2" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001140) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000001140) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_lexical_block #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F2RANGE_OFF:[0-9a-f]*]] #DWARF-CHECK: [0x0000000000001140, 0x0000000000001150)) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo3" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001150) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000001150) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_lexical_block #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F3RANGE_OFF:[0-9a-f]*]] #DWARF-CHECK: [0x0000000000001150, 0x0000000000001160)) #DWARF-CHECK: DW_TAG_subprogram #DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo4" -#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001160) +#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000001160) #DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010) #DWARF-CHECK: DW_TAG_lexical_block #DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F4RANGE_OFF:[0-9a-f]*]] #DWARF-CHECK: [0x0000000000001160, 0x0000000000001170)) -#DWARF-CHECK-NOT: .debug_addr contents: #DWARF-CHECK: .debug_aranges contents: #DWARF-CHECK: Address Range Header: length = 0x0000002c, format = DWARF32, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00 #DWARF-CHECK: [0x0000000000001130, 0x0000000000001170) -#DWARF-CHECK-NOT: .debug_addr contents: +#DWARF-CHECK: .debug_addr contents: +#DWARF-CHECK: 0x00000000: Address table header: length = 0x00000024, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00 +#DWARF-CHECK: Addrs: [ +#DWARF-CHECK: 0x0000000000001130 +#DWARF-CHECK: 0x0000000000001140 +#DWARF-CHECK: 0x0000000000001150 +#DWARF-CHECK: 0x0000000000001160 +#DWARF-CHECK: ] #DWARF-CHECK: .debug_rnglists contents: #DWARF-CHECK: 0x00000000: range list header: length = 0x0000003f, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 #DWARF-CHECK: ranges: @@ -69,7 +75,6 @@ #DWARF-CHECK: {{.*}} [DW_RLE_end_of_list ] #DWARF-CHECK: 0x[[CURANGE_OFF]]: [DW_RLE_start_length]: 0x0000000000001130, 0x0000000000000040 => [0x0000000000001130, 0x0000000000001170) #DWARF-CHECK: {{.*}} [DW_RLE_end_of_list ] -#DWARF-CHECK-NOT: .debug_addr contents: #UPD-DWARF-CHECK: DW_TAG_compile_unit #UPD-DWARF-CHECK: DW_AT_name {{.*}}"CU1"