From f7952d3a5f294b2c4a9e59e06edc927fddf37e78 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 7 Mar 2014 18:04:24 +0000 Subject: 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 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 2 +- test/DebugInfo/AArch64/dwarfdump.ll | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 84c486cf89..882720fcae 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -413,7 +413,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(DwarfCompileUnit *SPCU, } 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); else SPCU->addLabelDelta(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym, diff --git a/test/DebugInfo/AArch64/dwarfdump.ll b/test/DebugInfo/AArch64/dwarfdump.ll index b30bd33ea3..98e863dbb4 100644 --- a/test/DebugInfo/AArch64/dwarfdump.ll +++ b/test/DebugInfo/AArch64/dwarfdump.ll @@ -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 ; here. Currently R_AARCH64_ABS32 is used for references to debug data @@ -12,7 +15,8 @@ ; A couple of ABS64s similarly: ; 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 { ret i32 0, !dbg !8 -- cgit v1.2.3