[lld] 5012ddd - [ELF][test] Add some additional .eh_frame/.eh_frame_hdr testing
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 07:52:28 PDT 2020
Author: James Henderson
Date: 2020-07-02T15:51:33+01:00
New Revision: 5012ddd5aff24e9963ed2073c7e3fc6991fd8b4c
URL: https://github.com/llvm/llvm-project/commit/5012ddd5aff24e9963ed2073c7e3fc6991fd8b4c
DIFF: https://github.com/llvm/llvm-project/commit/5012ddd5aff24e9963ed2073c7e3fc6991fd8b4c.diff
LOG: [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
Added:
lld/test/ELF/eh-frame-hdr-comdat.s
Modified:
lld/test/ELF/eh-frame-merge.s
lld/test/ELF/eh-frame-type.test
Removed:
################################################################################
diff --git a/lld/test/ELF/eh-frame-hdr-comdat.s b/lld/test/ELF/eh-frame-hdr-comdat.s
new file mode 100644
index 000000000000..e28d3c7dd229
--- /dev/null
+++ b/lld/test/ELF/eh-frame-hdr-comdat.s
@@ -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", at progbits,bar,comdat
+.global bar
+bar:
+.cfi_startproc
+ ret
+.cfi_endproc
diff --git a/lld/test/ELF/eh-frame-merge.s b/lld/test/ELF/eh-frame-merge.s
index ddfb8ec07260..b60a5816f20c 100644
--- a/lld/test/ELF/eh-frame-merge.s
+++ b/lld/test/ELF/eh-frame-merge.s
@@ -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", at progbits
.cfi_startproc
nop
diff --git a/lld/test/ELF/eh-frame-type.test b/lld/test/ELF/eh-frame-type.test
index 9649921787e3..22b802a9e528 100644
--- a/lld/test/ELF/eh-frame-type.test
+++ b/lld/test/ELF/eh-frame-type.test
@@ -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
diff erent 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 ]
More information about the llvm-commits
mailing list