File: mips-n32-rels.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 (59 lines) | stat: -rw-r--r-- 2,293 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
# REQUIRES: mips
# Check handling of N32 ABI relocation records.

# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
# RUN:         -target-abi n32 -o %t.o %s
# RUN: echo "SECTIONS { \
# RUN:         . = 0x20000;  .text ALIGN(0x100) : { *(.text) } \
# RUN:       }" > %t.script
# RUN: ld.lld %t.o -script %t.script -o %t.exe
# RUN: llvm-objdump --no-print-imm-hex -t -d -s --no-show-raw-insn %t.exe | FileCheck %s
# RUN: llvm-readelf -h %t.exe | FileCheck -check-prefix=ELF %s

  .option pic2
  .text
  .type   __start, @function
  .global  __start
__start:
  lui     $gp,%hi(%neg(%gp_rel(__start)))     # R_MIPS_GPREL16
                                              # R_MIPS_SUB
                                              # R_MIPS_HI16
loc:
  daddiu  $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16
                                              # R_MIPS_SUB
                                              # R_MIPS_LO16

  .section  .rodata,"a",@progbits
  .gpword(loc)                                # R_MIPS_GPREL32

# CHECK: 00020104 l    .text   00000000 loc
# CHECK: 00028100 l    .got    00000000 .hidden _gp
# CHECK: 00020100 g  F .text   00000000 __start

# CHECK:      Contents of section .rodata:
# CHECK-NEXT:  {{[0-9a-f]+}} ffff8004
#                            ^-- loc - _gp

# CHECK:      Disassembly of section .text:
# CHECK-EMPTY:
# CHECK-NEXT: <__start>:
# CHECK-NEXT:    20100:  lui     $gp, 1
#                                     ^-- 0x20100 - 0x28100
#                                     ^-- 0 - 0xffff8000
#                                     ^-- %hi(0x8000)
# CHECK:      <loc>:
# CHECK-NEXT:    20104:  daddiu  $gp, $gp, -32768
#                                          ^-- 0x20100 - 0x28100
#                                          ^-- 0 - 0xffff8000
#                                          ^-- %lo(0x8000)

# ELF: Class:                ELF32
# ELF: Data:                 2's complement, big endian
# ELF: Version:              1 (current)
# ELF: OS/ABI:               UNIX - System V
# ELF: ABI Version:          0
# ELF: Type:                 EXEC (Executable file)
# ELF: Machine:              MIPS R3000
# ELF: Version:              0x1
# ELF: Entry point address:  0x20100
# ELF: Flags:                0x60000026, pic, cpic, abi2, mips64