File: mips-xgot-order.s

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (52 lines) | stat: -rw-r--r-- 1,637 bytes parent folder | download | duplicates (17)
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