summaryrefslogtreecommitdiff
path: root/test/elf/Mips/hilo16-1.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/elf/Mips/hilo16-1.test')
-rw-r--r--test/elf/Mips/hilo16-1.test44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/elf/Mips/hilo16-1.test b/test/elf/Mips/hilo16-1.test
new file mode 100644
index 0000000000000..c2863408c888d
--- /dev/null
+++ b/test/elf/Mips/hilo16-1.test
@@ -0,0 +1,44 @@
+# REQUIRES: mips
+
+# Check handling multiple HI16 relocation followed by a single LO16 relocation.
+#
+# RUN: llvm-mc -triple=mipsel -filetype=obj -o=%t-obj %s
+# RUN: lld -flavor gnu -target mipsel -e glob1 -o %t-exe %t-obj
+# RUN: llvm-objdump -t -disassemble %t-exe | FileCheck %s
+
+# CHECK: Disassembly of section .text:
+# CHECK: glob1:
+# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64
+# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64
+# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64
+# CHECK-NEXT: {{[0-9a-f]+}}: 40 00 08 3c lui $8, 64
+# CHECK-NEXT: {{[0-9a-f]+}}: 42 00 08 3c lui $8, 66
+# CHECK-NEXT: {{[0-9a-f]+}}: 3e 00 08 3c lui $8, 62
+# CHECK-NEXT: {{[0-9a-f]+}}: 40 02 08 3c lui $8, 576
+# CHECK-NEXT: {{[0-9a-f]+}}: 40 fe 08 3c lui $8, 65088
+# CHECK-NEXT: {{[0-9a-f]+}}: 55 01 08 85 lh $8, 341($8)
+
+# CHECK: SYMBOL TABLE:
+# CHECK: {{[0-9a-f]+}} g F .text 00000024 glob1
+# CHECK: {{[0-9a-f]+}} g F .text 00000004 glob2
+
+ .global glob1
+ .ent glob1
+glob1:
+ lui $t0,%hi(glob2+0x1)
+ lui $t0,%hi(glob2+(-0x1))
+ lui $t0,%hi(glob2+0x1ff)
+ lui $t0,%hi(glob2+(-0x1ff))
+ lui $t0,%hi(glob2+0x1ffff)
+ lui $t0,%hi(glob2+(-0x1ffff))
+ lui $t0,%hi(glob2+0x1ffffff)
+ lui $t0,%hi(glob2+(-0x1ffffff))
+
+ lh $t0,%lo(glob2+(-0x1ffffff))($t0)
+ .end glob1
+
+ .global glob2
+ .ent glob2
+glob2:
+ nop
+ .end glob2