• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: aarch64
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
7
8# CHECK:      Disassembly of section .text:
9# CHECK-EMPTY:
10# CHECK-NEXT: <myfunc>:
11# CHECK-NEXT:   210170:
12
13# CHECK:      <main>:
14# .got.plt - page(0x210174) = 0x220190 - 0x210000 = 0x10190
15# CHECK-NEXT:   210174: adrp    x8, #0x10000
16# CHECK-NEXT:   210178: ldr     x8, [x8, #0x190]
17# CHECK-NEXT:   21017c: ret
18
19# CHECK:      Disassembly of section .iplt:
20# CHECK-EMPTY:
21# CHECK-NEXT: <.iplt>:
22# .got.plt - page(0x210180) = 0x220190 - 0x210000 = 0x10190
23# CHECK-NEXT:   210180: adrp    x16, #0x10000
24# CHECK-NEXT:   210184: ldr     x17, [x16, #0x190]
25# CHECK-NEXT:   210188: add     x16, x16, #0x190
26# CHECK-NEXT:   21018c: br      x17
27
28# SEC: .got.plt PROGBITS 0000000000220190 000190 000008 00 WA 0 0 8
29
30# RELOC:      Relocations [
31# RELOC-NEXT:   Section {{.*}} .rela.dyn {
32# RELOC-NEXT:     0x220190 R_AARCH64_IRELATIVE - 0x210170
33# RELOC-NEXT:   }
34# RELOC-NEXT: ]
35
36.text
37.globl myfunc
38.type myfunc,@gnu_indirect_function
39myfunc:
40 ret
41
42.text
43.globl main
44.type main,@function
45main:
46 adrp x8, :got:myfunc
47 ldr  x8, [x8, :got_lo12:myfunc]
48 ret
49