File: mips-64-disp.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 (63 lines) | stat: -rw-r--r-- 2,229 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
55
56
57
58
59
60
61
62
63
# REQUIRES: mips
# Check R_MIPS_GOT_DISP relocations against various kind of symbols.

# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
# RUN:         %p/Inputs/mips-pic.s -o %t.so.o
# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.exe.o
# RUN: ld.lld %t.so.o -shared -soname=t.so -o %t.so
# RUN: ld.lld %t.exe.o %t.so -o %t.exe
# RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.exe | FileCheck %s
# RUN: llvm-readelf -r -s -A %t.exe | FileCheck -check-prefix=GOT %s

# CHECK:      <__start>:
# CHECK-NEXT:    {{.*}}:  addiu   $2, $2, -32704
# CHECK-EMPTY:
# CHECK-NEXT: <b4>:
# CHECK-NEXT:    {{.*}}:  addiu   $2, $2, -32736
# CHECK-EMPTY:
# CHECK-NEXT: <b8>:
# CHECK-NEXT:    {{.*}}:  addiu   $2, $2, -32728
# CHECK-EMPTY:
# CHECK-NEXT: <b12>:
# CHECK-NEXT:    {{.*}}:  addiu   $2, $2, -32720
# CHECK-NEXT:    {{.*}}:  addiu   $2, $2, -32712

# GOT: Symbol table '.symtab'
# GOT: {{.*}} [[B04:[0-9a-f]+]] {{.*}} b4
# GOT: {{.*}} [[FOO:[0-9a-f]+]] {{.*}} foo
# GOT: {{.*}} [[B08:[0-9a-f]+]] {{.*}} b8
# GOT: {{.*}} [[B12:[0-9a-f]+]] {{.*}} b12

# GOT:      Primary GOT:
# GOT-NEXT:  Canonical gp value:
# GOT-EMPTY:
# GOT-NEXT:  Reserved entries:
# GOT-NEXT:  Address     Access          Initial Purpose
# GOT-NEXT:   {{.*}} -32752(gp) 0000000000000000 Lazy resolver
# GOT-NEXT:   {{.*}} -32744(gp) 8000000000000000 Module pointer (GNU extension)
# GOT-EMPTY:
# GOT-NEXT:  Local entries:
# GOT-NEXT:  Address     Access          Initial
# GOT-NEXT:   {{.*}} -32736(gp) [[FOO]]
# GOT-NEXT:   {{.*}} -32728(gp) [[B04]]
# GOT-NEXT:   {{.*}} -32720(gp) [[B08]]
# GOT-NEXT:   {{.*}} -32712(gp) [[B12]]
# GOT-EMPTY:
# GOT-NEXT:  Global entries:
# GOT-NEXT:  Address     Access          Initial         Sym.Val. Type Ndx Name
# GOT-NEXT:   {{.*}} -32704(gp) 0000000000000000 0000000000000000 FUNC UND foo1a

  .text
  .global  __start
__start:
  addiu   $v0,$v0,%got_disp(foo1a)            # R_MIPS_GOT_DISP
b4:
  addiu   $v0,$v0,%got_disp(foo)              # R_MIPS_GOT_DISP
b8:
  addiu   $v0,$v0,%got_disp(.text+4)          # R_MIPS_GOT_DISP
b12:
  addiu   $v0,$v0,%got_disp(.text+8)          # R_MIPS_GOT_DISP
  addiu   $v0,$v0,%got_disp(.text+12)         # R_MIPS_GOT_DISP

foo:
  nop