67 lines · plain
1# REQUIRES: ppc2# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o3# RUN: echo 'addis 5, 2, .LC0@toc@ha; ld 5, .LC0@toc@l(5); foo: \4# RUN: .section .toc,"aw",@progbits; .LC0: .tc foo[TC], foo' \5# RUN: | llvm-mc -filetype=obj -triple=powerpc64le - -o %t1.o6# RUN: ld.lld %t.o %t1.o -o %t7# RUN: llvm-objdump -d %t | FileCheck %s8 9# CHECK-LABEL: <_start>:10.globl _start11_start:12## Perform toc-indirect to toc-relative relaxation even if there are unrelated instructions in between.13# CHECK-NEXT: addis 3, 2, -214# CHECK-NEXT: li 9, 015# CHECK-NEXT: addi 3, 3, 3275216# CHECK-NEXT: lwa 3, 0(3)17 addis 3, 2, .LC1@toc@ha # R_PPC64_TOC16_HA18 li 9, 019 ld 3, .LC1@toc@l(3) # R_PPC64_TOC16_LO_DS20 lwa 3, 0(3)21 22## R_PPC64_TOC16_HA and R_PPC64_TOC16_LO_DS can interleave.23# CHECK-NEXT: addis 3, 2, -224# CHECK-NEXT: addis 4, 2, -225# CHECK-NEXT: addi 3, 3, 3275226# CHECK-NEXT: addi 4, 4, 3275627 addis 3, 2, .LC1@toc@ha28 addis 4, 2, .LC2@toc@ha29 ld 3, .LC1@toc@l(3)30 ld 4, .LC2@toc@l(4)31 32## We choose to be conservative: the presence of R_PPC64_TOC16_LO33## suppresses relaxation for the symbol.34## R_PPC64_TOC16_HA and R_PPC64_TOC16_LO_DS pairs are not relaxed as well.35# CHECK-NEXT: nop36# CHECK-NEXT: addi 3, 2, -3276837# CHECK-NEXT: li 9, 038# CHECK-NEXT: nop39# CHECK-NEXT: ld 4, -32768(2)40 addis 3, 2, .LC0@toc@ha # R_PPC64_TOC16_HA41 addi 3, 3, .LC0@toc@l # R_PPC64_TOC16_LO42 li 9, 043 addis 4, 2, .LC0@toc@ha44 ld 4, .LC0@toc@l(4)45 46# CHECK-COUNT-3: blr47AES_encrypt:48 blr49AES_decrypt:50 blr51BN_free:52 blr53 54## %t1.o has relaxable relocation pairs referencing its .toc which is different55## from %t.o(.toc). The suppression in %t.o does not affect %t1.o even if56## the relocation addends are the same.57# CHECK-NEXT: addis 5, 2, -158# CHECK-NEXT: addi 5, 5, -3276859 60.section .toc,"aw",@progbits61.LC0:62 .tc AES_encrypt[TC], AES_encrypt63.LC1:64 .tc AES_decrypt[TC], AES_decrypt65.LC2:66 .tc BN_free[TC], BN_free67