84 lines · plain
1# REQUIRES: ppc2# RUN: echo 'SECTIONS { \3# RUN: .text_func 0x10010000 : { *(.text_func) } \4# RUN: .text_callee 0x10020000 : { *(.text_callee) } \5# RUN: .text_caller 0x10030000 : { *(.text_caller) } \6# RUN: }' > %t.script7 8# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o9# RUN: ld.lld -T %t.script %t.o -o %t10# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL11# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s12 13# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o14# RUN: ld.lld -T %t.script %t.o -o %t --no-power10-stubs --power10-stubs=yes15# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL16# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s17 18# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o19# RUN: ld.lld -T %t.script %t.o -o %t --power10-stubs=auto --no-power10-stubs20# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL21# RUN: llvm-objdump -d --no-show-raw-insn %t \22# RUN: | FileCheck %s --check-prefix=CHECK-NOP1023 24## When a function without TOC accesses a function using TOC, an r12 setup stub25## is inserted26 27# SYMBOL: 1: 0000000010010000 0 NOTYPE LOCAL DEFAULT 1 func28# SYMBOL-NEXT: 2: 0000000010020000 0 NOTYPE LOCAL DEFAULT [<other: 0x60>] 2 callee29# SYMBOL: 4: 0000000010030000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 3 caller30# SYMBOL: 6: 0000000010030010 32 FUNC LOCAL DEFAULT 3 __gep_setup_callee31 32# CHECK-LABEL: <func>:33# CHECK-NEXT: blr34 35# CHECK-LABEL: <callee>:36# CHECK: bl 0x1001000037# CHECK-NEXT: addis 4, 2, -138# CHECK-NEXT: lwz 4, 32728(4)39# CHECK-NEXT: blr40 41# CHECK-LABEL: <caller>:42# CHECK-NEXT: bl 0x1003001043# CHECK-NEXT: blr44 45# CHECK-LABEL: <__gep_setup_callee>:46# CHECK-NEXT: paddi 12, 0, -65552, 147# CHECK-NEXT: mtctr 1248# CHECK-NEXT: bctr49 50# CHECK-NOP10-LABEL: <__gep_setup_callee>:51# CHECK-NOP10-NEXT: mflr 1252# CHECK-NOP10-NEXT: bcl 20, 31, 0x1003001853# CHECK-NOP10-NEXT: mflr 1154# CHECK-NOP10-NEXT: mtlr 1255# CHECK-NOP10-NEXT: addis 12, 11, -156# CHECK-NOP10-NEXT: addi 12, 12, -2457# CHECK-NOP10-NEXT: mtctr 1258# CHECK-NOP10-NEXT: bctr59 60.section .text_func, "ax", %progbits61func:62 blr63 64.section .text_callee, "ax", %progbits65callee:66.Lfunc_gep1:67 addis 2, 12, .TOC.-.Lfunc_gep1@ha68 addi 2, 2, .TOC.-.Lfunc_gep1@l69.Lfunc_lep1:70 .localentry callee, .Lfunc_lep1-.Lfunc_gep171 bl func72 addis 4, 2, global@toc@ha73 lwz 4, global@toc@l(4)74 blr75 76.section .text_caller, "ax", %progbits77caller:78 .localentry caller, 179 bl callee@notoc80 blr81global:82 .long 083 .size global, 484