brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 85a0764 Raw
48 lines · plain
1# REQUIRES: ppc2## Test addend adjustment of R_PPC_PLTREL24 when copying relocations.3## If r_addend indicates .got2, adjust it by the local .got2's output section offset.4 5# RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o6# RUN: echo 'bl f+0x8000@plt' | llvm-mc -filetype=obj -triple=powerpc - -o %t2.o7# RUN: ld.lld -r %t.o %t.o %t2.o -o %t8# RUN: llvm-readobj -r %t | FileCheck %s9 10# RUN: ld.lld -shared --emit-relocs %t.o %t.o %t2.o -o %t.so11# RUN: llvm-readobj -r %t.so | FileCheck %s12 13# CHECK:      .rela.adjust {14# CHECK-NEXT:   R_PPC_REL16_HA .got2 0x800215# CHECK-NEXT:   R_PPC_REL16_LO .got2 0x800616# CHECK-NEXT:   R_PPC_PLTREL24 foo 0x800017# CHECK-NEXT:   R_PPC_PLTREL24 bar 0x800018# CHECK-NEXT:   R_PPC_REL16_HA .got2 0x800619# CHECK-NEXT:   R_PPC_REL16_LO .got2 0x800A20# CHECK-NEXT:   R_PPC_PLTREL24 foo 0x800421# CHECK-NEXT:   R_PPC_PLTREL24 bar 0x800422# CHECK-NEXT: }23# CHECK-NEXT: .rela.no_adjust {24# CHECK-NEXT:   R_PPC_PLTREL24 foo 0x025# CHECK-NEXT:   R_PPC_PLTREL24 foo 0x026# CHECK-NEXT: }27## %t2.o has an invalid relocation with r_addend=0x8000. Test we don't crash.28## The addend doesn't matter.29# CHECK-NEXT: .rela.text {30# CHECK-NEXT:   R_PPC_PLTREL24 f 0x800031# CHECK-NEXT: }32.section .got2,"aw"33.long 034 35.section .adjust,"ax"36bcl 20,30,.L037.L0:38addis 30,30,.got2+0x8000-.L0@ha39addi 30,30,.got2+0x8000-.L0@l40 41## Refers to .got2+addend, adjust.42bl foo+0x8000@plt43bl bar+0x8000@plt44 45.section .no_adjust,"ax"46## Refers to .got, no adjustment.47bl foo@plt48