1# REQUIRES: mips
2# Check handling multiple MIPS N64 ABI relocations packed
3# into the single relocation record.
4
5# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o
6# RUN: echo "SECTIONS { \
7# RUN:         . = 0x20000; .text ALIGN(0x1000) : { *(.text) } \
8# RUN:         . = 0x30000; .got : { *(.got)  } \
9# RUN:       }" > %t.script
10# RUN: ld.lld %t.o --script %t.script -o %t.exe
11# RUN: llvm-objdump -d -s -t --print-imm-hex --no-show-raw-insn %t.exe | FileCheck %s
12# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s
13
14# CHECK: 0000000000037ff0 l .got  0000000000000000 .hidden _gp
15
16# CHECK:      Contents of section .rodata:
17# CHECK-NEXT:  {{[0-9a-f]+}} ffffffff fffe9014
18#                            ^-- 0x21004 - 0x37ff0 = 0xfffffffffffe9014
19
20# CHECK:      <__start>:
21# CHECK-NEXT:    21000:  lui     $gp, 0x1
22#                                     ^-- 0x21000 - 0x37ff0
23#                                     ^-- 0 - 0xffffffffffff9010
24#                                     ^-- %hi(0x16ff0)
25# CHECK:      <loc>:
26# CHECK-NEXT:    21004:  daddiu  $gp, $gp, 0x6ff0
27#                                     ^-- 0x21000 - 0x37ff0
28#                                     ^-- 0 - 0xfffffffffffe9010
29#                                     ^-- %lo(0x16ff0)
30
31# REL:      Relocations [
32# REL-NEXT: ]
33
34  .text
35  .global  __start
36__start:
37  lui     $gp,%hi(%neg(%gp_rel(__start)))     # R_MIPS_GPREL16
38                                              # R_MIPS_SUB
39                                              # R_MIPS_HI16
40loc:
41  daddiu  $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16
42                                              # R_MIPS_SUB
43                                              # R_MIPS_LO16
44
45  .section  .rodata,"a",@progbits
46  .gpdword(loc)                               # R_MIPS_GPREL32
47                                              # R_MIPS_64
48