1# REQUIRES: aarch64
2
3# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %s -o %t.o
4# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %p/Inputs/shared.s -o %t-lib.o
5# RUN: ld.lld -shared %t-lib.o -soname t-lib.so -o %t-lib.so
6
7# RUN: ld.lld %t-lib.so %t.o -o %t.exe
8# RUN: llvm-readobj -r %t.exe | FileCheck --check-prefix=RELOC %s
9# RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck --check-prefix=DIS %s
10
11## Checks if got access to dynamic objects is done through a got relative
12## dynamic relocation and not using plt relative (R_AARCH64_JUMP_SLOT).
13# RELOC:      .rela.dyn {
14# RELOC-NEXT:   0x220320 R_AARCH64_GLOB_DAT bar 0x0
15# RELOC-NEXT: }
16
17## page(0x220320) - page(0x210000) = 65536
18## page(0x220320) & 0xff8 = 800
19# DIS:      <_start>:
20# DIS-NEXT: 210258: adrp x0, 0x220000
21# DIS-NEXT: 21025c: ldr x0, [x0, #800]
22
23.globl _start
24_start:
25  adrp x0, :got:bar
26  ldr  x0, [x0, :got_lo12:bar]
27