3 # RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
4 # RUN: echo '.globl ifunc; .type ifunc, %gnu_indirect_function; ifunc:' | \
5 # RUN: llvm-mc -filetype=obj -triple=powerpc64le - -o %t1.o
6 # RUN: ld.lld %t.o %t1.o -o %t
7 # RUN: llvm-readelf -S -s %t | FileCheck --check-prefix=SEC %s
8 # RUN: llvm-readelf -x .toc %t | FileCheck --check-prefix=HEX %s
9 # RUN: llvm-objdump -d %t | FileCheck --check-prefix=DIS %s
11 ## ifunc is a non-preemptable STT_GNU_IFUNC. The R_PPC64_ADDR64 in .toc
12 ## creates a canonical PLT for it and changes its type to STT_FUNC. We can thus
13 ## still perform toc-indirect to toc-relative relaxation because the distance
14 ## to the address of the canonical PLT is fixed.
16 # SEC: .text PROGBITS 00000000100101e0
17 # SEC: .plt NOBITS 0000000010030200
18 # SEC: 00000000100101e8 0 FUNC GLOBAL DEFAULT 3 ifunc
20 ## .toc[0] stores the address of the canonical PLT.
21 # HEX: section '.toc':
22 # HEX-NEXT: 0x100201f8 e8010110 00000000
25 # REL-NEXT: 0x100301f8 R_PPC64_IRELATIVE - 0x100101e8
30 addis 3, 2, .toc@toc@ha
33 .section .toc,"aw",@progbits