--- /dev/null
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t
+# RUN: ld.lld %t %t -o %t2 --eh-frame-hdr
+# RUN: llvm-readelf -u --symbols %t2 | FileCheck %s
+
+# CHECK: EHFrameHeader {
+# CHECK-NEXT: Address:
+# CHECK-NEXT: Offset:
+# CHECK-NEXT: Size: 0x14
+# CHECK-NEXT: Corresponding Section: .eh_frame_hdr
+# CHECK-NEXT: Header {
+# CHECK-NEXT: version: 1
+# CHECK-NEXT: eh_frame_ptr_enc:
+# CHECK-NEXT: fde_count_enc:
+# CHECK-NEXT: table_enc:
+# CHECK-NEXT: eh_frame_ptr:
+# CHECK-NEXT: fde_count: 1
+# CHECK-NEXT: entry 0 {
+# CHECK-NEXT: initial_location: 0x[[# %x, SYM:]]
+# CHECK-NEXT: address: 0x[[# %x, FDE:]]
+# CHECK-NEXT: }
+# CHECK-NEXT: }
+# CHECK-NEXT: }
+
+# CHECK: [0x[[# FDE]]] FDE
+
+# CHECK: Symbol table
+# CHECK-NEXT: Num: Value {{.*}} Name
+# CHECK: {{0+}}[[# SYM]] {{.*}} bar
+
+.section .text.bar,"axG",@progbits,bar,comdat
+.global bar
+bar:
+.cfi_startproc
+ ret
+.cfi_endproc
// RUN: ld.lld --hash-style=sysv %t.o %t.o -o %t -shared
// RUN: llvm-readobj -S --section-data %t | FileCheck %s
+/// Also show that the merging happens when going via a -r link.
+// RUN: ld.lld -r %t.o %t.o -o %t.r.o
+// RUN: ld.lld --hash-style=sysv %t.r.o -o %t2 -shared
+// RUN: llvm-readobj -S --section-data %t2 | FileCheck %s
+
.section foo,"ax",@progbits
.cfi_startproc
nop
-# RUN: yaml2obj %s -o %t.o
-# RUN: ld.lld %t.o -o %t -shared
-# RUN: llvm-readobj -S %t | FileCheck %s
+## Show that LLD can handle .eh_frame sections of different types.
+
+# RUN: yaml2obj %s -o %t1.o -D TYPE=SHT_PROGBITS
+# RUN: ld.lld %t1.o -o %t1
+# RUN: llvm-readobj -S %t1 | FileCheck %s
+
+# RUN: yaml2obj %s -o %t2.o -D TYPE=SHT_X86_64_UNWIND
+# RUN: ld.lld %t2.o -o %t2
+# RUN: llvm-readobj -S %t2 | FileCheck %s
+
+# RUN: ld.lld %t1.o %t2.o -o %tboth
+# RUN: llvm-readobj -S %tboth | FileCheck %s
# CHECK: Name: .eh_frame
# CHECK-NEXT: Type: SHT_PROGBITS
-!ELF
+--- !ELF
FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
Sections:
- - Name: .eh_frame
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC ]
+ - Name: .eh_frame
+ Type: [[TYPE]]
+ Flags: [ SHF_ALLOC ]