summaryrefslogtreecommitdiff
path: root/test/old-elf/Mips/rel-64.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/Mips/rel-64.test')
-rw-r--r--test/old-elf/Mips/rel-64.test61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/old-elf/Mips/rel-64.test b/test/old-elf/Mips/rel-64.test
new file mode 100644
index 0000000000000..c97ff991c0c44
--- /dev/null
+++ b/test/old-elf/Mips/rel-64.test
@@ -0,0 +1,61 @@
+# Check handling of R_MIPS_64 relocation.
+
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: lld -flavor old-gnu -target mips64el -o %t.exe %t.o
+# RUN: llvm-objdump -s -t %t.exe | FileCheck %s
+
+# CHECK: Contents of section .data:
+# CHECK-NEXT: 120002000 d1010020 01000000 d0010020 01000100 ... ....... ....
+# ^^ __start + 1 = 0x1200001d1
+# ^^ __start + 0x1000000000000
+# = 0x10001200001d0
+# CHECK: SYMBOL TABLE:
+# CHECK: 00000001200001d0 g .rodata 00000008 __start
+
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Size: 0x08
+ AddressAlign: 16
+ Flags: [SHF_ALLOC]
+- Name: .data
+ Type: SHT_PROGBITS
+ Size: 0x10
+ AddressAlign: 16
+ Flags: [SHF_ALLOC, SHF_WRITE]
+
+- Name: .rela.data
+ Type: SHT_RELA
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x0
+ Symbol: __start
+ Type: R_MIPS_64
+ Addend: 1
+ - Offset: 0x8
+ Symbol: __start
+ Type: R_MIPS_64
+ Addend: 0x1000000000000
+
+Symbols:
+ Global:
+ - Name: __start
+ Section: .text
+ Value: 0x0
+ Size: 8
+ - Name: data1
+ Section: .data
+ Value: 0x0
+ Size: 8
+ - Name: data2
+ Section: .data
+ Value: 0x8
+ Size: 8