File: got32-i386-pie-rw.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 (54 lines) | stat: -rw-r--r-- 2,000 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
42
43
44
45
46
47
48
49
50
51
52
53
54
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o
# RUN: llvm-readobj -r %t.o | FileCheck %s --check-prefix=OBJ
# RUN: ld.lld %t.o -o %t -pie
# RUN: llvm-objdump --no-print-imm-hex -s --section=.foobar --section=.got -r -d -t \
# RUN:   --dynamic-reloc %t | FileCheck %s --check-prefixes=CHECK,REL
# RUN: ld.lld %t.o -o %t-rela -pie -z rela
# RUN: llvm-objdump --no-print-imm-hex -s --section=.foobar --section=.got -r -d -t \
# RUN:   --dynamic-reloc %t-rela | FileCheck %s --check-prefixes=CHECK,RELA

# Unlike bfd and gold we accept this.

# OBJ:      Relocations [
# OBJ-NEXT:   Section (4) .rel.foobar {
# OBJ-NEXT:     0x2 R_386_GOT32 foo
# OBJ-NEXT:   }
# OBJ-NEXT: ]

# CHECK-LABEL: SYMBOL TABLE:
# REL:  00001180 l       .text	00000000 foo
# REL:  00002180 g       .foobar	00000000 _start
# RELA: 00001188 l       .text	00000000 foo
# RELA: 00002188 g       .foobar	00000000 _start

# CHECK-LABEL: DYNAMIC RELOCATION RECORDS
# CHECK-NEXT:  OFFSET TYPE           VALUE
# REL-NEXT:  00002182 R_386_RELATIVE *ABS*{{$}}
# REL-NEXT:  000031f0 R_386_RELATIVE *ABS*{{$}}
# RELA-NEXT: 0000218a R_386_RELATIVE *ABS*+0x31f8{{$}}
# RELA-NEXT: 000031f8 R_386_RELATIVE *ABS*+0x1188{{$}}
# CHECK-NEXT: Contents of section .foobar:
# REL-NEXT:   2180 8b1df031 0000
##                     ^--- VA of GOT entry (0x31f0)
# RELA-NEXT:  2188 8b1d0000 0000
##                     ^--- VA of GOT entry in Elf_Rela addend
# CHECK-NEXT: Contents of section .got:
# REL-NEXT:   31f0 80110000
##                 ^--- VA of foo (0x1180)
# RELA-NEXT:  31f8 00000000
##                 ^--- VA of foo in Elf_Rela addend

# CHECK-LABEL: Disassembly of section .foobar:
# CHECK:     <_start>:
# REL-NEXT:  2180: 8b 1d f0 31 00 00 movl 12784, %ebx
##                       ^--- VA of GOT entry (0x31f0)
# RELA-NEXT: 2188: 8b 1d 00 00 00 00 movl 0, %ebx
##                       ^--- VA of GOT entry in in Elf_Rela addend

foo:

.section .foobar, "awx"
.global _start
_start:
 movl foo@GOT, %ebx