diff --git a/llvm/test/tools/llvm-readobj/arm-dwarf-cfi.s b/llvm/test/tools/llvm-readobj/arm-dwarf-cfi.s new file mode 100644 --- /dev/null +++ b/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 diff --git a/llvm/test/tools/llvm-readobj/arm64-dwarf-cfi.s b/llvm/test/tools/llvm-readobj/arm64-dwarf-cfi.s new file mode 100644 --- /dev/null +++ b/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 diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -1890,12 +1890,8 @@ template void ELFDumper::printUnwindInfo() { - const unsigned Machine = ObjF->getELFFile()->getHeader()->e_machine; - if (Machine == EM_386 || Machine == EM_X86_64) { - DwarfCFIEH::PrinterContext Ctx(W, ObjF); - return Ctx.printUnwindInformation(); - } - W.startLine() << "UnwindInfo not implemented.\n"; + DwarfCFIEH::PrinterContext Ctx(W, ObjF); + Ctx.printUnwindInformation(); } namespace { @@ -1905,9 +1901,10 @@ const unsigned Machine = Obj->getHeader()->e_machine; if (Machine == EM_ARM) { ARM::EHABI::PrinterContext Ctx(W, Obj, DotSymtabSec); - return Ctx.PrintUnwindInformation(); + Ctx.PrintUnwindInformation(); } - W.startLine() << "UnwindInfo not implemented.\n"; + DwarfCFIEH::PrinterContext Ctx(W, ObjF); + Ctx.printUnwindInformation(); } } // end anonymous namespace