2 # RUN: echo 'SECTIONS { \
3 # RUN: .text_func 0x10010000 : { *(.text_func) } \
4 # RUN: .text_callee 0x10020000 : { *(.text_callee) } \
5 # RUN: .text_caller 0x10030000 : { *(.text_caller) } \
8 # RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
9 # RUN: ld.lld -T %t.script %t.o -o %t
10 # RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
11 # RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr10 %t | FileCheck %s
13 # RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o
14 # RUN: ld.lld -T %t.script %t.o -o %t --no-power10-stubs --power10-stubs=yes
15 # RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
16 # RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr10 %t | FileCheck %s
18 # RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
19 # RUN: ld.lld -T %t.script %t.o -o %t --power10-stubs=auto --no-power10-stubs
20 # RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL
21 # RUN: llvm-objdump -d --no-show-raw-insn --mcpu=pwr10 %t \
22 # RUN: | FileCheck %s --check-prefix=CHECK-NOP10
24 ## When a function without TOC accesses a function using TOC, an r12 setup stub
27 # SYMBOL: 1: 0000000010010000 0 NOTYPE LOCAL DEFAULT 1 func
28 # SYMBOL-NEXT: 2: 0000000010020000 0 NOTYPE LOCAL DEFAULT [<other: 0x60>] 2 callee
29 # SYMBOL: 4: 0000000010030000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 3 caller
30 # SYMBOL: 6: 0000000010030010 32 FUNC LOCAL DEFAULT 3 __gep_setup_callee
32 # CHECK-LABEL: <func>:
35 # CHECK-LABEL: <callee>:
36 # CHECK: bl 0x10010000
37 # CHECK-NEXT: addis 4, 2, -1
38 # CHECK-NEXT: lwz 4, 32728(4)
41 # CHECK-LABEL: <caller>:
42 # CHECK-NEXT: bl 0x10030010
45 # CHECK-LABEL: <__gep_setup_callee>:
46 # CHECK-NEXT: paddi 12, 0, -65552, 1
47 # CHECK-NEXT: mtctr 12
50 # CHECK-NOP10-LABEL: <__gep_setup_callee>:
51 # CHECK-NOP10-NEXT: mflr 0
52 # CHECK-NOP10-NEXT: bcl 20, 31, 0x10030018
53 # CHECK-NOP10-NEXT: mflr 11
54 # CHECK-NOP10-NEXT: mtlr 12
55 # CHECK-NOP10-NEXT: addis 12, 11, -1
56 # CHECK-NOP10-NEXT: addi 12, 12, -24
57 # CHECK-NOP10-NEXT: mtctr 12
58 # CHECK-NOP10-NEXT: bctr
60 .section .text_func, "ax", %progbits
64 .section .text_callee, "ax", %progbits
67 addis 2, 12, .TOC.-.Lfunc_gep1@ha
68 addi 2, 2, .TOC.-.Lfunc_gep1@l
70 .localentry callee, .Lfunc_lep1-.Lfunc_gep1
72 addis 4, 2, global@toc@ha
73 lwz 4, global@toc@
l(4)
76 .section .text_caller, "ax", %progbits