Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / ppc64-plt-stub.s
blob6e0206fd014ff8a5396046a8ec8f25fc454ebf99
1 # REQUIRES: ppc
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
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
17 ## DT_PLTGOT points to .plt
18 # SEC: .plt NOBITS 0000000010030400 000400 000018
19 # SEC: 0x0000000000000003 (PLTGOT) 0x10030400
20 # SEC: 0x0000000070000000 (PPC64_GLINK) 0x100102e0
21 # SEC: 0x0000000070000003 (PPC64_OPT) 0x0
23 ## .plt[0] holds the address of _dl_runtime_resolve.
24 ## .plt[1] holds the link map.
25 ## The JMP_SLOT relocation is stored at .plt[2]
26 # RELOC: 0x10030010 R_PPC64_JMP_SLOT foo 0x0
28 # CHECK: <_start>:
29 # CHECK: 10010298: bl 0x100102b0
31 # CHECK-LABEL: 00000000100102b0 <__plt_foo>:
32 # CHECK-NEXT: std 2, 24(1)
33 # CHECK-NEXT: addis 12, 2, 1
34 # CHECK-NEXT: ld 12, -32744(12)
35 # CHECK-NEXT: mtctr 12
36 # CHECK-NEXT: bctr
38 # CHECK-LABEL: <.glink>:
39 # CHECK-NEXT: 100102c4: mflr 0
40 # CHECK-NEXT: bcl 20, 31, 0x100102cc <.glink+0x8>
41 # CHECK-NEXT: mflr 11
42 # CHECK-NEXT: mtlr 0
43 # CHECK-NEXT: sub 12, 12, 11
44 # CHECK-NEXT: addi 0, 12, -52
45 # CHECK-NEXT: rldicl 0, 0, 62, 2
46 # CHECK-NEXT: ld 12, 44(11)
47 # CHECK-NEXT: add 11, 12, 11
48 # CHECK-NEXT: ld 12, 0(11)
49 # CHECK-NEXT: ld 11, 8(11)
50 # CHECK-NEXT: mtctr 12
51 # CHECK-NEXT: bctr
52 # CHECK-NEXT: <unknown>
53 # CHECK-NEXT: <unknown>
54 ## DT_PPC64_GLINK+0x20 = 0x10010300
55 # CHECK-NEXT: 10010300: b 0x100102c4 <.glink>
56 # CHECK-NOT: {{.}}
58 .text
59 .abiversion 2
60 .globl _start
61 .p2align 4
62 .type _start,@function
63 _start:
64 .Lfunc_begin0:
65 .Lfunc_gep0:
66 addis 2, 12, .TOC.-.Lfunc_gep0@ha
67 addi 2, 2, .TOC.-.Lfunc_gep0@l
68 .Lfunc_lep0:
69 .localentry _start, .Lfunc_lep0-.Lfunc_gep0
70 bl foo
71 nop
72 li 0, 1
74 .size _start, .-.Lfunc_begin0