File: x86-64-reloc-pltoff64.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 (41 lines) | stat: -rw-r--r-- 1,382 bytes parent folder | download | duplicates (14)
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
# REQUIRES: x86
## Test R_X86_64_PLTOFF64 (preemptible: L - GOT + A; non-preemptible: S - GOT + A).

# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
# RUN: ld.lld %t.o -shared -o %t.so
# RUN: llvm-readelf -S %t.so | FileCheck %s --check-prefix=SEC-SHARED
# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.so | FileCheck %s --check-prefix=SHARED

# RUN: ld.lld %t.o -o %t
# RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SEC-PDE
# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t | FileCheck %s --check-prefix=PDE

# SEC-SHARED: .got.plt PROGBITS 00000000000033c0 0003c0 000028

## foo@plt - .got.plt = 0x12f0 - 0x33c0 = -8400
## undefweak@plt - .got.plt = 0x1300 - 0x33c0 = -8384
# SHARED-LABEL: <.text>:
# SHARED-NEXT:          movabsq $-8400, %rdx
# SHARED-NEXT:          movabsq $-8384, %rdx
# SHARED-LABEL: <foo@plt>:
# SHARED-NEXT:    12f0: jmpq {{.*}}(%rip)

# SEC-PDE: .got.plt PROGBITS 0000000000202170 000170 000018

## Avoid PLT since the referenced symbol is non-preemptible.
## foo - .got.plt = 0x20116c - 0x202170 = -4100
## 0 - .got.plt = 0 - 0x202168 = -2105712
# PDE-LABEL: <.text>:
# PDE-NEXT:            movabsq $-4100, %rdx
# PDE-NEXT:            movabsq $-2105712, %rdx
# PDE-LABEL: <foo>:
# PDE-NEXT:    20116c: retq

  movabsq $foo@PLTOFF, %rdx
  movabsq $undefweak@PLTOFF, %rdx

.globl foo
foo:
  ret

.weak undefweak