2016-04-08 22:10:41 +08:00
|
|
|
# REQUIRES: aarch64
|
|
|
|
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %s -o %t.o
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %p/Inputs/shared.s -o %t-lib.o
|
2019-08-20 16:34:56 +08:00
|
|
|
# RUN: ld.lld -shared %t-lib.o -soname t-lib.so -o %t-lib.so
|
2019-06-01 19:01:26 +08:00
|
|
|
|
2016-04-08 22:10:41 +08:00
|
|
|
# RUN: ld.lld %t-lib.so %t.o -o %t.exe
|
2019-06-01 19:01:26 +08:00
|
|
|
# RUN: llvm-readobj -r %t.exe | FileCheck --check-prefix=RELOC %s
|
|
|
|
# RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck --check-prefix=DIS %s
|
2016-04-08 22:10:41 +08:00
|
|
|
|
|
|
|
## Checks if got access to dynamic objects is done through a got relative
|
|
|
|
## dynamic relocation and not using plt relative (R_AARCH64_JUMP_SLOT).
|
2019-06-01 19:01:26 +08:00
|
|
|
# RELOC: .rela.dyn {
|
2019-08-20 16:34:56 +08:00
|
|
|
# RELOC-NEXT: 0x220320 R_AARCH64_GLOB_DAT bar 0x0
|
2019-06-01 19:01:26 +08:00
|
|
|
# RELOC-NEXT: }
|
|
|
|
|
2019-08-20 16:34:56 +08:00
|
|
|
## page(0x220320) - page(0x210000) = 65536
|
|
|
|
## page(0x220320) & 0xff8 = 800
|
2020-03-06 06:18:38 +08:00
|
|
|
# DIS: <_start>:
|
2019-08-20 16:34:56 +08:00
|
|
|
# DIS-NEXT: 210258: adrp x0, #65536
|
|
|
|
# DIS-NEXT: 21025c: ldr x0, [x0, #800]
|
2016-04-08 22:10:41 +08:00
|
|
|
|
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
adrp x0, :got:bar
|
|
|
|
ldr x0, [x0, :got_lo12:bar]
|