File: i386-zrel-zrela.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 (77 lines) | stat: -rw-r--r-- 2,581 bytes parent folder | download | duplicates (21)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# REQUIRES: x86
## The i386 psABI uses Elf64_Rela relocation entries. We produce
## Elf32_Rel dynamic relocations by default, but can use Elf32_Rela with -z rela.

# RUN: llvm-mc -filetype=obj -triple=i386 %s -o %t.o
# RUN: ld.lld -shared %t.o -o %t.so --noinhibit-exec
# RUN: llvm-readobj -d -r -x .data -x .got.plt %t.so | FileCheck --check-prefix=REL %s
# RUN: ld.lld -shared -z rel %t.o -o %t1.so
# RUN: llvm-readobj -d -r -x .data -x .got.plt %t1.so | FileCheck --check-prefix=REL %s

# REL:      REL      {{.*}}
# REL-NEXT: RELSZ    32 (bytes)
# REL-NEXT: RELENT   8 (bytes)
# REL-NEXT: RELCOUNT 1
# REL-NEXT: JMPREL   {{.*}}
# REL-NEXT: PLTRELSZ 8 (bytes)
# REL-NEXT: PLTGOT   {{.*}}
# REL-NEXT: PLTREL   REL{{$}}
# REL:      .rel.dyn {
# REL-NEXT:   R_386_RELATIVE -
# REL-NEXT:   R_386_GLOB_DAT func
# REL-NEXT:   R_386_TLS_TPOFF tls
# REL-NEXT:   R_386_32 _start
# REL-NEXT: }
# REL-NEXT: .rel.plt {
# REL-NEXT:   R_386_JUMP_SLOT func
# REL-NEXT: }

# REL-LABEL: Hex dump of section '.data':
# REL-NEXT:  0x000042d0 d0420000 2a000000
##                       ^--- R_386_RELATIVE addend (0x42d0)
##                                ^--- R_386_32 addend (0x2a)
# REL-LABEL: Hex dump of section '.got.plt':
# REL-NEXT:  0x000042d8 48320000 00000000 00000000 36120000
##  R_386_JUMP_SLOT target (0x1236) ---------------^

# RUN: ld.lld -shared -z rel -z rela %t.o -o %t2.so
# RUN: llvm-readobj -d -r -x .data -x .got.plt %t2.so | FileCheck --check-prefix=RELA %s

# RELA:      RELA      {{.*}}
# RELA-NEXT: RELASZ    48 (bytes)
# RELA-NEXT: RELAENT   12 (bytes)
# RELA-NEXT: RELACOUNT 1
# RELA-NEXT: JMPREL    {{.*}}
# RELA-NEXT: PLTRELSZ  12 (bytes)
# RELA-NEXT: PLTGOT    {{.*}}
# RELA-NEXT: PLTREL    RELA
# RELA:      .rela.dyn {
# RELA-NEXT:   R_386_RELATIVE - 0x42F0
# RELA-NEXT:   R_386_GLOB_DAT func 0x0
# RELA-NEXT:   R_386_TLS_TPOFF tls 0x0
# RELA-NEXT:   R_386_32 _start 0x2A
# RELA-NEXT: }
# RELA-NEXT: .rela.plt {
# RELA-NEXT:   R_386_JUMP_SLOT func 0x0
# RELA-NEXT: }

# RELA-LABEL: Hex dump of section '.data':
# RELA-NEXT:  0x000042f0 00000000 2a000000
##                                ^--- R_386_32 addend (0x2a)
## TODO: we should probably clear the R_386_32 addend that was copied from the .o?
## no addend written for R_386_RELATIVE
# RELA-LABEL: Hex dump of section '.got.plt':
# RELA-NEXT:  0x000042f8 68320000 00000000 00000000 56120000
##  R_386_JUMP_SLOT target (0x1256) ----------------^

.globl _start
_start:
  call func@PLT
  movl func@GOT(%eax), %eax

.section .text1,"awx"
  movl tls@GOTNTPOFF(%eax), %eax

.data
  .long .data
  .long _start+42