1// REQUIRES: x86 2// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 3// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/gnu-ifunc-canon-ro-pcrel.s -o %t-ro-pcrel.o 4// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/gnu-ifunc-canon-ro-abs.s -o %t-ro-abs.o 5// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/gnu-ifunc-canon-rw-addend.s -o %t-rw-addend.o 6// RUN: ld.lld %t.o -o %t1 7// RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=IREL1 %s 8// RUN: ld.lld %t.o %t-ro-pcrel.o -o %t2 9// RUN: llvm-readobj -r %t2 | FileCheck --check-prefix=IREL1 %s 10// RUN: ld.lld %t.o %t-ro-abs.o -o %t3 11// RUN: llvm-readobj -r %t3 | FileCheck --check-prefix=IREL1 %s 12// RUN: ld.lld %t.o %t-rw-addend.o -o %t4 13// RUN: llvm-readobj -r %t4 | FileCheck --check-prefix=IREL1 %s 14// RUN: llvm-objdump -s %t4 | FileCheck --check-prefix=DUMP %s 15// RUN: ld.lld %t.o %t-rw-addend.o -o %t4a -z retpolineplt 16// RUN: llvm-readobj -r %t4a | FileCheck --check-prefix=IREL1 %s 17// RUN: llvm-objdump -s %t4a | FileCheck --check-prefix=DUMP2 %s 18// RUN: ld.lld %t-ro-pcrel.o %t.o -o %t5 19// RUN: llvm-readobj -r %t5 | FileCheck --check-prefix=IREL1 %s 20// RUN: ld.lld %t-ro-abs.o %t.o -o %t6 21// RUN: llvm-readobj -r %t6 | FileCheck --check-prefix=IREL1 %s 22// RUN: ld.lld %t-rw-addend.o %t.o -o %t7 23// RUN: llvm-readobj -r %t7 | FileCheck --check-prefix=IREL1 %s 24// RUN: ld.lld %t.o -o %t8 -pie 25// RUN: llvm-readobj -r %t8 | FileCheck --check-prefix=IREL1-REL2 %s 26// RUN: ld.lld %t.o %t-ro-pcrel.o -o %t9 -pie 27// RUN: llvm-readobj -r %t9 | FileCheck --check-prefix=IREL1-REL2 %s 28// RUN: ld.lld %t.o %t-rw-addend.o -o %t10 -pie 29// RUN: llvm-readobj -r %t10 | FileCheck --check-prefix=IREL1-REL3 %s 30// RUN: ld.lld %t-ro-pcrel.o %t.o -o %t11 -pie 31// RUN: llvm-readobj -r %t11 | FileCheck --check-prefix=IREL1-REL2 %s 32// RUN: ld.lld %t-rw-addend.o %t.o -o %t12 -pie 33// RUN: llvm-readobj -r %t12 | FileCheck --check-prefix=IREL1-REL3 %s 34 35// One reloc for the canonical PLT. 36// IREL1-NOT: R_X86_64_ 37// IREL1: .rela.dyn 38// IREL1-NEXT: R_X86_64_IRELATIVE 39// IREL1-NOT: R_X86_64_ 40 41// One reloc for the canonical PLT and two RELATIVE relocations pointing to it, 42// one in the GOT and one in .data. 43// IREL1-REL2-NOT: R_X86_64_ 44// IREL1-REL2: .rela.dyn 45// IREL1-REL2-NEXT: R_X86_64_RELATIVE 46// IREL1-REL2-NEXT: R_X86_64_RELATIVE 47// IREL1-REL2-NEXT: R_X86_64_IRELATIVE 48// IREL1-REL2-NOT: R_X86_64_ 49 50// One reloc for the canonical PLT and three RELATIVE relocations pointing to it, 51// one in the GOT and two in .data. 52// IREL1-REL3-NOT: R_X86_64_ 53// IREL1-REL3: .rela.dyn 54// IREL1-REL3-NEXT: R_X86_64_RELATIVE 55// IREL1-REL3-NEXT: R_X86_64_RELATIVE 56// IREL1-REL3-NEXT: R_X86_64_RELATIVE 57// IREL1-REL3-NEXT: R_X86_64_IRELATIVE 58// IREL1-REL3-NOT: R_X86_64_ 59 60// Make sure the static relocations look right, both with and without headers. 61// DUMP: Contents of section .iplt: 62// DUMP-NEXT: 2011f0 63// DUMP: Contents of section .got: 64// DUMP-NEXT: 202200 f0112000 00000000 65// DUMP: Contents of section .data: 66// DUMP-NEXT: 203208 f0112000 00000000 f1112000 00000000 67 68// DUMP2: Contents of section .plt: 69// DUMP2-NEXT: 2011f0 70// DUMP2: Contents of section .got: 71// DUMP2-NEXT: 202240 20122000 00000000 72// DUMP2: Contents of section .data: 73// DUMP2-NEXT: 203248 20122000 00000000 21122000 00000000 74 75lea ifunc@gotpcrel(%rip), %rbx 76 77.type ifunc STT_GNU_IFUNC 78.globl ifunc 79ifunc: 80ret 81 82.data 83.8byte ifunc 84