brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · b7c446c Raw
62 lines · plain
1# REQUIRES: ppc2 3# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unkown-linux %p/Inputs/ppc64-toc-relax-shared.s -o %t.o4# RUN: ld.lld -shared -soname=t.so %t.o -o %t.so5# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t1.o6# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-toc-relax.s -o %t2.o7# RUN: llvm-readobj -r %t1.o | FileCheck --check-prefix=RELOCS %s8# RUN: ld.lld %t1.o %t2.o %t.so -o %t9# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SECTIONS %s10# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s11# RUN: llvm-objdump -D %t | FileCheck %s12 13# In most cases, .toc contains exclusively addresses relocated by R_PPC64_ADDR16.14# Rarely .toc contain constants or variables.15# Test we can still perform toc-indirect to toc-relative relaxation.16 17# RELOCS:      .rela.text {18# RELOCS-NEXT:   0x0 R_PPC64_TOC16_HA .toc 0x019# RELOCS-NEXT:   0x4 R_PPC64_TOC16_LO_DS .toc 0x020# RELOCS-NEXT:   0x8 R_PPC64_TOC16_HA .toc 0x821# RELOCS-NEXT:   0xC R_PPC64_TOC16_LO_DS .toc 0x822# RELOCS-NEXT:   0x10 R_PPC64_TOC16_HA .toc 0x1023# RELOCS-NEXT:   0x14 R_PPC64_TOC16_LO_DS .toc 0x1024# RELOCS-NEXT: }25 26# SECTIONS: .got              PROGBITS        000000001002030827# SECTIONS: .toc              PROGBITS        000000001002030828 29# NM: 0000000010030320 D default30 31# .LCONST1 is .toc[0].32# .LCONST1 - (.got+0x8000) = 0x10020350 - (0x10020350+0x8000) = -3276833# CHECK: nop34# CHECK: lwa 3, -32768(2)35  addis 3, 2, .LCONST1@toc@ha36  lwa 3, .LCONST1@toc@l(3)37 38# .LCONST2 is .toc[1]39# .LCONST2 - (.got+0x8000) = 0x10020358 - (0x10020350+0x8000) = -3276040# CHECK: nop41# CHECK: ld 4, -32760(2)42  addis 4, 2, .LCONST2@toc@ha43  ld 4, .LCONST2@toc@l(4)44 45# .Ldefault is .toc[2]. `default` is not preemptable when producing an executable.46# After toc-indirection to toc-relative relaxation, it is loaded using an47# offset relative to r2.48# CHECK: addis 5, 2, 149# CHECK: addi 5, 5, -3274450# CHECK: lwa 5, 0(5)51  addis 5, 2, .Ldefault@toc@ha52  ld    5, .Ldefault@toc@l(5)53  lwa   5, 0(5)54 55.section .toc,"aw",@progbits56.LCONST1:57  .quad 1158.LCONST2:59  .quad 2260.Ldefault:61  .tc default[TC],default62