[PATCH] D58761: llvm-readobj: Try the DWARF CFI dumper on all machines.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 27 21:11:42 PST 2019
pcc created this revision.
pcc added a reviewer: peter.smith.
Herald added subscribers: rupprecht, kristof.beyls, krytarowski, javed.absar, aprantl.
Herald added a project: LLVM.
There's no reason to limit the DWARF CFI dumper to EM_386 and EM_X86_64;
ELF files could contain DWARF CFI on almost any platform (even 32-bit ARM;
NetBSD uses DWARF CFI on that platform). So start using the DWARF CFI dumper
unconditionally so that we can dump .eh_frame sections on the remaining ELF
platforms as well as in NetBSD binaries.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D58761
Files:
llvm/test/tools/llvm-readobj/arm-dwarf-cfi.s
llvm/test/tools/llvm-readobj/arm64-dwarf-cfi.s
llvm/tools/llvm-readobj/ELFDumper.cpp
Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -1890,12 +1890,8 @@
template<class ELFT>
void ELFDumper<ELFT>::printUnwindInfo() {
- const unsigned Machine = ObjF->getELFFile()->getHeader()->e_machine;
- if (Machine == EM_386 || Machine == EM_X86_64) {
- DwarfCFIEH::PrinterContext<ELFT> Ctx(W, ObjF);
- return Ctx.printUnwindInformation();
- }
- W.startLine() << "UnwindInfo not implemented.\n";
+ DwarfCFIEH::PrinterContext<ELFT> Ctx(W, ObjF);
+ Ctx.printUnwindInformation();
}
namespace {
@@ -1905,9 +1901,10 @@
const unsigned Machine = Obj->getHeader()->e_machine;
if (Machine == EM_ARM) {
ARM::EHABI::PrinterContext<ELF32LE> Ctx(W, Obj, DotSymtabSec);
- return Ctx.PrintUnwindInformation();
+ Ctx.PrintUnwindInformation();
}
- W.startLine() << "UnwindInfo not implemented.\n";
+ DwarfCFIEH::PrinterContext<ELF32LE> Ctx(W, ObjF);
+ Ctx.printUnwindInformation();
}
} // end anonymous namespace
Index: llvm/test/tools/llvm-readobj/arm64-dwarf-cfi.s
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-readobj/arm64-dwarf-cfi.s
@@ -0,0 +1,25 @@
+# RUN: llvm-mc -triple arm64-linux -filetype obj -o - %s | llvm-readobj -u | FileCheck %s
+
+# CHECK: [0x0] CIE length=16
+# CHECK-NEXT: version: 1
+# CHECK-NEXT: augmentation: zR
+# CHECK-NEXT: code_alignment_factor: 1
+# CHECK-NEXT: data_alignment_factor: -4
+# CHECK-NEXT: return_address_register: 30
+
+# CHECK: Program:
+# CHECK-NEXT: DW_CFA_def_cfa: reg31 +0
+
+# CHECK: [0x14] FDE length=16 cie=[0x0]
+# CHECK-NEXT: initial_location: 0x0
+# CHECK-NEXT: address_range: 0x4 (end : 0x4)
+
+# CHECK: Program:
+# CHECK-NEXT: DW_CFA_nop:
+# CHECK-NEXT: DW_CFA_nop:
+# CHECK-NEXT: DW_CFA_nop:
+
+foo:
+.cfi_startproc
+ret
+.cfi_endproc
Index: llvm/test/tools/llvm-readobj/arm-dwarf-cfi.s
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-readobj/arm-dwarf-cfi.s
@@ -0,0 +1,27 @@
+# RUN: llvm-mc -triple arm-linux -filetype obj -o - %s | llvm-readobj -u | FileCheck %s
+
+# CHECK: [0x0] CIE length=16
+# CHECK-NEXT: version: 1
+# CHECK-NEXT: augmentation: zR
+# CHECK-NEXT: code_alignment_factor: 1
+# CHECK-NEXT: data_alignment_factor: -4
+# CHECK-NEXT: return_address_register: 14
+
+# CHECK: Program:
+# CHECK-NEXT: DW_CFA_def_cfa: reg13 +0
+
+# CHECK: [0x14] FDE length=16 cie=[0x0]
+# CHECK-NEXT: initial_location: 0x0
+# CHECK-NEXT: address_range: 0x4 (end : 0x4)
+
+# CHECK: Program:
+# CHECK-NEXT: DW_CFA_nop:
+# CHECK-NEXT: DW_CFA_nop:
+# CHECK-NEXT: DW_CFA_nop:
+
+.cpu cortex-a8
+
+foo:
+.cfi_startproc
+bx lr
+.cfi_endproc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58761.188671.patch
Type: text/x-patch
Size: 2868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190228/f34e505e/attachment.bin>
More information about the llvm-commits
mailing list