[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / ppc64-toc-call-to-pcrel.s
blob78d7e299f14ae31cab214f4e0e6ee75b240fd54e
1 # REQUIRES: ppc
2 # RUN: echo 'SECTIONS { \
3 # RUN: .text_callee 0x10010000 : { *(.text_callee) } \
4 # RUN: .text_caller 0x10020000 : { *(.text_caller) } \
5 # RUN: }' > %t.script
7 # RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
8 # RUN: ld.lld -T %t.script %t.o -o %t
9 # RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
10 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
12 # RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o
13 # RUN: ld.lld -T %t.script %t.o -o %t
14 # RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
15 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
17 # RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o
18 # RUN: ld.lld -T %t.script %t.o -o %t --no-power10-stubs
19 # RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
20 # RUN: llvm-objdump -d --no-show-raw-insn %t \
21 # RUN: | FileCheck %s
23 # The point of this test is to make sure that when a function with TOC access
24 # a local function with st_other=1, a TOC save stub is inserted.
26 # SYMBOL: Symbol table '.symtab' contains 7 entries
27 # SYMBOL: 10010000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 1 callee
28 # SYMBOL: 10020000 0 NOTYPE LOCAL DEFAULT [<other: 0x60>] 2 caller
29 # SYMBOL: 10020020 0 NOTYPE LOCAL DEFAULT [<other: 0x60>] 2 caller_14
30 # SYMBOL: 10020040 8 FUNC LOCAL DEFAULT 2 __toc_save_callee
32 # CHECK-LABEL: <callee>:
33 # CHECK: blr
35 # CHECK-LABEL: <caller>:
36 # CHECK: bl 0x10020040 <__toc_save_callee>
37 # CHECK-NEXT: ld 2, 24(1)
38 # CHECK-NEXT: blr
40 # CHECK-LABEL: <caller_14>:
41 # CHECK: bfl 0, 0x10020040 <__toc_save_callee>
42 # CHECK-NEXT: ld 2, 24(1)
43 # CHECK-NEXT: blr
45 # CHECK-LABEL: <__toc_save_callee>:
46 # CHECK-NEXT: std 2, 24(1)
47 # CHECK-NEXT: b 0x10010000 <callee>
49 .section .text_callee, "ax", %progbits
50 callee:
51 .localentry callee, 1
52 blr
54 .section .text_caller, "ax", %progbits
55 caller:
56 .Lfunc_gep1:
57 addis 2, 12, .TOC.-.Lfunc_gep1@ha
58 addi 2, 2, .TOC.-.Lfunc_gep1@l
59 .Lfunc_lep1:
60 .localentry caller, .Lfunc_lep1-.Lfunc_gep1
61 addis 30, 2, global@toc@ha
62 lwz 3, global@toc@l(30)
63 bl callee
64 nop
65 blr
66 global:
67 .long 0
69 caller_14:
70 .Lfunc_gep2:
71 addis 2, 12, .TOC.-.Lfunc_gep1@ha
72 addi 2, 2, .TOC.-.Lfunc_gep1@l
73 .Lfunc_lep2:
74 .localentry caller_14, .Lfunc_lep2-.Lfunc_gep2
75 addis 30, 2, global@toc@ha
76 lwz 3, global@toc@l(30)
77 bcl 4, 0, callee
78 nop
79 blr