[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / pack-dyn-relocs-ifunc.s
blob6168d06f99d9e94c1967d03c9be335e93fcd815a
1 # REQUIRES: aarch64
2 ## Prior to Android V, there was a bug that caused RELR relocations to be
3 ## applied after packed relocations. This meant that resolvers referenced by
4 ## IRELATIVE relocations in the packed relocation section would read unrelocated
5 ## globals when --pack-relative-relocs=android+relr is enabled. Work around this
6 ## by placing IRELATIVE in .rela.plt.
8 # RUN: rm -rf %t && split-file %s %t && cd %t
9 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-android a.s -o a.o
10 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-android b.s -o b.o
11 # RUN: ld.lld -shared b.o -o b.so
12 # RUN: ld.lld -pie --pack-dyn-relocs=android+relr -z separate-loadable-segments a.o b.so -o a
13 # RUN: llvm-readobj -r a | FileCheck %s
14 # RUN: llvm-objdump -d a | FileCheck %s --check-prefix=ASM
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 0x0
21 # CHECK-NEXT: 0x30028 R_AARCH64_IRELATIVE - 0x10000
22 # CHECK-NEXT: }
24 # ASM: <.iplt>:
25 # ASM-NEXT: adrp x16, 0x30000
26 # ASM-NEXT: ldr x17, [x16, #0x28]
27 # ASM-NEXT: add x16, x16, #0x28
28 # ASM-NEXT: br x17
30 #--- a.s
31 .text
32 .type foo, %gnu_indirect_function
33 .globl foo
34 foo:
35 ret
37 .globl _start
38 _start:
39 bl foo
40 bl bar
42 .data
43 .balign 8
44 .quad .data
46 #--- b.s
47 .globl bar
48 bar:
49 ret