aboutsummaryrefslogtreecommitdiff
path: root/test/old-elf/Mips/rel-dynamic-14.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/rel-dynamic-14.test
parentfb911942f1434f3d1750f83f25f5e42c80e60638 (diff)
downloadsrc-5a5c549fe9a3fef595297bd21d36bed8409dc37d.tar.gz
src-5a5c549fe9a3fef595297bd21d36bed8409dc37d.zip
Vendor import of lld trunk r256633:vendor/lld/lld-trunk-r256633
Notes
Notes: svn path=/vendor/lld/dist/; revision=292934 svn path=/vendor/lld/lld-trunk-r256633/; revision=292935; tag=vendor/lld/lld-trunk-r256633
Diffstat (limited to 'test/old-elf/Mips/rel-dynamic-14.test')
-rw-r--r--test/old-elf/Mips/rel-dynamic-14.test94
1 files changed, 94 insertions, 0 deletions
diff --git a/test/old-elf/Mips/rel-dynamic-14.test b/test/old-elf/Mips/rel-dynamic-14.test
new file mode 100644
index 000000000000..33197ae92b81
--- /dev/null
+++ b/test/old-elf/Mips/rel-dynamic-14.test
@@ -0,0 +1,94 @@
+# Conditions:
+# a) Linking a non-shared 64-bit executable file.
+# b) Relocations' targets are symbols defined in the shared object.
+# Check:
+# a) Emitting R_MIPS_REL32/R_MIPS_64 relocation.
+# b) Applying addendum from the original relocation.
+#
+# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
+# RUN: lld -flavor old-gnu -target mips64el -shared -o %t.so %t-so.o
+# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
+# RUN: lld -flavor old-gnu -target mips64el -e T0 -o %t.exe %t-o.o %t.so
+# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s
+# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s
+
+# RAW: Contents of section .data:
+# RAW-NEXT: 120002000 04000000 00000000
+
+# REL: Relocations [
+# REL-NEXT: Section (5) .rel.dyn {
+# REL-NEXT: 0x120002000 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE T1 0x0
+# REL-NEXT: }
+# REL-NEXT: ]
+
+# so.o
+---
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Size: 4
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+Symbols:
+ Global:
+ - Name: T1
+ Section: .text
+ Type: STT_FUNC
+ Value: 0
+ Size: 4
+
+# o.o
+---
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64]
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Size: 4
+ AddressAlign: 16
+ Flags: [SHF_EXECINSTR, SHF_ALLOC]
+
+- Name: .data
+ Type: SHT_PROGBITS
+ Size: 8
+ AddressAlign: 16
+ Flags: [SHF_WRITE, SHF_ALLOC]
+
+- Name: .rel.data
+ Type: SHT_RELA
+ Info: .data
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0
+ Symbol: T1
+ Type: R_MIPS_64
+ Addend: 4
+
+Symbols:
+ Global:
+ - Name: T0
+ Section: .text
+ Type: STT_FUNC
+ Value: 0
+ Size: 4
+ - Name: T1
+ Type: STT_FUNC
+ - Name: D0
+ Section: .data
+ Type: STT_OBJECT
+ Value: 0
+ Size: 4
+...