[lld] r199232 - [Mips] Add test case to check R_MIPS_HI16 / R_MIPS_LO16 relocations
Simon Atanasyan
simon at atanasyan.com
Tue Jan 14 10:18:56 PST 2014
Author: atanasyan
Date: Tue Jan 14 12:18:56 2014
New Revision: 199232
URL: http://llvm.org/viewvc/llvm-project?rev=199232&view=rev
Log:
[Mips] Add test case to check R_MIPS_HI16 / R_MIPS_LO16 relocations
agains _gp_disp symbol.
Added:
lld/trunk/test/elf/Mips/hilo16-1.test
Added: lld/trunk/test/elf/Mips/hilo16-1.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/hilo16-1.test?rev=199232&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/hilo16-1.test (added)
+++ lld/trunk/test/elf/Mips/hilo16-1.test Tue Jan 14 12:18:56 2014
@@ -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
More information about the llvm-commits
mailing list