llvm-project/lld/test/elf/Mips/hilo16-1.test

41 lines
1.6 KiB
Plaintext

# 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