File: mips-64-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 (47 lines) | stat: -rw-r--r-- 1,877 bytes parent folder | download | duplicates (23)
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
# REQUIRES: mips
# Check handling multiple MIPS N64 ABI relocations packed
# into the single relocation record.

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

# CHECK: 0000000000037ff0 l .got  0000000000000000 .hidden _gp

# CHECK:      Contents of section .rodata:
# CHECK-NEXT:  {{[0-9a-f]+}} ffffffff fffe9014
#                            ^-- 0x21004 - 0x37ff0 = 0xfffffffffffe9014

# CHECK:      <__start>:
# CHECK-NEXT:    21000:  lui     $gp, 0x1
#                                     ^-- 0x21000 - 0x37ff0
#                                     ^-- 0 - 0xffffffffffff9010
#                                     ^-- %hi(0x16ff0)
# CHECK:      <loc>:
# CHECK-NEXT:    21004:  daddiu  $gp, $gp, 0x6ff0
#                                     ^-- 0x21000 - 0x37ff0
#                                     ^-- 0 - 0xfffffffffffe9010
#                                     ^-- %lo(0x16ff0)

# REL:      Relocations [
# REL-NEXT: ]

  .text
  .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
  .gpdword(loc)                               # R_MIPS_GPREL32
                                              # R_MIPS_64