1# REQUIRES: ppc
2# RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
3# RUN: ld.lld -pie %t.o -o %t
4# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
5# RUN: llvm-readelf -s %t | FileCheck --check-prefix=SYM %s
6# RUN: llvm-readelf -x .got2 %t | FileCheck --check-prefix=HEX %s
7# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
8
9# RELOC:      .rela.dyn {
10# RELOC-NEXT:   0x30248 R_PPC_RELATIVE - 0x101A8
11# RELOC-NEXT:   0x3024C R_PPC_IRELATIVE - 0x10188
12# RELOC-NEXT: }
13
14# SYM: 000101a8 0 FUNC GLOBAL DEFAULT {{.*}} func
15# HEX: 0x00030248 00000000
16
17.section .got2,"aw"
18.long func
19
20# CHECK:      Disassembly of section .text:
21# CHECK:      <.text>:
22# CHECK-NEXT: 10188: blr
23# CHECK:      <_start>:
24# CHECK-NEXT:   bl 0x10198
25# CHECK-NEXT:   lis 9, 1
26# CHECK-NEXT:   addi 9, 9, 424
27# CHECK-EMPTY:
28# CHECK-NEXT: <00008000.got2.plt_pic32.func>:
29## 0x10020114 = 65536*4098+276
30# CHECK-NEXT:   lwz 11, -32764(30)
31# CHECK-NEXT:   mtctr 11
32# CHECK-NEXT:   bctr
33# CHECK-NEXT:   nop
34
35.text
36.globl func
37.type func, @gnu_indirect_function
38func:
39  blr
40
41.globl _start
42_start:
43  bl func+0x8000@plt
44
45  lis 9, func@ha
46  la 9, func@l(9)
47