mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
DW_FORM_sec_offset should be a relocation on platforms that use
a relocation across sections. Do this for DW_AT_stmt list in the skeleton CU and check the relocations in the debug_info section. Add a FIXME for multiple CUs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178969 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
16f1969328
commit
9a9e73b47d
@ -170,6 +170,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
|
||||
DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
|
||||
DwarfStrSectionSym = TextSectionSym = 0;
|
||||
DwarfDebugRangeSectionSym = DwarfDebugLocSectionSym = DwarfLineSectionSym = 0;
|
||||
DwarfAddrSectionSym = 0;
|
||||
DwarfAbbrevDWOSectionSym = DwarfStrDWOSectionSym = 0;
|
||||
FunctionBeginSym = FunctionEndSym = 0;
|
||||
|
||||
@ -1740,9 +1741,12 @@ void DwarfDebug::emitSectionLabels() {
|
||||
emitSectionSym(Asm, TLOF.getDwarfPubTypesSection());
|
||||
DwarfStrSectionSym =
|
||||
emitSectionSym(Asm, TLOF.getDwarfStrSection(), "info_string");
|
||||
if (useSplitDwarf())
|
||||
if (useSplitDwarf()) {
|
||||
DwarfStrDWOSectionSym =
|
||||
emitSectionSym(Asm, TLOF.getDwarfStrDWOSection(), "skel_string");
|
||||
DwarfAddrSectionSym =
|
||||
emitSectionSym(Asm, TLOF.getDwarfAddrSection(), "addr_sec");
|
||||
}
|
||||
DwarfDebugRangeSectionSym = emitSectionSym(Asm, TLOF.getDwarfRangesSection(),
|
||||
"debug_range");
|
||||
|
||||
@ -2510,9 +2514,13 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const MDNode *N) {
|
||||
// This should be a unique identifier when we want to build .dwp files.
|
||||
NewCU->addUInt(Die, dwarf::DW_AT_GNU_dwo_id, dwarf::DW_FORM_data8, 0);
|
||||
|
||||
// FIXME: The addr base should be relative for each compile unit, however,
|
||||
// this one is going to be 0 anyhow.
|
||||
NewCU->addUInt(Die, dwarf::DW_AT_GNU_addr_base, dwarf::DW_FORM_sec_offset, 0);
|
||||
// Relocate to the beginning of the addr_base section, else 0 for the beginning
|
||||
// of the one for this compile unit.
|
||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
||||
NewCU->addLabel(Die, dwarf::DW_AT_GNU_addr_base, dwarf::DW_FORM_sec_offset,
|
||||
DwarfAddrSectionSym);
|
||||
else
|
||||
NewCU->addUInt(Die, dwarf::DW_AT_GNU_addr_base, dwarf::DW_FORM_sec_offset, 0);
|
||||
|
||||
// 2.17.1 requires that we use DW_AT_low_pc for a single entry point
|
||||
// into an entity. We're using 0, or a NULL label for this.
|
||||
@ -2520,6 +2528,7 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const MDNode *N) {
|
||||
|
||||
// DW_AT_stmt_list is a offset of line number information for this
|
||||
// compile unit in debug_line section.
|
||||
// FIXME: Should handle multiple compile units.
|
||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
||||
NewCU->addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_sec_offset,
|
||||
DwarfLineSectionSym);
|
||||
|
@ -392,7 +392,7 @@ class DwarfDebug {
|
||||
// section offsets and are created by EmitSectionLabels.
|
||||
MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
|
||||
MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
|
||||
MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym;
|
||||
MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym, *DwarfAddrSectionSym;
|
||||
MCSymbol *FunctionBeginSym, *FunctionEndSym;
|
||||
MCSymbol *DwarfAbbrevDWOSectionSym, *DwarfStrDWOSectionSym;
|
||||
|
||||
|
@ -172,10 +172,17 @@ DWARFFormValue::extractValue(DataExtractor data, uint32_t *offset_ptr,
|
||||
Form = data.getULEB128(offset_ptr);
|
||||
indirect = true;
|
||||
break;
|
||||
case DW_FORM_sec_offset:
|
||||
case DW_FORM_sec_offset: {
|
||||
// FIXME: This is 64-bit for DWARF64.
|
||||
Value.uval = data.getU32(offset_ptr);
|
||||
RelocAddrMap::const_iterator AI
|
||||
= cu->getRelocMap()->find(*offset_ptr);
|
||||
if (AI != cu->getRelocMap()->end()) {
|
||||
const std::pair<uint8_t, int64_t> &R = AI->second;
|
||||
Value.uval = data.getU32(offset_ptr) + R.second;
|
||||
} else
|
||||
Value.uval = data.getU32(offset_ptr);
|
||||
break;
|
||||
}
|
||||
case DW_FORM_flag_present:
|
||||
Value.uval = 1;
|
||||
break;
|
||||
|
@ -1,5 +1,6 @@
|
||||
; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
|
||||
; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=OBJ %s
|
||||
|
||||
@a = common global i32 0, align 4
|
||||
|
||||
@ -98,3 +99,14 @@
|
||||
; CHECK: 0x00000008: 0000003b
|
||||
; CHECK: 0x0000000c: 0000005f
|
||||
; CHECK: 0x00000010: 00000061
|
||||
|
||||
; Object file checks
|
||||
; For x86-64-linux we should have this set of relocations for the debug info section
|
||||
;
|
||||
; OBJ: .debug_info
|
||||
; OBJ-NEXT: R_X86_64_32 .debug_abbrev
|
||||
; OBJ-NEXT: R_X86_64_32 .debug_str
|
||||
; OBJ-NEXT: R_X86_64_32 .debug_addr
|
||||
; OBJ-NEXT: R_X86_64_32 .debug_line
|
||||
; OBJ-NEXT: R_X86_64_32 .debug_str
|
||||
; OBJ-NEXT: }
|
||||
|
Loading…
Reference in New Issue
Block a user