1// Check generation of N32 ABI relocations.
2
3// RUN: llvm-mc -filetype=obj -triple=mips64-linux-gnu -mcpu=mips3 \
4// RUN:         -target-abi=n32  %s -o - | llvm-readobj -r - | FileCheck %s
5// RUN: llvm-mc -filetype=obj -triple=mips64-linux-gnuabin32 -mcpu=mips3 \
6// RUN:          %s -o - | llvm-readobj -r - | FileCheck %s
7// RUN: llvm-mc -filetype=obj -triple=mipsn32 -mcpu=mips3 \
8// RUN:          %s -o - | llvm-readobj -r - | FileCheck %s
9
10// CHECK:      Relocations [
11// CHECK-NEXT:   Section (3) .rela.text {
12// CHECK-NEXT:     0x0 R_MIPS_GPREL16 foo 0x4
13// CHECK-NEXT:     0x0 R_MIPS_SUB - 0x0
14// CHECK-NEXT:     0x0 R_MIPS_HI16 - 0x0
15// CHECK-NEXT:     0x4 R_MIPS_GPREL16 foo 0x4
16// CHECK-NEXT:     0x4 R_MIPS_SUB - 0x0
17// CHECK-NEXT:     0x4 R_MIPS_LO16 - 0x0
18// CHECK-NEXT:   }
19
20  .globl  foo
21  .ent  foo
22foo:
23  lui   $gp, %hi(%neg(%gp_rel(foo+4)))
24  addiu $gp, $gp, %lo(%neg(%gp_rel(foo+4)))
25  daddu $gp, $gp, $25
26  .end  foo
27