80 lines · plain
1# REQUIRES: ppc2# RUN: echo 'SECTIONS { \3# RUN: .text_callee 0x10010000 : { *(.text_callee) } \4# RUN: .text_caller 0x10020000 : { *(.text_caller) } \5# RUN: }' > %t.script6 7# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o8# RUN: ld.lld -T %t.script %t.o -o %t9# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL10# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s11 12# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o13# RUN: ld.lld -T %t.script %t.o -o %t14# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL15# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s16 17# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o18# RUN: ld.lld -T %t.script %t.o -o %t --no-power10-stubs19# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL20# RUN: llvm-objdump -d --no-show-raw-insn %t \21# RUN: | FileCheck %s22 23# The point of this test is to make sure that when a function with TOC access24# a local function with st_other=1, a TOC save stub is inserted.25 26# SYMBOL: Symbol table '.symtab' contains 7 entries27# SYMBOL: 10010000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 1 callee28# SYMBOL: 10020000 0 NOTYPE LOCAL DEFAULT [<other: 0x60>] 2 caller29# SYMBOL: 10020020 0 NOTYPE LOCAL DEFAULT [<other: 0x60>] 2 caller_1430# SYMBOL: 10020040 8 FUNC LOCAL DEFAULT 2 __toc_save_callee31 32# CHECK-LABEL: <callee>:33# CHECK: blr34 35# CHECK-LABEL: <caller>:36# CHECK: bl 0x10020040 <__toc_save_callee>37# CHECK-NEXT: ld 2, 24(1)38# CHECK-NEXT: blr39 40# CHECK-LABEL: <caller_14>:41# CHECK: bfl 0, 0x10020040 <__toc_save_callee>42# CHECK-NEXT: ld 2, 24(1)43# CHECK-NEXT: blr44 45# CHECK-LABEL: <__toc_save_callee>:46# CHECK-NEXT: std 2, 24(1)47# CHECK-NEXT: b 0x10010000 <callee>48 49.section .text_callee, "ax", %progbits50callee:51 .localentry callee, 152 blr53 54.section .text_caller, "ax", %progbits55caller:56.Lfunc_gep1:57 addis 2, 12, .TOC.-.Lfunc_gep1@ha58 addi 2, 2, .TOC.-.Lfunc_gep1@l59.Lfunc_lep1:60 .localentry caller, .Lfunc_lep1-.Lfunc_gep161 addis 30, 2, global@toc@ha62 lwz 3, global@toc@l(30)63 bl callee64 nop65 blr66global:67 .long 068 69caller_14:70.Lfunc_gep2:71 addis 2, 12, .TOC.-.Lfunc_gep1@ha72 addi 2, 2, .TOC.-.Lfunc_gep1@l73.Lfunc_lep2:74 .localentry caller_14, .Lfunc_lep2-.Lfunc_gep275 addis 30, 2, global@toc@ha76 lwz 3, global@toc@l(30)77 bcl 4, 0, callee78 nop79 blr80