File: mips-hilo.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,558 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 R_MIPS_HI16 / LO16 relocations calculation.

# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
# RUN: echo "SECTIONS { . = 0x20000; .text ALIGN(0x1000) : { *(.text) } }" > %t.script
# RUN: ld.lld %t.o --script %t.script -o %t.exe
# RUN: llvm-objdump --no-print-imm-hex -d -t --no-show-raw-insn %t.exe | FileCheck %s

  .text
  .globl  __start
__start:
  lui    $t0,%hi(__start)
  lui    $t1,%hi(g1)
  addi   $t0,$t0,%lo(__start+4)
  addi   $t0,$t0,%lo(g1+8)

  lui    $t0,%hi(l1+0x10000)
  lui    $t1,%hi(l1+0x20000)
  addi   $t0,$t0,%lo(l1+(-4))

  .data
  .type  l1,@object
  .size  l1,4
l1:
  .word 0

  .globl g1
  .type  g1,@object
  .size  g1,4
g1:
  .word 0

# CHECK: SYMBOL TABLE:
# CHECK: 0021020 l     O .data   00000004 l1
# CHECK: 0021000 g       .text   00000000 __start
# CHECK: 0021024 g     O .data   00000004 g1

# CHECK:      <__start>:
# CHECK-NEXT:  21000:   lui    $8, 2
#                                  ^-- %hi(__start+4)
# CHECK-NEXT:  21004:   lui    $9, 2
#                                  ^-- %hi(g1+8)
# CHECK-NEXT:  21008:   addi   $8, $8, 4100
#                                      ^-- %lo(__start+4)
# CHECK-NEXT:  2100c:   addi   $8, $8, 4140
#                                      ^-- %lo(g1+8)
# CHECK-NEXT:  21010:   lui    $8, 3
#                                  ^-- %hi(l1+0x10000-4)
# CHECK-NEXT:  21014:   lui    $9, 4
#                                  ^-- %hi(l1+0x20000-4)
# CHECK-NEXT:  21018:   addi   $8, $8, 4124
#                                      ^-- %lo(l1-4)