diff --git a/lld/test/ELF/eh-frame-hdr-comdat.s b/lld/test/ELF/eh-frame-hdr-comdat.s new file mode 100644 --- /dev/null +++ b/lld/test/ELF/eh-frame-hdr-comdat.s @@ -0,0 +1,21 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t %t -o %t2 --eh-frame-hdr +# RUN: llvm-objdump -s --section-headers %t2 | FileCheck %s + +## Check .eh_frame_hdr contains single FDE and no garbage data at tail. +# CHECK: Sections: +# CHECK: Idx Name Size +# CHECK: .eh_frame_hdr 00000014 + +# CHECK: Contents of section .eh_frame_hdr: +# CHECK-NEXT: 200158 011b033b 14000000 01000000 +## ^ FDE count + +.section .text.bar,"axG",@progbits,bar,comdat,unique,0 +.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 --- 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",@progbits .cfi_startproc nop diff --git a/lld/test/ELF/eh-frame-type.test b/lld/test/ELF/eh-frame-type.test --- a/lld/test/ELF/eh-frame-type.test +++ b/lld/test/ELF/eh-frame-type.test @@ -1,11 +1,15 @@ -# RUN: yaml2obj %s -o %t.o -# RUN: ld.lld %t.o -o %t -shared -# RUN: llvm-readobj -S %t | FileCheck %s +# RUN: yaml2obj %s -o %t1.o --docnum=1 +# RUN: ld.lld %t1.o -o %t1 -shared +# RUN: llvm-readobj -S %t1 | FileCheck %s + +# RUN: yaml2obj %s -o %t2.o --docnum=2 +# RUN: ld.lld %t2.o -o %t2 -shared +# RUN: llvm-readobj -S %t2 | FileCheck %s # CHECK: Name: .eh_frame # CHECK-NEXT: Type: SHT_PROGBITS -!ELF +--- !ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB @@ -15,3 +19,14 @@ - Name: .eh_frame Type: SHT_PROGBITS Flags: [ SHF_ALLOC ] + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .eh_frame + Type: SHT_X86_64_UNWIND + Flags: [ SHF_ALLOC ]