1# REQUIRES: ppc
2# RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
3# RUN: ld.lld %t.o -o %t
4# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
5# RUN: llvm-readelf -S -s %t | FileCheck --check-prefixes=SEC,SYM %s
6# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
7
8# RELOC:      .rela.dyn {
9# RELOC-NEXT:   0x10020118 R_PPC_IRELATIVE - 0x100100E0
10# RELOC-NEXT: }
11
12# SEC: .rela.dyn RELA 100000d4 0000d4 00000c
13# SYM: 100100e0 0 FUNC GLOBAL DEFAULT {{.*}} func
14
15# CHECK-LABEL: <func_resolver>:
16# CHECK-NEXT:    100100e0:
17# CHECK-LABEL: <_start>:
18# CHECK-NEXT:    bl 0x100100f8
19## .rela.plt = 0x100000d4 = 65536*4096+212
20## end(.rela.plt) = 0x100000d4+0xc = 65536*4096+224
21# CHECK-NEXT:    lis 9, 4096
22# CHECK-NEXT:    lis 8, 4096
23# CHECK-NEXT:    addi 9, 9, 212
24# CHECK-NEXT:    addi 8, 8, 224
25
26.globl func
27.type func, @gnu_indirect_function
28func:
29.globl func_resolver
30.type func_resolver, @function
31func_resolver:
32  blr
33
34.globl _start
35_start:
36  bl func
37
38  lis 9, __rela_iplt_start@ha
39  lis 8, __rela_iplt_end@ha
40  la 9, __rela_iplt_start@l(9)
41  la 8, __rela_iplt_end@l(8)
42