Files
llvm/lld/test/ELF/eh-frame-begin-end.s
Rafael Espindola a8a1a4fc30 Avoid empty .eh_frame sections.
Strip on OpenBSD does not correctly handle an empty .eh_frame section
and produces broken binaries in that case. Currently lld creates such
an empty .eh_frame section, despite the fact that the OpenBSD crtend.o
explicitly inserts a terminator. The Linux LSB "standard":

https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html#EHFRAME

explicitly says that

    The .eh_frame section shall contain 1 or more Call Frame Information (CFI) records.

This diff includes a test that specifically tests the issue I'm seeing
on OpenBSD.

Patch by Mark Kettenis!

llvm-svn: 301931
2017-05-02 15:45:31 +00:00

18 lines
540 B
ArmAsm

// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=amd64-unknown-openbsd %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=amd64-unknown-openbsd %p/Inputs/eh-frame-end.s -o %t2.o
// RUN: ld.lld %t.o %t2.o -o %t
// RUN: llvm-readobj -sections %t | FileCheck %s
// CHECK: Name: .eh_frame
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x200120
// CHECK-NEXT: Offset: 0x120
// CHECK-NEXT: Size: 4
.section ".eh_frame", "a", @progbits
__EH_FRAME_BEGIN__: