forked from OSchip/llvm-project
DebugInfo: Add GNU_addr_base and GNU_ranges_base only when there are addresses or ranges
Based on code review feedback from Eric in r204672. llvm-svn: 204702
This commit is contained in:
parent
1425622ad8
commit
3ffe4dd67f
|
@ -956,6 +956,17 @@ void DwarfDebug::finalizeModuleInfo() {
|
|||
dwarf::DW_FORM_data8, ID);
|
||||
SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||
dwarf::DW_FORM_data8, ID);
|
||||
|
||||
// We don't keep track of which addresses are used in which CU so this
|
||||
// is a bit pessimistic under LTO.
|
||||
if (!InfoHolder.getAddrPool()->empty())
|
||||
addSectionLabel(Asm, SkCU, SkCU->getUnitDie(),
|
||||
dwarf::DW_AT_GNU_addr_base, DwarfAddrSectionSym,
|
||||
DwarfAddrSectionSym);
|
||||
if (!TheU->getRangeLists().empty())
|
||||
addSectionLabel(Asm, SkCU, SkCU->getUnitDie(),
|
||||
dwarf::DW_AT_GNU_ranges_base,
|
||||
DwarfDebugRangeSectionSym, DwarfDebugRangeSectionSym);
|
||||
}
|
||||
|
||||
// If we have code split among multiple sections or non-contiguous
|
||||
|
@ -2660,19 +2671,6 @@ DwarfCompileUnit *DwarfDebug::constructSkeletonCU(const DwarfCompileUnit *CU) {
|
|||
|
||||
initSkeletonUnit(CU, Die, NewCU);
|
||||
|
||||
// Relocate to the beginning of the addr_base section, else 0 for the
|
||||
// beginning of the one for this compile unit.
|
||||
// We could shave off some space if we deferred adding these attributes until
|
||||
// the end of the CU to see if we have a non-empty debug_addr and debug_ranges
|
||||
// sections so we don't bother with extra attributes and relocations.
|
||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections()) {
|
||||
NewCU->addSectionLabel(Die, dwarf::DW_AT_GNU_addr_base, DwarfAddrSectionSym);
|
||||
NewCU->addSectionLabel(Die, dwarf::DW_AT_GNU_ranges_base, DwarfDebugRangeSectionSym);
|
||||
} else {
|
||||
NewCU->addSectionOffset(Die, dwarf::DW_AT_GNU_addr_base, 0);
|
||||
NewCU->addSectionOffset(Die, dwarf::DW_AT_GNU_ranges_base, 0);
|
||||
}
|
||||
|
||||
return NewCU;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,6 @@
|
|||
; CHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
|
||||
; CHECK-NEXT: DW_AT_GNU_dwo_name [DW_FORM_strp] ( .debug_str[0x00000000] = "baz.dwo")
|
||||
; CHECK-NEXT: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000008] = "/usr/local/google/home/echristo/tmp")
|
||||
; CHECK-NEXT: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000000)
|
||||
; CHECK-NEXT: DW_AT_GNU_ranges_base [DW_FORM_sec_offset] (0x00000000)
|
||||
; CHECK-NEXT: DW_AT_GNU_dwo_id [DW_FORM_data8] (0x1f1f859683d49324)
|
||||
|
||||
; Check that the rest of the compile units have information.
|
||||
|
@ -108,7 +106,6 @@
|
|||
; OBJ-NEXT: R_X86_64_32 .debug_str
|
||||
; OBJ-NEXT: R_X86_64_32 .debug_str
|
||||
; OBJ-NEXT: R_X86_64_32 .debug_addr
|
||||
; OBJ-NEXT: R_X86_64_32 .debug_ranges
|
||||
; OBJ-NEXT: }
|
||||
|
||||
; HDR-NOT: .debug_aranges
|
||||
|
|
|
@ -2,6 +2,15 @@
|
|||
; RUN: llvm-dwarfdump %t | FileCheck %s
|
||||
; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s
|
||||
|
||||
; CHECK: .debug_info contents:
|
||||
; CHECK: DW_TAG_compile_unit
|
||||
; CHECK-NEXT: DW_AT_stmt_list
|
||||
; CHECK-NEXT: DW_AT_GNU_dwo_name
|
||||
; CHECK-NEXT: DW_AT_comp_dir
|
||||
; CHECK-NEXT: DW_AT_GNU_dwo_id
|
||||
; CHECK-NEXT: DW_AT_GNU_addr_base [DW_FORM_sec_offset] (0x00000000)
|
||||
|
||||
|
||||
; CHECK: .debug_info.dwo contents:
|
||||
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[A:0x[0-9a-z]*]])
|
||||
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[E:0x[0-9a-z]*]])
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
; REQUIRES: object-emission
|
||||
|
||||
; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s
|
||||
; RUN: %llc_dwarf -split-dwarf=Enable < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s
|
||||
|
||||
; darwin has a workaround for a linker bug so it always emits one line table entry
|
||||
; XFAIL: darwin
|
||||
|
@ -17,6 +18,9 @@
|
|||
; CHECK: .debug_pubtypes contents:
|
||||
; CHECK-NOT: Offset
|
||||
|
||||
; Don't emit DW_AT_addr_base when there are no addresses.
|
||||
; FISSION-NOT: DW_AT_GNU_addr_base [DW_FORM_sec_offset]
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!5}
|
||||
|
||||
|
|
Loading…
Reference in New Issue