32 lines · plain
1# REQUIRES: ppc2 3# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o4# RUN: echo '.globl ifunc; .type ifunc, %gnu_indirect_function; ifunc:' | \5# RUN: llvm-mc -filetype=obj -triple=powerpc64le - -o %t1.o6# RUN: ld.lld %t.o %t1.o -o %t7# RUN: llvm-readelf -Ssr %t | FileCheck --check-prefix=SEC %s8# RUN: llvm-readelf -x .toc %t | FileCheck --check-prefix=HEX %s9# RUN: llvm-objdump -d %t | FileCheck --check-prefix=DIS %s10 11## ifunc is a non-preemptable STT_GNU_IFUNC. The R_PPC64_ADDR64 in .toc12## creates a canonical PLT for it and changes its type to STT_FUNC. We can thus13## still perform toc-indirect to toc-relative relaxation because the distance14## to the address of the canonical PLT is fixed.15 16# SEC: .text PROGBITS [[#%x,TEXT:]]17# SEC: .plt NOBITS [[#%x,PLT:]]18# SEC: {{0*}}[[#PLT]] {{.+}} R_PPC64_IRELATIVE [[#TEXT+8]]19# SEC: {{0*}}[[#TEXT+8]] 0 FUNC GLOBAL DEFAULT 3 ifunc20 21## .toc[0] stores the address of the canonical PLT.22# HEX: section '.toc':23# HEX-NEXT: 0x100201f8 e8010110 0000000024 25# DIS: addi 3, 3,26 27addis 3, 2, .toc@toc@ha28ld 3, .toc@toc@l(3)29 30.section .toc,"aw",@progbits31 .quad ifunc32