File: mips-xgot-order.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 (52 lines) | stat: -rw-r--r-- 1,637 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
# REQUIRES: mips
# Check that GOT entries accessed via 16-bit indexing are allocated
# in the beginning of the GOT.

# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t.exe
# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.exe | FileCheck %s
# RUN: llvm-readelf -s -A %t.exe | FileCheck -check-prefix=GOT %s

# CHECK:      Disassembly of section .text:
# CHECK-EMPTY:
# CHECK-NEXT: <__start>:
# CHECK-NEXT:    lui     $2, 0
# CHECK-NEXT:    lw      $2, -32732($2)
# CHECK-NEXT:    lui     $2, 0
# CHECK-NEXT:    lw      $2, -32728($2)
#
# CHECK:      <bar>:
# CHECK-NEXT:    lw      $2, -32736($2)
# CHECK-NEXT:    lw      $2, -32744($2)
# CHECK-NEXT:    addi    $2, $2, {{.*}}

# GOT: Symbol table '.symtab'
# GOT:    Num:               Value  Size Type    Bind   Vis       Ndx Name
# GOT:           [[LOC:[0-9a-f]+]]     0 NOTYPE  LOCAL  DEFAULT     4 loc
# GOT:         [[START:[0-9a-f]+]]     0 NOTYPE  GLOBAL DEFAULT     3 __start
# GOT:           [[BAR:[0-9a-f]+]]     0 NOTYPE  GLOBAL DEFAULT     3 bar

# GOT:      Static GOT:
# GOT:       Local entries:
# GOT:         Address     Access  Initial
# GOT-NEXT:            -32744(gp) 00030000
# GOT-NEXT:            -32740(gp) 00040000
# GOT-NEXT:            -32736(gp) [[BAR]]
# GOT-NEXT:            -32732(gp) [[START]]
# GOT-NEXT:            -32728(gp) [[LOC]]

  .text
  .global __start, bar
__start:
  lui   $2, %got_hi(__start)
  lw    $2, %got_lo(__start)($2)
  lui   $2, %got_hi(loc)
  lw    $2, %got_lo(loc)($2)
bar:
  lw    $2, %got(bar)($2)
  lw    $2, %got(loc)($2)
  addi  $2, $2, %lo(loc)

  .data
loc:
  .word 0