File: aarch64-fpic-got.s

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (43 lines) | stat: -rw-r--r-- 1,317 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# REQUIRES: aarch64

# RUN: rm -rf %t && split-file %s %t && cd %t

# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %p/Inputs/shared.s -o lib.o
# RUN: ld.lld -shared lib.o -soname lib.so -o lib.so

## Checks if got access to dynamic objects is done through a got relative
## dynamic relocation and not using plt relative (R_AARCH64_JUMP_SLOT).
# RELOC:      .rela.dyn {
# RELOC-NEXT:   0x220318 R_AARCH64_GLOB_DAT bar 0x0
# RELOC-NEXT: }

#--- small.s

# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux small.s -o small.o
# RUN: ld.lld lib.so small.o -o small
# RUN: llvm-readobj -r small | FileCheck --check-prefix=RELOC %s
# RUN: llvm-objdump -d --no-show-raw-insn small | FileCheck --check-prefix=DIS-SMALL %s

## page(0x220318) & 0xff8 = 0x318
# DIS-SMALL:      <_start>:
# DIS-SMALL-NEXT: adrp x0, 0x220000
# DIS-SMALL-NEXT: ldr x0, [x0, #0x318]

.globl _start
_start:
  adrp x0, :got:bar
  ldr  x0, [x0, :got_lo12:bar]

#--- tiny.s

# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux tiny.s -o tiny.o
# RUN: ld.lld lib.so tiny.o -o tiny
# RUN: llvm-readobj -r tiny | FileCheck --check-prefix=RELOC %s
# RUN: llvm-objdump -d --no-show-raw-insn tiny | FileCheck --check-prefix=DIS-TINY %s

# DIS-TINY:      <_start>:
# DIS-TINY-NEXT: ldr x0, 0x220318

.globl _start
_start:
  ldr  x0, :got:bar