1# REQUIRES: ppc
2
3# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
4# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
5# RUN: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
6# RUN: ld.lld %t.o %t2.so -o %t
7# RUN: llvm-readelf -S -d %t | FileCheck --check-prefix=SEC %s
8# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
9
10# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
11# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
12# RUN: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
13# RUN: ld.lld %t.o %t2.so -o %t
14# RUN: llvm-readelf -S -d %t | FileCheck --check-prefix=SEC %s
15# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
16
17## DT_PLTGOT points to .plt
18# SEC: .plt NOBITS 00000000100303f0 0003f0 000018
19# SEC: 0x0000000000000003 (PLTGOT) 0x100303f0
20
21## .plt[0] holds the address of _dl_runtime_resolve.
22## .plt[1] holds the link map.
23## The JMP_SLOT relocation is stored at .plt[2]
24# RELOC: 0x10030010 R_PPC64_JMP_SLOT foo 0x0
25
26# CHECK:      <_start>:
27# CHECK:      10010298: bl 0x100102b0
28
29# CHECK-LABEL: 00000000100102b0 <__plt_foo>:
30# CHECK-NEXT:      std 2, 24(1)
31# CHECK-NEXT:      addis 12, 2, 1
32# CHECK-NEXT:      ld 12, -32744(12)
33# CHECK-NEXT:      mtctr 12
34# CHECK-NEXT:      bctr
35
36
37        .text
38        .abiversion 2
39        .globl  _start
40        .p2align        4
41        .type   _start,@function
42_start:
43.Lfunc_begin0:
44.Lfunc_gep0:
45  addis 2, 12, .TOC.-.Lfunc_gep0@ha
46  addi 2, 2, .TOC.-.Lfunc_gep0@l
47.Lfunc_lep0:
48  .localentry     _start, .Lfunc_lep0-.Lfunc_gep0
49  bl foo
50  nop
51  li 0, 1
52  sc
53  .size _start, .-.Lfunc_begin0
54