1// REQUIRES: ppc 2 3// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o 4// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o 5// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-func.s -o %t3.o 6// RUN: ld.lld -shared -soname=t2.so %t2.o -o %t2.so 7// RUN: ld.lld %t.o %t2.so %t3.o -o %t 8// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s 9 10// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o 11// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o 12// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-func.s -o %t3.o 13// RUN: ld.lld -shared -soname=t2.so %t2.o -o %t2.so 14// RUN: ld.lld %t.o %t2.so %t3.o -o %t 15// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s 16 17 .text 18 .abiversion 2 19.global bar_local 20bar_local: 21 li 3, 2 22 blr 23 24# Calling external function foo in a shared object needs a nop. 25# Calling local function bar_local doe not need a nop. 26.global _start 27_start: 28 bl foo 29 nop 30 bl bar_local 31// CHECK-LABEL: <_start>: 32// CHECK-NEXT: 100102c8: bl 0x10010310 33// CHECK-NEXT: 100102cc: ld 2, 24(1) 34// CHECK-NEXT: 100102d0: bl 0x100102c0 35// CHECK-EMPTY: 36 37# Calling a function in another object file which will have same 38# TOC base does not need a nop. If nop present, do not rewrite to 39# a toc restore 40.global diff_object 41_diff_object: 42 bl foo_not_shared 43 bl foo_not_shared 44 nop 45// CHECK-LABEL: <_diff_object>: 46// CHECK-NEXT: 100102d4: bl 0x100102f0 47// CHECK-NEXT: 100102d8: bl 0x100102f0 48// CHECK-NEXT: 100102dc: nop 49 50# Branching to a local function does not need a nop 51.global noretbranch 52noretbranch: 53 b bar_local 54// CHECK-LABEL: <noretbranch>: 55// CHECK-NEXT: 100102e0: b 0x100102c0 56// CHECK-EMPTY: 57 58// This should come last to check the end-of-buffer condition. 59.global last 60last: 61 bl foo 62 nop 63// CHECK-LABEL: <last>: 64// CHECK-NEXT: 100102e4: bl 0x10010310 65// CHECK-NEXT: 100102e8: ld 2, 24(1) 66