[ELF][test] Add some additional .eh_frame/.eh_frame_hdr testing

This patch adds a few extra cases to the existing testing for eh_frame
and eh_frame_hdr behaviour in LLD. They all come from a private
testsuite we are trying to migrate to lit.

Reviewed by: grimar, MaskRay

Differential Revision: https://reviews.llvm.org/D82852
This commit is contained in:
James Henderson 2020-06-30 11:17:53 +01:00
parent e6cf796bab
commit 5012ddd5af
3 changed files with 62 additions and 11 deletions

View File

@ -0,0 +1,37 @@
# 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

View File

@ -3,6 +3,11 @@
// 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

View File

@ -1,17 +1,26 @@
# 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 ]