2 # RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o
3 # RUN: ld.lld %t.o -o %t
4 # RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t | FileCheck %s
5 # RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SEC
6 # RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELOC
8 # CHECK: Disassembly of section .text:
10 # CHECK-NEXT: <myfunc>:
14 # .got.plt - page(0x210174) = 0x220190 - 0x210000 = 0x10190
15 # CHECK-NEXT: 210174: adrp x8, 0x220000
16 # CHECK-NEXT: 210178: ldr x8, [x8, #0x190]
17 # CHECK-NEXT: 21017c: ret
19 # CHECK: Disassembly of section .iplt:
21 # CHECK-NEXT: <.iplt>:
22 # .got.plt - page(0x210180) = 0x220190 - 0x210000 = 0x10190
23 # CHECK-NEXT: 210180: adrp x16, 0x220000
24 # CHECK-NEXT: 210184: ldr x17, [x16, #0x190]
25 # CHECK-NEXT: 210188: add x16, x16, #0x190
26 # CHECK-NEXT: 21018c: br x17
28 # SEC: .got.plt PROGBITS 0000000000220190 000190 000008 00 WA 0 0 8
30 # RELOC: Relocations [
31 # RELOC-NEXT: Section {{.*}} .rela.dyn {
32 # RELOC-NEXT: 0x220190 R_AARCH64_IRELATIVE - 0x210170
38 .type myfunc,@gnu_indirect_function
47 ldr x8
, [x8
, :got_lo12
:myfunc
]