1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o 3# RUN: ld.lld %t.o %t.o -shared --emit-relocs -o %t.so 4# RUN: llvm-readelf -S -r %t.so | FileCheck %s --check-prefixes=CHECK,RELOC 5# RUN: llvm-dwarfdump --eh-frame %t.so | FileCheck %s --check-prefix=EH 6 7## Also show that the merging happens when going via a -r link. 8# RUN: ld.lld -r %t.o %t.o -o %t.ro 9# RUN: ld.lld %t.ro -o %t2.so -shared 10# RUN: llvm-readelf -S -r %t2.so | FileCheck %s 11 12# CHECK: Name Type Address Off Size ES Flg Lk Inf Al 13# CHECK: .eh_frame PROGBITS [[#%x,]] [[#%x,]] 000058 00 A 0 0 8 14# CHECK: foo PROGBITS {{0*}}[[#%x,FOO:]] [[#%x,]] 000002 00 AX 0 0 1 15# CHECK-NEXT: bar PROGBITS {{0*}}[[#%x,FOO+2]] [[#%x,]] 000002 00 AX 0 0 1 16 17# RELOC: Offset Info Type Symbol's Value Symbol's Name + Addend 18# RELOC-NEXT: {{0*}}[[#%x,OFF:]] [[#%x,]] R_X86_64_PC32 [[#%x,]] foo + 0 19# RELOC-NEXT: {{0*}}[[#%x,OFF+20]] [[#%x,]] R_X86_64_PC32 [[#%x,]] bar + 0 20# RELOC-NEXT: {{0*}}[[#OFF+40]] [[#%x,]] R_X86_64_PC32 [[#%x,]] foo + 1 21# RELOC-NEXT: {{0*}}[[#%x,OFF-24]] [[#%x,]] R_X86_64_NONE 0{{$}} 22 23# EH: Format: DWARF32 24# EH: 00000018 00000010 0000001c FDE cie=00000000 pc={{0*}}[[#%x,FOO:]]... 25# EH-SAME: {{0*}}[[#%x,FOO+1]] 26# EH-COUNT-3: DW_CFA_nop: 27# EH-EMPTY: 28# EH: 0000002c 00000010 00000030 FDE cie=00000000 pc={{0*}}[[#%x,FOO+2]]...{{0*}}[[#%x,FOO+4]] 29# EH-COUNT-3: DW_CFA_nop: 30# EH-EMPTY: 31# EH: 00000040 00000010 00000044 FDE cie=00000000 pc={{0*}}[[#%x,FOO+1]]...{{0*}}[[#%x,FOO+2]] 32# EH-COUNT-3: DW_CFA_nop: 33# EH-EMPTY: 34# EH-NEXT: 0x[[#%x,]]: CFA=RSP+8: RIP=[CFA-8] 35# EH-EMPTY: 36# EH-NEXT: 00000054 ZERO terminator 37 38 .section foo,"ax",@progbits 39 .cfi_startproc 40 nop 41 .cfi_endproc 42 43 .section bar,"axG",@progbits,foo,comdat 44 .cfi_startproc 45 nop 46 nop 47 .cfi_endproc 48