2 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3 # RUN: ld.lld %t.o -o %t
4 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t | FileCheck %s --check-prefix=DISASM
5 # RUN: llvm-readelf -r -s %t | FileCheck %s
7 # RUN: ld.lld --export-dynamic %t.o -o %t
8 # RUN: llvm-readelf -r -s %t | FileCheck %s
10 # CHECK: Relocation section '.rela.dyn' at offset {{.*}} contains 2 entries:
12 # CHECK-NEXT: R_X86_64_IRELATIVE
13 # CHECK-NEXT: R_X86_64_IRELATIVE
15 # CHECK: 0 NOTYPE LOCAL HIDDEN [[#]] __rela_iplt_start
16 # CHECK-NEXT: 0 NOTYPE LOCAL HIDDEN [[#]] __rela_iplt_end
18 # RUN: ld.lld -pie %t.o -o %t1
19 # RUN: llvm-readelf -s %t1 | FileCheck %s --check-prefix=PIC
20 # RUN: ld.lld -shared %t.o -o %t2
21 # RUN: llvm-readelf -s %t2 | FileCheck %s --check-prefix=PIC
23 # PIC: 0 NOTYPE WEAK DEFAULT UND __rela_iplt_start
24 # PIC-NEXT: 0 NOTYPE WEAK DEFAULT UND __rela_iplt_end
26 # DISASM: Disassembly of section .text:
32 # DISASM-NEXT: callq 0x[[#%x,foo:]]
33 # DISASM-NEXT: callq 0x[[#%x,bar:]]
35 # DISASM-NEXT: Disassembly of section .iplt:
37 # DISASM-NEXT: <.iplt>:
38 # DISASM-NEXT: [[#foo]]: jmpq *{{.*}}(%rip)
39 # DISASM-NEXT: pushq $0
40 # DISASM-NEXT: jmp 0x0
41 # DISASM-NEXT: [[#bar]]: jmpq *{{.*}}(%rip)
42 # DISASM-NEXT: pushq $1
43 # DISASM-NEXT: jmp 0x0
46 .type foo STT_GNU_IFUNC
51 .type bar STT_GNU_IFUNC
56 .type unused, @gnu_indirect_function
61 .weak __rela_iplt_start
70 .quad __rela_iplt_start