2 # RUN: split-file %s %t
4 # RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %t/test.s -o %t.o
5 # RUN: ld.lld -shared --script %t/script %t.o -o %t.so
6 # RUN: ld.lld -pie --script %t/script %t.o -o %t.exe
7 # RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=RELOCS-SHARED %s
8 # RUN: llvm-readobj -r %t.exe | FileCheck --check-prefix=RELOCS-PIE %s
9 # RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn -d %t.so | FileCheck --check-prefix=DISAS %s
11 ## Check if the R_AARCH64_LD64_GOTPAGE_LO15 generates the GOT entries.
12 # RELOCS-SHARED: Relocations [
13 # RELOCS-SHARED-NEXT: Section (5) .rela.dyn {
14 # RELOCS-SHARED-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_GLOB_DAT global1 0x{{[0-9A-F]+}}
15 # RELOCS-SHARED-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_GLOB_DAT global2 0x{{[0-9A-F]+}}
16 # RELOCS-SHARED-NEXT: }
17 # RELOCS-SHARED-NEXT: ]
19 # RELOCS-PIE: Relocations [
20 # RELOCS-PIE-NEXT: Section (5) .rela.dyn {
21 # RELOCS-PIE-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_RELATIVE - 0x{{[0-9A-F]+}}
22 # RELOCS-PIE-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_RELATIVE - 0x{{[0-9A-F]+}}
26 # DISAS: adrp x0, 0xf000
27 # DISAS-NEXT: ldr x0, [x0, #4088]
28 # DISAS-NEXT: ldr x1, [x0, #4096]
32 .got (0x10000 - 8) : { *.got }
37 .type _start,@function
39 adrp x0
, _GLOBAL_OFFSET_TABLE_
40 ldr x0
, [x0
, #:gotpage_lo15:global1]
41 ldr x1
, [x0
, #:gotpage_lo15:global2]