Index: llvm/include/llvm/DWARFLinker/DWARFLinker.h =================================================================== --- llvm/include/llvm/DWARFLinker/DWARFLinker.h +++ llvm/include/llvm/DWARFLinker/DWARFLinker.h @@ -140,7 +140,7 @@ /// Emit debug locations (.debug_loc, .debug_loclists) fragment. virtual void emitDwarfDebugLocListFragment( const CompileUnit &Unit, - const DWARFLocationExpressionsVector &LinkedLocationExpression, + const DWARFLocationExpressionsFragment &LinkedLocationExpressionsFrag, PatchLocation Patch) = 0; /// Emit debug locations (.debug_loc, .debug_loclists) footer. Index: llvm/include/llvm/DWARFLinker/DWARFStreamer.h =================================================================== --- llvm/include/llvm/DWARFLinker/DWARFStreamer.h +++ llvm/include/llvm/DWARFLinker/DWARFStreamer.h @@ -110,7 +110,7 @@ /// Emit debug ranges(.debug_loc, .debug_loclists) fragment. void emitDwarfDebugLocListFragment( const CompileUnit &Unit, - const DWARFLocationExpressionsVector &LinkedLocationExpression, + const DWARFLocationExpressionsFragment &LinkedLocationExpressionsFrag, PatchLocation Patch) override; /// Emit debug ranges(.debug_loc, .debug_loclists) footer. @@ -218,7 +218,7 @@ /// Emit piece of .debug_loclists for \p LinkedRanges. void emitDwarfDebugLocListsTableFragment( const CompileUnit &Unit, - const DWARFLocationExpressionsVector &LinkedLocationExpression, + const DWARFLocationExpressionsFragment &LinkedLocationExpressionsFrag, PatchLocation Patch); /// \defgroup Line table emission Index: llvm/include/llvm/DebugInfo/DWARF/DWARFLocationExpression.h =================================================================== --- llvm/include/llvm/DebugInfo/DWARF/DWARFLocationExpression.h +++ llvm/include/llvm/DebugInfo/DWARF/DWARFLocationExpression.h @@ -43,6 +43,11 @@ /// Represents a set of absolute location expressions. using DWARFLocationExpressionsVector = std::vector; +struct DWARFLocationExpressionsFragment { + DWARFLocationExpressionsVector LinkedLocationExpression; + uint64_t BaseAddress; +}; + } // end namespace llvm #endif // LLVM_DEBUGINFO_DWARF_DWARFLOCATIONEXPRESSION_H Index: llvm/lib/DWARFLinker/DWARFLinker.cpp =================================================================== --- llvm/lib/DWARFLinker/DWARFLinker.cpp +++ llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -1969,15 +1969,25 @@ continue; } - DWARFLocationExpressionsVector LinkedLocationExpressions; + DWARFLocationExpressionsFragment LinkedLocationExpressionsFrag; + // Calculate value of the DW_LLE_base_address. + auto FirstLocation = (*OriginalLocations)[0]; + LinkedLocationExpressionsFrag.BaseAddress = + Unit.getOrigUnit().getVersion() >= 5 && FirstLocation.Range + ? FirstLocation.Range->LowPC + CurLocAttr.RelocAdjustment + : 0; for (DWARFLocationExpression &CurExpression : *OriginalLocations) { DWARFLocationExpression LinkedExpression; if (CurExpression.Range) { // Relocate address range. + uint64_t LowPCVal = CurExpression.Range->LowPC + + CurLocAttr.RelocAdjustment - + LinkedLocationExpressionsFrag.BaseAddress; + assert(LowPCVal >= 0 && "Low PC value should not be negative!"); LinkedExpression.Range = { - CurExpression.Range->LowPC + CurLocAttr.RelocAdjustment, - CurExpression.Range->HighPC + CurLocAttr.RelocAdjustment}; + LowPCVal, CurExpression.Range->HighPC + CurLocAttr.RelocAdjustment - + LinkedLocationExpressionsFrag.BaseAddress}; } // Clone expression. @@ -1985,12 +1995,13 @@ ExprHandler(CurExpression.Expr, LinkedExpression.Expr, CurLocAttr.RelocAdjustment); - LinkedLocationExpressions.push_back(LinkedExpression); + LinkedLocationExpressionsFrag.LinkedLocationExpression.push_back( + LinkedExpression); } // Emit locations list table fragment corresponding to the CurLocAttr. TheDwarfEmitter->emitDwarfDebugLocListFragment( - Unit, LinkedLocationExpressions, CurLocAttr); + Unit, LinkedLocationExpressionsFrag, CurLocAttr); } // Emit locations list table footer. Index: llvm/lib/DWARFLinker/DWARFStreamer.cpp =================================================================== --- llvm/lib/DWARFLinker/DWARFStreamer.cpp +++ llvm/lib/DWARFLinker/DWARFStreamer.cpp @@ -543,14 +543,16 @@ /// Emit debug locations(.debug_loc, .debug_loclists) fragment. void DwarfStreamer::emitDwarfDebugLocListFragment( const CompileUnit &Unit, - const DWARFLocationExpressionsVector &LinkedLocationExpression, + const DWARFLocationExpressionsFragment &LinkedLocationExpressionsFrag, PatchLocation Patch) { if (Unit.getOrigUnit().getVersion() < 5) { - emitDwarfDebugLocTableFragment(Unit, LinkedLocationExpression, Patch); + emitDwarfDebugLocTableFragment( + Unit, LinkedLocationExpressionsFrag.LinkedLocationExpression, Patch); return; } - emitDwarfDebugLocListsTableFragment(Unit, LinkedLocationExpression, Patch); + emitDwarfDebugLocListsTableFragment(Unit, LinkedLocationExpressionsFrag, + Patch); } /// Emit debug locations(.debug_loc, .debug_loclists) footer. @@ -606,32 +608,44 @@ LocSectionSize += AddressSize; } -/// Emit piece of .debug_loclists for \p LinkedLocationExpression. +/// Emit piece of .debug_loclists for \p LinkedLocationExpressionsFrag. void DwarfStreamer::emitDwarfDebugLocListsTableFragment( const CompileUnit &Unit, - const DWARFLocationExpressionsVector &LinkedLocationExpression, + const DWARFLocationExpressionsFragment &LinkedLocationExpressionsFrag, PatchLocation Patch) { Patch.set(LocListsSectionSize); // Make .debug_loclists the current section. MS->switchSection(MC->getObjectFileInfo()->getDwarfLoclistsSection()); - unsigned AddressSize = Unit.getOrigUnit().getAddressByteSize(); + bool BaseAddressEmitted = false; for (const DWARFLocationExpression &LocExpression : - LinkedLocationExpression) { + LinkedLocationExpressionsFrag.LinkedLocationExpression) { if (LocExpression.Range) { + + if (!BaseAddressEmitted) { + // Emit base address. + MS->emitInt8(dwarf::DW_LLE_base_address); + LocListsSectionSize += 1; + unsigned AddressSize = Unit.getOrigUnit().getAddressByteSize(); + MS->emitIntValue(LinkedLocationExpressionsFrag.BaseAddress, + AddressSize); + LocListsSectionSize += AddressSize; + BaseAddressEmitted = true; + } + // Emit type of entry. - MS->emitInt8(dwarf::DW_LLE_start_length); + MS->emitInt8(dwarf::DW_LLE_offset_pair); LocListsSectionSize += 1; - // Emit start address. - MS->emitIntValue(LocExpression.Range->LowPC, AddressSize); - LocListsSectionSize += AddressSize; + // Emit start offset relative to base address. + LocListsSectionSize += + MS->emitULEB128IntValue(LocExpression.Range->LowPC); - // Emit length of the range. - LocListsSectionSize += MS->emitSLEB128IntValue( - LocExpression.Range->HighPC - LocExpression.Range->LowPC); + // Emit end offset relative to base address. + LocListsSectionSize += + MS->emitSLEB128IntValue(LocExpression.Range->HighPC); } else { // Emit type of entry. MS->emitInt8(dwarf::DW_LLE_default_location); Index: llvm/lib/DWARFLinkerParallel/DWARFEmitterImpl.h =================================================================== --- llvm/lib/DWARFLinkerParallel/DWARFEmitterImpl.h +++ llvm/lib/DWARFLinkerParallel/DWARFEmitterImpl.h @@ -218,7 +218,7 @@ /// Emit piece of .debug_loclists for \p LinkedRanges. void emitDwarfDebugLocListsTableFragment( const CompileUnit &Unit, - const DWARFLocationExpressionsVector &LinkedLocationExpression, + const DWARFLocationExpressionsFragment &LinkedLocationExpressionsFrag, LocAttrPatch &Patch) {} /// \defgroup MCObjects MC layer objects constructed by the streamer 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 @@ -42,32 +42,38 @@ CHECK-NEXT: 0x00000000: Compile Unit: length = 0x0000007d, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000081) 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-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOCLIST_OFFSET:[0-9a-f]+]]: -CHECK-NEXT: [0x[[LOCLIST_OFFSET_START:[0-9a-f]+]], 0x[[LOCLIST_OFFSET_END:[0-9a-f]+]]): [[LOCLIST_EXPR:.*]] -CHECK-NEXT: [0x[[LOCLIST_OFFSET_START2:[0-9a-f]+]], 0x[[LOCLIST_OFFSET_END2:[0-9a-f]+]]): [[LOCLIST_EXPR2:.*]]) +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: 0x00000081: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000000f7) -CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000 -CHECK-NEXT: [0x00000000000200[[RANGE_OFFSET_START:[0-9a-f][0-9a-f]]], 0x00000000000200[[RANGE_OFFSET_END:[0-9a-f][0-9a-f]]])) +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:0x000000b3: DW_TAG_subprogram [2] * (0x0000008c) +CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,LOC_LOWPC:]]) CHECK:0x000000d0: DW_TAG_formal_parameter [3] (0x000000b3) CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]: -CHECK-NEXT: [0x00000000000200[[LOC_OFFSET_START:[0-9a-f][0-9a-f]]], 0x00000000000200[[LOC_OFFSET_END:[0-9a-f][0-9a-f]]]): [[LOC_EXPR:.*]] -CHECK-NEXT: [0x00000000000200[[LOC_OFFSET_START2:[0-9a-f][0-9a-f]]], 0x00000000000200[[LOC_OFFSET_END2:[0-9a-f][0-9a-f]]]): [[LOC_EXPR2:.*]]) +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:.*]]) CHECK: .debug_loc contents: CHECK-NEXT: 0x[[LOC_OFFSET]]: -CHECK-NEXT: (0x0000000000000000, 0x0000000000000004): [[LOC_EXPR:.*]] -CHECK-NEXT: (0x0000000000000004, 0x0000000000000008): [[LOC_EXPR2:.*]] +CHECK-NEXT: (0x[[#sub(LOC_PAIR_START,LOC_LOWPC)]], 0x[[#sub(LOC_PAIR_END,LOC_LOWPC)]]): [[LOC_EXPR:.*]] +CHECK-NEXT: (0x[[#sub(LOC_PAIR_START2,LOC_LOWPC)]], 0x[[#sub(LOC_PAIR_END2,LOC_LOWPC)]]): [[LOC_EXPR2:.*]] CHECK: .debug_loclists contents: -CHECK-NEXT: 0x00000000: locations list header: length = 0x00000024, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 +CHECK-NEXT: 0x00000000: locations list header: length = 0x0000001f, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 CHECK-NEXT: 0x[[LOCLIST_OFFSET]]: -CHECK-NEXT: DW_LLE_start_length {{.*}} -CHECK-NEXT: => [0x[[LOCLIST_OFFSET_START]], 0x[[LOCLIST_OFFSET_END]]): [[LOCLIST_EXPR]] -CHECK-NEXT: DW_LLE_start_length {{.*}} -CHECK-NEXT: => [0x[[LOCLIST_OFFSET_START2]], 0x[[LOCLIST_OFFSET_END2]]): [[LOCLIST_EXPR2]] -CHECK-NEXT: DW_LLE_end_of_list () +CHECK-NEXT: DW_LLE_base_address (0x[[#LOCLIST_LOWPC]]) +CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END,LOCLIST_LOWPC)]]) +CHECK-NEXT: => [0x[[#LOCLIST_PAIR_START]], 0x[[#LOCLIST_PAIR_END]]): [[LOCLIST_EXPR]] +CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START2,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END2,LOCLIST_LOWPC)]]) +CHECK-NEXT: => [0x[[#LOCLIST_PAIR_START2]], 0x[[#LOCLIST_PAIR_END2]]): [[LOCLIST_EXPR2]] +CHECK-NEXT: DW_LLE_end_of_list () CHECK: .debug_line contents: CHECK-NEXT: debug_line[0x00000000] @@ -138,7 +144,7 @@ CHECK-NEXT: 0x00000029: "a.cpp" CHECK: .debug_ranges contents: -CHECK-NEXT: 00000000 00000000000000[[RANGE_OFFSET_START]] 00000000000000[[RANGE_OFFSET_END]] +CHECK-NEXT: 00000000 [[#sub(RANGE_START,RANGE_LOWPC)]] [[#sub(RANGE_END,RANGE_LOWPC)]] CHECK: .debug_rnglists contents: CHECK-NEXT: 0x00000000: range list header: length = 0x00000013, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 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 @@ -26,21 +26,24 @@ CHECK: .debug_info contents: CHECK-NEXT: 0x00000000: Compile Unit: length = 0x0000007d, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000081) -CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGE_OFFSET:[0-9a-f]+]] -CHECK-NEXT: [0x[[RANGE_OFFSET_START:[0-9a-f]+]], 0x[[RANGE_OFFSET_END:[0-9a-f]+]])) +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-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]: -CHECK-NEXT: [0x[[LOC_OFFSET_START:[0-9a-f]+]], 0x[[LOC_OFFSET_END:[0-9a-f]+]]): [[LOC_EXPR:.*]] -CHECK-NEXT: [0x[[LOC_OFFSET_START2:[0-9a-f]+]], 0x[[LOC_OFFSET_END2:[0-9a-f]+]]): [[LOC_EXPR2:.*]]) +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: .debug_loclists contents: -CHECK-NEXT: 0x00000000: locations list header: length = 0x00000024, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 +CHECK-NEXT: locations list header: length = 0x0000001f, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 CHECK-NEXT: 0x[[LOC_OFFSET]]: -CHECK-NEXT: DW_LLE_start_length {{.*}} -CHECK-NEXT: => [0x[[LOC_OFFSET_START]], 0x[[LOC_OFFSET_END]]): [[LOC_EXPR]] -CHECK-NEXT: DW_LLE_start_length {{.*}} -CHECK-NEXT: => [0x[[LOC_OFFSET_START2]], 0x[[LOC_OFFSET_END2]]): [[LOC_EXPR2]] -CHECK-NEXT: DW_LLE_end_of_list () +CHECK-NEXT: DW_LLE_base_address (0x[[#LOCLIST_LOWPC]]) +CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END,LOCLIST_LOWPC)]]) +CHECK-NEXT: => [0x[[#LOCLIST_PAIR_START]], 0x[[#LOCLIST_PAIR_END]]): [[LOCLIST_EXPR]] +CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START2,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END2,LOCLIST_LOWPC)]]) +CHECK-NEXT: => [0x[[#LOCLIST_PAIR_START2]], 0x[[#LOCLIST_PAIR_END2]]): [[LOCLIST_EXPR2]] +CHECK-NEXT: DW_LLE_end_of_list () CHECK: .debug_line contents: CHECK-NEXT: debug_line[0x00000000] @@ -84,7 +87,7 @@ CHECK: .debug_rnglists contents: CHECK-NEXT: 0x00000000: range list header: length = 0x00000013, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 CHECK-NEXT: ranges: -CHECK-NEXT: [[RANGE_OFFSET]]: [DW_RLE_start_length]: {{.*}}[0x[[RANGE_OFFSET_START]], 0x[[RANGE_OFFSET_END]]) +CHECK-NEXT: [[RANGELIST_OFFSET]]: [DW_RLE_start_length]: {{.*}}[0x[[RANGELIST_OFFSET_START]], 0x[[RANGELIST_OFFSET_END]]) CHECK: .debug_names contents: CHECK-NEXT: Name Index @ 0x0 { Index: llvm/test/tools/dsymutil/X86/dwarf5-loclists.test =================================================================== --- llvm/test/tools/dsymutil/X86/dwarf5-loclists.test +++ llvm/test/tools/dsymutil/X86/dwarf5-loclists.test @@ -38,30 +38,36 @@ #DWARF-CHECK: [0x0000000100000fa3, 0x0000000100000fbc): DW_OP_breg6 RBP-20) #DWARF-CHECK: DW_AT_name {{.*}} "argv" #DWARF-CHECK: DW_TAG_formal_parameter -#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x0000004a: +#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000031: #DWARF-CHECK: [0x0000000100000f70, 0x0000000100000f89): DW_OP_reg4 RSI #DWARF-CHECK: [0x0000000100000f89, 0x0000000100000fbc): DW_OP_entry_value(DW_OP_reg4 RSI), DW_OP_stack_value) #DWARF-CHECK: DW_AT_name {{.*}} "argc" #DWARF-CHECK: .debug_loclists contents: -#DWARF-CHECK: 0x00000000: locations list header: length = 0x00000062, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 +#DWARF-CHECK: 0x00000000: locations list header: length = 0x00000045, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000 #DWARF-CHECK: 0x0000000c: -#DWARF-CHECK: DW_LLE_start_length (0x0000000100000f70, 0x0000000000000017) -#DWARF-CHECK: => [0x0000000100000f70, 0x0000000100000f87): DW_OP_reg5 RDI -#DWARF-CHECK: DW_LLE_start_length (0x0000000100000f87, 0x000000000000000c) -#DWARF-CHECK: => [0x0000000100000f87, 0x0000000100000f93): DW_OP_reg3 RBX -#DWARF-CHECK: DW_LLE_start_length (0x0000000100000f93, 0x000000000000000a) -#DWARF-CHECK: => [0x0000000100000f93, 0x0000000100000f9d): DW_OP_reg4 RSI -#DWARF-CHECK: DW_LLE_start_length (0x0000000100000fa0, 0x0000000000000003) -#DWARF-CHECK: => [0x0000000100000fa0, 0x0000000100000fa3): DW_OP_reg3 RBX -#DWARF-CHECK: DW_LLE_start_length (0x0000000100000fa3, 0x0000000000000019) -#DWARF-CHECK: => [0x0000000100000fa3, 0x0000000100000fbc): DW_OP_breg6 RBP-20 -#DWARF-CHECK: DW_LLE_end_of_list () -#DWARF-CHECK: 0x0000004a: -#DWARF-CHECK: DW_LLE_start_length (0x0000000100000f70, 0x0000000000000019) -#DWARF-CHECK: => [0x0000000100000f70, 0x0000000100000f89): DW_OP_reg4 RSI -#DWARF-CHECK: DW_LLE_start_length (0x0000000100000f89, 0x0000000000000033) -#DWARF-CHECK: => [0x0000000100000f89, 0x0000000100000fbc): DW_OP_entry_value(DW_OP_reg4 RSI), DW_OP_stack_value -#DWARF-CHECK: DW_LLE_end_of_list () +#DWARF-CHECK: DW_LLE_base_address (0x0000000100000f70) +#DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000000, 0x0000000000000017) +#DWARF-CHECK: => [0x0000000100000f70, 0x0000000100000f87): DW_OP_reg5 RDI +#DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000017, 0x0000000000000023) +#DWARF-CHECK: => [0x0000000100000f87, 0x0000000100000f93): DW_OP_reg3 RBX +#DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000023, 0x000000000000002d) +#DWARF-CHECK: => [0x0000000100000f93, 0x0000000100000f9d): DW_OP_reg4 RSI +#DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000030, 0x0000000000000033) +#DWARF-CHECK: => [0x0000000100000fa0, 0x0000000100000fa3): DW_OP_reg3 RBX +#DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000033, 0x000000000000004c) +#DWARF-CHECK: => [0x0000000100000fa3, 0x0000000100000fbc): DW_OP_breg6 RBP-20 +#DWARF-CHECK: DW_LLE_end_of_list () +#DWARF-CHECK: 0x00000031: +#DWARF-CHECK: DW_LLE_base_address (0x0000000100000f70) +#DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000000, 0x0000000000000019) +#DWARF-CHECK: => [0x0000000100000f70, 0x0000000100000f89): DW_OP_reg4 RSI +#DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000019, 0x000000000000004c) +#DWARF-CHECK: => [0x0000000100000f89, 0x0000000100000fbc): DW_OP_entry_value(DW_OP_reg4 RSI), DW_OP_stack_value +#DWARF-CHECK: DW_LLE_end_of_list () + + + + #UPD-DWARF-CHECK: DW_TAG_compile_unit #UPD-DWARF-CHECK: DW_AT_name {{.*}} "dwarf5-loclists.c" Index: llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-loclists.test =================================================================== --- llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-loclists.test +++ llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-loclists.test @@ -26,11 +26,11 @@ #DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x0000000c: #DWARF-CHECK: [0x0000000000001130, 0x0000000000001140): DW_OP_reg5 RDI) #DWARF-CHECK: DW_AT_name {{.*}}"var2" -#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000019: +#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x0000001b: #DWARF-CHECK: : DW_OP_reg5 RDI) #DWARF-CHECK: DW_TAG_variable #DWARF-CHECK: DW_AT_name {{.*}}"var3" -#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x0000001d: +#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x0000001f: #DWARF-CHECK: [0x0000000000001140, 0x0000000000001150): DW_OP_reg5 RDI #DWARF-CHECK: [0x0000000000001160, 0x0000000000001170): DW_OP_reg6 RBP)