• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// This addresses bug 14456. We were not writing
2// out the addend to the gprel16 relocation. The
3// addend is stored in the instruction immediate
4// field.
5
6// RUN: llvm-mc -mcpu=mips32r2 -triple=mipsel-pc-linux -filetype=obj %s -o - \
7// RUN: | llvm-objdump -d - | FileCheck %s
8// RUN: llvm-mc -mcpu=mips32r2 -triple=mips-pc-linux -filetype=obj %s -o - \
9// RUN: | llvm-objdump -d - | FileCheck %s
10
11	.text
12	.abicalls
13	.option	pic0
14	.section	.mdebug.abi32,"",@progbits
15	.file	"/home/espindola/llvm/llvm/test/MC/Mips/mips_gprel16.ll"
16	.text
17	.globl	testvar1
18	.align	2
19	.type	testvar1,@function
20	.set	nomips16
21	.ent	testvar1
22testvar1:                               # @testvar1
23	.frame	$sp,0,$ra
24	.mask 	0x00000000,0
25	.fmask	0x00000000,0
26	.set	noreorder
27	.set	nomacro
28	.set	noat
29# %bb.0:                                # %entry
30// CHECK: lw ${{[0-9]+}}, 0($gp)
31	lw	$1, %gp_rel(var1)($gp)
32	jr	$ra
33	sltu	$2, $zero, $1
34	.set	at
35	.set	macro
36	.set	reorder
37	.end	testvar1
38$tmp0:
39	.size	testvar1, ($tmp0)-testvar1
40
41	.globl	testvar2
42	.align	2
43	.type	testvar2,@function
44	.set	nomips16
45	.ent	testvar2
46testvar2:                               # @testvar2
47	.frame	$sp,0,$ra
48	.mask 	0x00000000,0
49	.fmask	0x00000000,0
50	.set	noreorder
51	.set	nomacro
52	.set	noat
53# %bb.0:                                # %entry
54// CHECK: lw ${{[0-9]+}}, 4($gp)
55	lw	$1, %gp_rel(var2)($gp)
56	jr	$ra
57	sltu	$2, $zero, $1
58	.set	at
59	.set	macro
60	.set	reorder
61	.end	testvar2
62$tmp1:
63	.size	testvar2, ($tmp1)-testvar2
64
65	.type	var1,@object            # @var1
66	.local	var1
67	.comm	var1,4,4
68	.type	var2,@object            # @var2
69	.local	var2
70	.comm	var2,4,4
71
72