summaryrefslogtreecommitdiff
path: root/test/old-elf/Mips/hilo16-3.test
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
commit5a5c549fe9a3fef595297bd21d36bed8409dc37d (patch)
treea964c8f5ac85b7b641cac022c5f9bf4eed3d2b9b /test/old-elf/Mips/hilo16-3.test
parentfb911942f1434f3d1750f83f25f5e42c80e60638 (diff)
Notes
Diffstat (limited to 'test/old-elf/Mips/hilo16-3.test')
-rw-r--r--test/old-elf/Mips/hilo16-3.test74
1 files changed, 74 insertions, 0 deletions
diff --git a/test/old-elf/Mips/hilo16-3.test b/test/old-elf/Mips/hilo16-3.test
new file mode 100644
index 000000000000..17873c0a629c
--- /dev/null
+++ b/test/old-elf/Mips/hilo16-3.test
@@ -0,0 +1,74 @@
+# Check handling of HI16 and LO16 relocations for _gp_disp.
+#
+# R_MIPS_HI16: (AHL + GP - P) - (short)(AHL + GP - P)
+# R_MIPS_LO16: AHL + GP - P + 4
+# where AHL = (AHI << 16) + ALO
+
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o
+# RUN: llvm-objdump -s -t %t.so | FileCheck %s
+
+# CHECK: Contents of section .text:
+# CHECK-NEXT: 00d0 0100083c 218f0885 0100083c 178f0885
+# CHECK-NEXT: 00e0 0100083c 0f910885 0100083c 098d0885
+# CHECK-NEXT: 00f0 0200083c ffff0885
+
+# CHECK: SYMBOL TABLE:
+# CHECK: 000000d0 g F .text 00000028 T0
+# CHECK: 00008ff0 g *ABS* 00000000 _gp_disp
+
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000083C010008850000083CFFFF08850000083CFF0108850000083C01FE08850200083CFFFF0885"
+# ^ %hi(gp+1) ^ %hi(gp-1) ^ %hi(gp+0x1ff) ^ %hi(gp-0x1ff) ^ %lo(gp+0x1ffff)
+# ^ %lo(gp+1) ^ %lo(gp-1) ^ %lo(gp+0x1ff) ^ %lo(gp-0x1ff)
+# ^ %hi(gp+0x1ffff)
+ AddressAlign: 16
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x0
+ Symbol: _gp_disp
+ Type: R_MIPS_HI16
+ - Offset: 0x4
+ Symbol: _gp_disp
+ Type: R_MIPS_LO16
+ - Offset: 0x8
+ Symbol: _gp_disp
+ Type: R_MIPS_HI16
+ - Offset: 0xC
+ Symbol: _gp_disp
+ Type: R_MIPS_LO16
+ - Offset: 0x10
+ Symbol: _gp_disp
+ Type: R_MIPS_HI16
+ - Offset: 0x14
+ Symbol: _gp_disp
+ Type: R_MIPS_LO16
+ - Offset: 0x18
+ Symbol: _gp_disp
+ Type: R_MIPS_HI16
+ - Offset: 0x1C
+ Symbol: _gp_disp
+ Type: R_MIPS_LO16
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0
+ Size: 80
+ - Name: _gp_disp