2 # RUN: echo 'SECTIONS { \
3 # RUN: .text_callee 0x10010000 : { *(.text_callee) } \
4 # RUN: .text_caller 0x10020000 : { *(.text_caller) } \
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 \
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>:
35 # CHECK-LABEL: <caller>:
36 # CHECK: bl 0x10020040 <__toc_save_callee>
37 # CHECK-NEXT: ld 2, 24(1)
40 # CHECK-LABEL: <caller_14>:
41 # CHECK: bfl 0, 0x10020040 <__toc_save_callee>
42 # CHECK-NEXT: ld 2, 24(1)
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
54 .section .text_caller, "ax", %progbits
57 addis 2, 12, .TOC.-.Lfunc_gep1@ha
58 addi 2, 2, .TOC.-.Lfunc_gep1@l
60 .localentry caller, .Lfunc_lep1-.Lfunc_gep1
61 addis 30, 2, global@toc@ha
62 lwz 3, global@toc@
l(30)
71 addis 2, 12, .TOC.-.Lfunc_gep1@ha
72 addi 2, 2, .TOC.-.Lfunc_gep1@l
74 .localentry caller_14, .Lfunc_lep2-.Lfunc_gep2
75 addis 30, 2, global@toc@ha
76 lwz 3, global@toc@
l(30)