Skip to content

Commit

Permalink
[DebugInfo] Fix dumping CIE ID in .eh_frame sections.
Browse files Browse the repository at this point in the history
We do not keep the actual value of the CIE ID field, because it is
predefined, and use a constant when dumping a CIE record. The issue
was that the predefined value is different for .debug_frame and
.eh_frame sections, but we always printed the one which corresponds
to .debug_frame. The patch fixes that by choosing an appropriate
constant to print.

See the following for more information about .eh_frame sections:
https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html

Differential Revision: https://reviews.llvm.org/D73627
  • Loading branch information
igorkudrin committed Feb 13, 2020
1 parent 2e8c112 commit 2ba4df6
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lld/test/ELF/eh-frame-hdr-augmentation.s
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// CHECK: .eh_frame contents:

// CHECK: 00000000 0000001c ffffffff CIE
// CHECK: 00000000 0000001c 00000000 CIE
// CHECK-NEXT: Version: 1
// CHECK-NEXT: Augmentation: "zPLR"
// CHECK-NEXT: Code alignment factor: 1
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void CFIProgram::dump(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH,

void CIE::dump(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH) const {
OS << format("%08x %08x %08x CIE", (uint32_t)Offset, (uint32_t)Length,
DW_CIE_ID)
IsEH ? 0 : DW_CIE_ID)
<< "\n";
OS << format(" Version: %d\n", Version);
OS << " Augmentation: \"" << Augmentation << "\"\n";
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/DebugInfo/RISCV/eh-frame.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ func:
ret
.cfi_endproc

# CHECK: 00000000 00000010 ffffffff CIE
# CHECK: 00000000 00000010 00000000 CIE
# CHECK: Version: 1
# CHECK: Augmentation: "zR"
# CHECK: Code alignment factor: 1
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/MC/Mips/eh-frame.s
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func:
// PIC64-NEXT: R_MIPS_PC32/R_MIPS_NONE/R_MIPS_NONE
// RELOCS-NEXT: }

// DWARF32: 00000000 00000010 ffffffff CIE
// DWARF32: 00000000 00000010 00000000 CIE
// DWARF32-NEXT: Version: 1
// DWARF32-NEXT: Augmentation: "zR"
// DWARF32-NEXT: Code alignment factor: 1
Expand All @@ -73,7 +73,7 @@ func:
// DWARF32-NEXT: DW_CFA_nop:


// DWARF64: 00000000 00000010 ffffffff CIE
// DWARF64: 00000000 00000010 00000000 CIE
// DWARF64-NEXT: Version: 1
// DWARF64-NEXT: Augmentation: "zR"
// DWARF64-NEXT: Code alignment factor: 1
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/MC/X86/return-column.s
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ h:
// CHECK-ASM-ROUNDTRIP-NEXT: .cfi_return_column 0
// CHECK-ASM-ROUNDTRIP: .cfi_endproc

// CHECK-EH_FRAME: 00000000 00000014 ffffffff CIE
// CHECK-EH_FRAME: 00000000 00000014 00000000 CIE
// CHECK-EH_FRAME: Return address column: 0

// CHECK-EH_FRAME: 0000002c 00000014 ffffffff CIE
// CHECK-EH_FRAME: 0000002c 00000014 00000000 CIE
// CHECK-EH_FRAME: Return address column: 65

// CHECK-EH_FRAME-NOT: ........ 00000014 ffffffff CIE
// CHECK-EH_FRAME-NOT: ........ 00000014 00000000 CIE

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# checks that we are able to dump it correctly.

# CHECK: .eh_frame contents:
# CHECK: 00000000 00000010 ffffffff CIE
# CHECK: 00000000 00000010 00000000 CIE
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Augmentation: "zR"
# CHECK-NEXT: Code alignment factor: 1
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-objdump/eh_frame-arm64.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# CHECK: .eh_frame contents:

# CHECK: 00000000 00000010 ffffffff CIE
# CHECK: 00000000 00000010 00000000 CIE
# CHECK: Version: 1
# CHECK: Augmentation: "zR"
# CHECK: Code alignment factor: 1
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-objdump/eh_frame-coff.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# CHECK: .eh_frame contents:

# CHECK: 00000000 0000001c ffffffff CIE
# CHECK: 00000000 0000001c 00000000 CIE
# CHECK: Version: 1
# CHECK: Augmentation: "zPLR"
# CHECK: Code alignment factor: 1
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-objdump/eh_frame-mipsel.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# CHECK: .eh_frame contents:

# CHECK: 00000000 00000018 ffffffff CIE
# CHECK: 00000000 00000018 00000000 CIE
# CHECK: Version: 1
# CHECK: Augmentation: "zPLR"
# CHECK: Code alignment factor: 1
Expand All @@ -19,7 +19,7 @@
# CHECK: DW_CFA_offset: reg31 -4
# CHECK: DW_CFA_nop:

# CHECK: 00000038 00000000 ffffffff CIE
# CHECK: 00000038 00000000 00000000 CIE
# CHECK: Version: 0
# CHECK: Augmentation: ""
# CHECK: Code alignment factor: 0
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-objdump/eh_frame_zero_cie.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# CHECK: .eh_frame contents:

# CHECK: 00000000 00000000 ffffffff CIE
# CHECK: 00000000 00000000 00000000 CIE
# CHECK: Version: 0
# CHECK: Augmentation: ""
# CHECK: Code alignment factor: 0
Expand Down

0 comments on commit 2ba4df6

Please sign in to comment.