xref: /llvm-project/lld/test/ELF/mips-64-gprel-so.s (revision ff2172c9f4a089f740993f21465be03cdcc42046)
1# REQUIRES: mips
2# Check setup of GP relative offsets in a function's prologue.
3
4# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t.o
5# RUN: echo "SECTIONS { foo = 0x2000; _gp = 0x3000; }" > %t.script
6# RUN: ld.lld %t.o --script %t.script -shared -o %t.so
7# RUN: llvm-objdump -d -t --print-imm-hex --no-show-raw-insn %t.so | FileCheck %s
8
9# CHECK:      {{.*}}  lui     $gp, 0x0
10# CHECK-NEXT: {{.*}}  daddu   $gp, $gp, $25
11# CHECK-NEXT: {{.*}}  daddiu  $gp, $gp, 0x1000
12
13  .text
14  lui     $gp,%hi(%neg(%gp_rel(foo)))
15  daddu   $gp,$gp,$t9
16  daddiu  $gp,$gp,%lo(%neg(%gp_rel(foo)))
17