DebugInfo: Restrict DW_AT_high_pc encoding as data4 offset to DWARF 4 as per spec

Code review feedback to r203187 from Oliver Stannard. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203256 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2014-03-07 18:04:24 +00:00
parent fc9031cdff
commit f7952d3a5f
2 changed files with 7 additions and 3 deletions

View File

@ -413,7 +413,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit *SPCU,
} }
SPCU->addLabelAddress(SPDie, dwarf::DW_AT_low_pc, FunctionBeginSym); SPCU->addLabelAddress(SPDie, dwarf::DW_AT_low_pc, FunctionBeginSym);
if (Triple(Asm->getTargetTriple()).isOSDarwin()) if (DwarfVersion < 4 || Triple(Asm->getTargetTriple()).isOSDarwin())
SPCU->addLabelAddress(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym); SPCU->addLabelAddress(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym);
else else
SPCU->addLabelDelta(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym, SPCU->addLabelDelta(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym,

View File

@ -1,4 +1,7 @@
; RUN: llc -mtriple=aarch64-non-linux-gnu < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s ; RUN: llc -mtriple=aarch64-non-linux-gnu -dwarf-version=4 < %s -filetype=obj \
; RUN: | llvm-dwarfdump - | FileCheck -check-prefix=CHECK -check-prefix=CHECK-4 %s
; RUN: llc -mtriple=aarch64-non-linux-gnu -dwarf-version=3 < %s -filetype=obj \
; RUN: | llvm-dwarfdump - | FileCheck -check-prefix=CHECK -check-prefix=CHECK-3 %s
; We're mostly checking that relocations are applied correctly ; We're mostly checking that relocations are applied correctly
; here. Currently R_AARCH64_ABS32 is used for references to debug data ; here. Currently R_AARCH64_ABS32 is used for references to debug data
@ -12,7 +15,8 @@
; A couple of ABS64s similarly: ; A couple of ABS64s similarly:
; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000) ; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
; CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000008) ; CHECK-4: DW_AT_high_pc [DW_FORM_data4] (0x00000008)
; CHECK-3: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000008)
define i32 @main() nounwind { define i32 @main() nounwind {
ret i32 0, !dbg !8 ret i32 0, !dbg !8