Revert "Add terminator to .eh_frame sections"

This reverts commit r296378.

I am pretty sure this is incorrect. In particular, for just

        .cfi_startproc
        nop
        .cfi_endproc

We now add an extra 4 zeros that neither bfd nor gold add.

llvm-svn: 296503
This commit is contained in:
Rafael Espindola 2017-02-28 18:55:08 +00:00
parent ea61ea9f19
commit b691ccf0a5
9 changed files with 10 additions and 19 deletions

View File

@ -537,14 +537,7 @@ template <class ELFT> void EhFrameSection<ELFT>::finalizeContents() {
Off += alignTo(Fde->size(), sizeof(uintX_t));
}
}
// Add a CIE record of length 0 as a terminator. While the relevant
// standards don't explicitly require such a terminator, ld.bfd and
// ld.gold always seem to add one and some unwiders rely on its
// presence. It also prevents us from generating a .eh_frame section
// with zero Call Frame Information records, which isn't allowed by
// the LSB standard.
this->Size = Off + 4;
this->Size = Off;
}
template <class ELFT> static uint64_t readFdeAddr(uint8_t *Buf, int Size) {

View File

@ -84,7 +84,7 @@ _start:
// HDR-NEXT: ]
// HDR-NEXT: Address: 0x200180
// HDR-NEXT: Offset: 0x180
// HDR-NEXT: Size: 100
// HDR-NEXT: Size: 96
// HDR-NEXT: Link: 0
// HDR-NEXT: Info: 0
// HDR-NEXT: AddressAlignment: 8
@ -96,7 +96,6 @@ _start:
// HDR-NEXT: 0030: 14000000 34000000 490E0000 01000000
// HDR-NEXT: 0040: 00000000 00000000 14000000 4C000000
// HDR-NEXT: 0050: 320E0000 01000000 00000000 00000000
// HDR-NEXT: 0060: 00000000
// HDR-NEXT: )
// CIE: 14000000 00000000 017A5200 01781001 1B0C0708 90010000
// FDE(1): 14000000 1C000000 600E0000 01000000 00000000 00000000

View File

@ -27,7 +27,7 @@
// CHECK-NEXT: ]
// CHECK-NEXT: Address:
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 100
// CHECK-NEXT: Size: 96
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 8
@ -39,7 +39,6 @@
// CHECK-NEXT: 0030: 14000000 34000000 D20D0000 02000000 |
// CHECK-NEXT: 0040: 00000000 00000000 14000000 4C000000 |
// CHECK-NEXT: 0050: B90D0000 01000000 00000000 00000000 |
// CHECK-NEXT: 0060: 00000000 |
// CHECK-NEXT: )
// CHECK: Name: foo

View File

@ -12,7 +12,7 @@
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x200120
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: 52
// CHECK-NEXT: Size: 48
// CHECK-NOT: .eh_frame
// 0x200120 = 2097440

View File

@ -33,4 +33,4 @@
.long 0x0
.long 0x0
// CHECK: 1 .eh_frame 0000001c
// CHECK: 1 .eh_frame 00000018

View File

@ -7,7 +7,7 @@
# RUN: ld.lld -o %t1 --eh-frame-hdr --script %t.script %t
# RUN: llvm-objdump -s -section=".eh_frame_hdr" %t1 | FileCheck %s
# CHECK: 011b033b 14000000 01000000 4d000000
# CHECK: 011b033b 14000000 01000000 49000000
# CHECK-NEXT: 30000000
.global _start

View File

@ -60,7 +60,7 @@
# SIMPLE: 0000000000000128 .foo 00000000 .hidden _end_sec
# SIMPLE-NEXT: 0000000000000120 .foo 00000000 _begin_sec
# SIMPLE-NEXT: 0000000000000128 *ABS* 00000000 _end_sec_abs
# SIMPLE-NEXT: 000000000000104c .text 00000000 _start
# SIMPLE-NEXT: 0000000000001048 .text 00000000 _start
# SIMPLE-NEXT: 0000000000000120 .foo 00000000 begin_foo
# SIMPLE-NEXT: 0000000000000128 .foo 00000000 end_foo
# SIMPLE-NEXT: 0000000000000008 *ABS* 00000000 size_foo_1

View File

@ -27,8 +27,8 @@ local:
.comm common,4,16
// CHECK: Address Size Align Out In File Symbol
// CHECK-NEXT: 0000000000200158 0000000000000034 8 .eh_frame
// CHECK-NEXT: 0000000000200158 0000000000000034 8 .eh_frame
// CHECK-NEXT: 0000000000200158 0000000000000030 8 .eh_frame
// CHECK-NEXT: 0000000000200158 0000000000000030 8 .eh_frame
// CHECK-NEXT: 0000000000201000 0000000000000015 4 .text
// CHECK-NEXT: 0000000000201000 000000000000000e 4 .text
// CHECK-NEXT: 0000000000201000 000000000000000e 4 {{.*}}{{/|\\}}map-file.s.tmp1.o

View File

@ -5,7 +5,7 @@
# RUN: ld.lld %t -o %t.so -shared
# RUN: llvm-objdump -h %t.so | FileCheck --check-prefix=DSO %s
# DSO: .eh_frame 00000034
# DSO: .eh_frame 00000030
# CHECK: Relocations [
# CHECK-NEXT: Section ({{.*}}) .rela.eh_frame {