1# REQUIRES: ppc 2 3# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o 4# RUN: ld.lld %t.o -o %t 5# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s 6# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s 7 8# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o 9# RUN: ld.lld %t.o -o %t 10# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s 11# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s 12 13.text 14.abiversion 2 15.globl _start 16.p2align 4 17.type _start,@function 18 19_start: 20.Lfunc_begin0: 21.Lfunc_gep0: 22 lis 4, .Lfunc_gep0@ha 23 addi 4, 4, .Lfunc_gep0@l 24 # now r4 should contain the address of _start 25 26 lis 5, .TOC.-.Lfunc_gep0@ha # R_PPC64_REL16_HA 27 addi 5, 5, .TOC.-.Lfunc_gep0@l # R_PPC64_REL16_LO 28 # now r5 should contain the offset s.t. r4 + r5 = TOC base 29 30 # exit 55 31 li 0, 1 32 li 3, 55 33 sc 34.Lfunc_end0: 35 .size _start, .Lfunc_end0-.Lfunc_begin0 36 37# NM-DAG: 00000000100281f0 d .TOC. 38# NM-DAG: 00000000100101d0 T _start 39 40# 0x100101d0 = (4097<<16) + 464 41# CHECK: 100101d0: lis 4, 4097 42# CHECK-NEXT: 100101d4: addi 4, 4, 464 43# .TOC. - _start = (2<<16) - 32736 44# CHECK-NEXT: 100101d8: lis 5, 2 45# CHECK-NEXT: 100101dc: addi 5, 5, -32736 46