annotate lld/test/ELF/ppc64-bsymbolic-toc-restore.s @ 192:d7606dcf6fce

Added tag llvm10 for changeset 0572611fdcc8
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 14 Dec 2020 18:01:34 +0900
parents 0572611fdcc8
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 # REQUIRES: ppc
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t1.o
anatofuz
parents:
diff changeset
4 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-bsymbolic-local-def.s -o %t2.o
anatofuz
parents:
diff changeset
5 # RUN: ld.lld -Bsymbolic -shared %t1.o %t2.o -o %t
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
6 # RUN: llvm-objdump -d -r --no-show-raw-insn %t | FileCheck %s
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
7 # RUN: not ld.lld -shared %t1.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=FAIL %s
150
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t1.o
anatofuz
parents:
diff changeset
10 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-bsymbolic-local-def.s -o %t2.o
anatofuz
parents:
diff changeset
11 # RUN: ld.lld -Bsymbolic -shared %t1.o %t2.o -o %t
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
12 # RUN: llvm-objdump -d -r --no-show-raw-insn %t | FileCheck %s
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
13 # RUN: not ld.lld -shared %t1.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=FAIL %s
150
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 # FAIL: call to def lacks nop, can't restore toc
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 # Test to document the toc-restore behavior with -Bsymbolic option. Since
anatofuz
parents:
diff changeset
18 # -Bsymbolic causes the call to bind to the internal definition we know the
anatofuz
parents:
diff changeset
19 # caller and callee share the same TOC base. This means branching to the
anatofuz
parents:
diff changeset
20 # local entry point of the callee, and no need for a nop to follow the call
anatofuz
parents:
diff changeset
21 # (since there is no need to restore the TOC-pointer after the call).
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 .abiversion 2
anatofuz
parents:
diff changeset
24 .section ".text"
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 .p2align 2
anatofuz
parents:
diff changeset
27 .global caller
anatofuz
parents:
diff changeset
28 .type caller, @function
anatofuz
parents:
diff changeset
29 caller:
anatofuz
parents:
diff changeset
30 .Lcaller_gep:
anatofuz
parents:
diff changeset
31 addis 2, 12, .TOC.-.Lcaller_gep@ha
anatofuz
parents:
diff changeset
32 addi 2, 2, .TOC.-.Lcaller_gep@l
anatofuz
parents:
diff changeset
33 .Lcaller_lep:
anatofuz
parents:
diff changeset
34 .localentry caller, .-caller
anatofuz
parents:
diff changeset
35 mflr 0
anatofuz
parents:
diff changeset
36 std 0, -16(1)
anatofuz
parents:
diff changeset
37 stdu 1, -32(1)
anatofuz
parents:
diff changeset
38 bl def
anatofuz
parents:
diff changeset
39 mr 31, 3
anatofuz
parents:
diff changeset
40 bl not_defined
anatofuz
parents:
diff changeset
41 nop
anatofuz
parents:
diff changeset
42 add 3, 3, 31
anatofuz
parents:
diff changeset
43 addi 1, 1, 32
anatofuz
parents:
diff changeset
44 ld 0, -16(1)
anatofuz
parents:
diff changeset
45 mtlr 0
anatofuz
parents:
diff changeset
46 blr
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 # Note that the bl .+44 is a call to def's local entry, jumping past the first 2
anatofuz
parents:
diff changeset
49 # instructions. Branching to the global entry would corrupt the TOC pointer
anatofuz
parents:
diff changeset
50 # since the global entry requires that %r12 hold the address of the function
anatofuz
parents:
diff changeset
51 # being called.
anatofuz
parents:
diff changeset
52
anatofuz
parents:
diff changeset
53 # CHECK-LABEL: caller
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
54 # CHECK: bl 0x[[DEF:[0-9a-f]+]]
150
anatofuz
parents:
diff changeset
55 # CHECK-NEXT: mr 31, 3
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
56 # CHECK-NEXT: bl 0x[[NOT_DEFINED:[0-9a-f]+]]
150
anatofuz
parents:
diff changeset
57 # CHECK-NEXT: ld 2, 24(1)
anatofuz
parents:
diff changeset
58 # CHECK-NEXT: add 3, 3, 31
anatofuz
parents:
diff changeset
59 # CHECK-NEXT: addi 1, 1, 32
anatofuz
parents:
diff changeset
60 # CHECK-NEXT: ld 0, -16(1)
anatofuz
parents:
diff changeset
61 # CHECK-NEXT: mtlr 0
anatofuz
parents:
diff changeset
62 # CHECK-NEXT: blr
anatofuz
parents:
diff changeset
63 # CHECK-EMPTY:
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
64 # CHECK-NEXT: <def>:
150
anatofuz
parents:
diff changeset
65 # CHECK-NEXT: addis 2, 12, 2
anatofuz
parents:
diff changeset
66 # CHECK-NEXT: addi 2, 2, -32456
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
67 # CHECK-NEXT: [[DEF]]: li 3, 55
150
anatofuz
parents:
diff changeset
68 # CHECK-NEXT: blr
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
69 # CHECK-EMPTY:
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
70 # CHECK-NEXT: 00000000000[[NOT_DEFINED]] <__plt_not_defined>: