[llvm] r355151 - llvm-readobj: Try the DWARF CFI dumper on all machines.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 28 14:42:55 PST 2019
Author: pcc
Date: Thu Feb 28 14:42:55 2019
New Revision: 355151
URL: http://llvm.org/viewvc/llvm-project?rev=355151&view=rev
Log:
llvm-readobj: Try the DWARF CFI dumper on all machines.
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.
Differential Revision: https://reviews.llvm.org/D58761
Added:
llvm/trunk/test/tools/llvm-readobj/AArch64/
llvm/trunk/test/tools/llvm-readobj/AArch64/dwarf-cfi.s
llvm/trunk/test/tools/llvm-readobj/AArch64/lit.local.cfg
llvm/trunk/test/tools/llvm-readobj/ARM/dwarf-cfi.s
Modified:
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Added: llvm/trunk/test/tools/llvm-readobj/AArch64/dwarf-cfi.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/AArch64/dwarf-cfi.s?rev=355151&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/AArch64/dwarf-cfi.s (added)
+++ llvm/trunk/test/tools/llvm-readobj/AArch64/dwarf-cfi.s Thu Feb 28 14:42:55 2019
@@ -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
Added: llvm/trunk/test/tools/llvm-readobj/AArch64/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/AArch64/lit.local.cfg?rev=355151&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/AArch64/lit.local.cfg (added)
+++ llvm/trunk/test/tools/llvm-readobj/AArch64/lit.local.cfg Thu Feb 28 14:42:55 2019
@@ -0,0 +1,3 @@
+if not 'AArch64' in config.root.targets:
+ config.unsupported = True
+
Added: llvm/trunk/test/tools/llvm-readobj/ARM/dwarf-cfi.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/ARM/dwarf-cfi.s?rev=355151&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/ARM/dwarf-cfi.s (added)
+++ llvm/trunk/test/tools/llvm-readobj/ARM/dwarf-cfi.s Thu Feb 28 14:42:55 2019
@@ -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
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=355151&r1=355150&r2=355151&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Thu Feb 28 14:42:55 2019
@@ -1890,12 +1890,8 @@ void ELFDumper<ELFT>::printValue(uint64_
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 @@ template <> void ELFDumper<ELF32LE>::pri
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
More information about the llvm-commits
mailing list