brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · b6000df Raw
75 lines · plain
1# REQUIRES: aarch642## Prior to Android V, there was a bug that caused RELR relocations to be3## applied after packed relocations. This meant that resolvers referenced by4## IRELATIVE relocations in the packed relocation section would read unrelocated5## globals when --pack-relative-relocs=android+relr is enabled. Work around this6## by placing IRELATIVE in .rela.plt.7 8# RUN: rm -rf %t && split-file %s %t && cd %t9# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-android a.s -o a.o10# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-android b.s -o b.o11# RUN: ld.lld -shared b.o -o b.so12# RUN: ld.lld -pie --pack-dyn-relocs=android+relr -z separate-loadable-segments a.o b.so -o a13# RUN: llvm-readobj -r a | FileCheck %s14# RUN: llvm-objdump -d a | FileCheck %s --check-prefix=ASM15 16# CHECK:      .relr.dyn {17# CHECK-NEXT:   0x30000 R_AARCH64_RELATIVE -18# CHECK-NEXT: }19# CHECK:      .rela.plt {20# CHECK-NEXT:   0x30020 R_AARCH64_JUMP_SLOT bar 0x021# CHECK-NEXT:   0x30028 R_AARCH64_IRELATIVE - 0x1000022# CHECK-NEXT: }23 24# ASM:      <.iplt>:25# ASM-NEXT:   adrp    x16, 0x3000026# ASM-NEXT:   ldr     x17, [x16, #0x28]27# ASM-NEXT:   add     x16, x16, #0x2828# ASM-NEXT:   br      x1729 30#--- a.s31.text32.type foo, %gnu_indirect_function33.globl foo34foo:35  ret36 37.globl _start38_start:39  bl foo40  bl bar41 42.data43.balign 844.quad .data45 46#--- b.s47.globl bar48bar:49  ret50 51#--- c.s52 53# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-android c.s -o c.o54# RUN: ld.lld --pack-dyn-relocs=android c.o -o c55# RUN: llvm-readelf -sS c | FileCheck --check-prefix=STATIC %s56 57# STATIC: .rela.plt         RELA            0000000000200158 000158 000018 18  AI  0   5  858# STATIC: 0000000000200158     0 NOTYPE  LOCAL  HIDDEN      1 __rela_iplt_start59# STATIC: 0000000000200170     0 NOTYPE  LOCAL  HIDDEN      1 __rela_iplt_end60 61.text62.type foo, %gnu_indirect_function63.globl foo64foo:65  ret66 67.globl _start68_start:69  bl foo70 71.data72.balign 873.quad __rela_iplt_start74.quad __rela_iplt_end75