[Mips] Add test case to check R_MIPS_HI16 / R_MIPS_LO16 relocations

agains _gp_disp symbol.

llvm-svn: 199232
This commit is contained in:
Simon Atanasyan 2014-01-14 18:18:56 +00:00
parent 2a1ae098b3
commit a0f5caac26
1 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
# Check handling of HI16 and LO16 relocations against _gp_disp symbol.
# RUN: llvm-mc -triple=mipsel -filetype=obj -o=%t1 %s
# RUN: lld -flavor gnu -target mipsel -shared -o %t2 %t1
# RUN: llvm-objdump -section-headers -t -disassemble %t2 | FileCheck %s
# CHECK: Disassembly of section .text:
# CHECK: glob1:
# CHECK: 134: 01 00 01 8c lw $1, 1($zero)
# CHECK: 138: 01 00 02 8c lw $2, 1($zero)
# CHECK: 13c: b8 8e 21 24 addiu $1, $1, -29000
# CHECK: 140: 01 00 01 8c lw $1, 1($zero)
# CHECK: 144: 01 00 02 8c lw $2, 1($zero)
# CHECK: 148: ac 8e 21 24 addiu $1, $1, -29012
# CHECK: Sections:
# CHECK: Idx Name Size Address Type
# CHECK: 4 .text 00000018 0000000000000134 TEXT DATA
# CHECK: 6 .got 00000008 0000000000001000 DATA
# CHECK: SYMBOL TABLE:
# CHECK: 00000134 g F .text 0000000c glob1
# CHECK: 00000140 g F .text 0000000c glob2
# CHECK: 00001000 g *ABS* 00000000 _GLOBAL_OFFSET_TABLE_
# CHECK: 00008ff0 g *ABS* 00000000 _gp_disp
.global glob1
.ent glob1
glob1:
lw $1,%hi(_gp_disp) # (.got + 0x7ff0 - (.glob1 + 0) + 0x8000) >> 16
lw $2,%hi(_gp_disp) # (.got + 0x7ff0 - (.glob1 + 4) + 0x8000) >> 16
addiu $1,$1,%lo(_gp_disp) # .got + 0x7ff0 - (.glob1 + 8) + 4
.end glob1
.global glob2
.ent glob2
glob2:
lw $1,%hi(_gp_disp) # (.got + 0x7ff0 - (.glob2 + 0) + 0x8000) >> 16
lw $2,%hi(_gp_disp) # (.got + 0x7ff0 - (.glob2 + 4) + 0x8000) >> 16
addiu $1,$1,%lo(_gp_disp) # .got + 0x7ff0 - (.glob2 + 8) + 4
.end glob2