File: loh-adrp-ldr-got.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (35 lines) | stat: -rw-r--r-- 857 bytes parent folder | download | duplicates (15)
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
# REQUIRES: aarch64

# RUN: rm -rf %t; split-file %s %t
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/obj.s -o %t/obj.o
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/dylib.s -o %t/dylib.o
# RUN: %lld -arch arm64 -dylib -o %t/libdylib.dylib %t/dylib.o
# RUN: %lld -arch arm64 %t/obj.o %t/libdylib.dylib -o %t/AdrpLdrGot
# RUN: llvm-objdump -d --macho %t/AdrpLdrGot | FileCheck %s

#--- obj.s
.text
.globl _main
# CHECK-LABEL: _main:
_main:
## The referenced symbol is local
L1: adrp x0, _local@GOTPAGE
L2: ldr  x0, [x0, _local@GOTPAGEOFF]
# CHECK-NEXT: adr x0
# CHECK-NEXT: nop

## The referenced symbol is in a dylib
L3: adrp x1, _external@GOTPAGE
L4: ldr  x1, [x1, _external@GOTPAGEOFF]
# CHECK-NEXT: nop
# CHECK-NEXT: ldr x1

_local:
  nop

.loh AdrpLdrGot L1, L2
.loh AdrpLdrGot L3, L4

#--- dylib.s
.globl _external
_external: