aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/testsuite/ChangeLog9
-rw-r--r--ld/testsuite/ld-mips-elf/emrelocs-eb.d25
-rw-r--r--ld/testsuite/ld-mips-elf/emrelocs-el.d25
-rw-r--r--ld/testsuite/ld-mips-elf/emrelocs.ld16
-rw-r--r--ld/testsuite/ld-mips-elf/emrelocs1.s23
-rw-r--r--ld/testsuite/ld-mips-elf/emrelocs2.s30
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp4
7 files changed, 132 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 720fe8e..2035cbc 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2002-01-29 Chris Demetriou <cgd@broadcom.com>
+
+ * ld-mips-elf/emrelocs-eb.d: New file to test --embedded-relocs.
+ * ld-mips-elf/emrelocs-el.d: Likewise.
+ * ld-mips-elf/emrelocs1.s: Likewise.
+ * ld-mips-elf/emrelocs2.s: Likewise.
+ * ld-mips-elf/emrelocs.ld: Likewise.
+ * ld-mips-elf/mips-elf.exp: Add the above to the list of tests.
+
2002-01-21 Hans-Peter Nilsson <hp@axis.com>
* ld-cris: New testsuite directory.
diff --git a/ld/testsuite/ld-mips-elf/emrelocs-eb.d b/ld/testsuite/ld-mips-elf/emrelocs-eb.d
new file mode 100644
index 0000000..dd79bdd
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/emrelocs-eb.d
@@ -0,0 +1,25 @@
+#name: MIPS 32-bit ELF embedded relocs (big endian)
+#source: emrelocs1.s -EB
+#source: emrelocs2.s -EB
+#ld: -EB --embedded-relocs -T $srcdir/$subdir/emrelocs.ld
+#objdump: -s
+
+.*: file format elf.*mips.*
+
+Contents of section \.text:
+ 100000 00000000 00000001 00000000 00000000 .*
+ 100010 00000000 00000000 00000003 00000000 .*
+Contents of section \.data:
+ 200000 00000000 00000002 00000000 00000000 .*
+ 200010 00000000 00000000 00000004 00000000 .*
+ 200020 00100004 00200004 00100018 00200018 .*
+ 200030 00000000 00100004 00000000 00200004 .*
+ 200040 00000000 00100018 00000000 00200018 .*
+Contents of section \.rel\.sdata:
+ 300000 00000020 2e746578 74000000 00000024 .*
+ 300010 2e646174 61000000 00000028 2e746578 .*
+ 300020 74000000 0000002c 2e646174 61000000 .*
+ 300030 00000031 2e746578 74000000 00000039 .*
+ 300040 2e646174 61000000 00000041 2e746578 .*
+ 300050 74000000 00000049 2e646174 61000000 .*
+#pass
diff --git a/ld/testsuite/ld-mips-elf/emrelocs-el.d b/ld/testsuite/ld-mips-elf/emrelocs-el.d
new file mode 100644
index 0000000..ad1e495
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/emrelocs-el.d
@@ -0,0 +1,25 @@
+#name: MIPS 32-bit ELF embedded relocs (little endian)
+#source: emrelocs1.s -EL
+#source: emrelocs2.s -EL
+#ld: -EL --embedded-relocs -T $srcdir/$subdir/emrelocs.ld
+#objdump: -s
+
+.*: file format elf.*mips.*
+
+Contents of section \.text:
+ 100000 00000000 01000000 00000000 00000000 .*
+ 100010 00000000 00000000 03000000 00000000 .*
+Contents of section \.data:
+ 200000 00000000 02000000 00000000 00000000 .*
+ 200010 00000000 00000000 04000000 00000000 .*
+ 200020 04001000 04002000 18001000 18002000 .*
+ 200030 04001000 00000000 04002000 00000000 .*
+ 200040 18001000 00000000 18002000 00000000 .*
+Contents of section \.rel\.sdata:
+ 300000 20000000 2e746578 74000000 24000000 .*
+ 300010 2e646174 61000000 28000000 2e746578 .*
+ 300020 74000000 2c000000 2e646174 61000000 .*
+ 300030 31000000 2e746578 74000000 39000000 .*
+ 300040 2e646174 61000000 41000000 2e746578 .*
+ 300050 74000000 49000000 2e646174 61000000 .*
+#pass
diff --git a/ld/testsuite/ld-mips-elf/emrelocs.ld b/ld/testsuite/ld-mips-elf/emrelocs.ld
new file mode 100644
index 0000000..557f139
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/emrelocs.ld
@@ -0,0 +1,16 @@
+ENTRY(ext_fun)
+SECTIONS
+{
+ .text 0x00100000:
+ {
+ *(.text)
+ }
+ .data 0x00200000:
+ {
+ *(.sdata)
+ }
+ .rel.sdata 0x00300000:
+ {
+ *(.rel.sdata)
+ }
+}
diff --git a/ld/testsuite/ld-mips-elf/emrelocs1.s b/ld/testsuite/ld-mips-elf/emrelocs1.s
new file mode 100644
index 0000000..3e679ae
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/emrelocs1.s
@@ -0,0 +1,23 @@
+# emrelocs1.s: some external symbols to be used in relocations.
+
+ .text
+ .p2align 4
+
+ # Pad things so addresses which are used for relocations
+ # are non-zero. Zero simply isn't as much fun.
+ .word 0
+
+ .globl ext_fun
+ .ent ext_fun
+ext_fun: .word 1
+ .end ext_fun
+
+
+ .sdata
+ .p2align 4
+
+ # Padding here, for same reason.
+ .word 0
+
+ .globl ext_var
+ext_var: .word 2
diff --git a/ld/testsuite/ld-mips-elf/emrelocs2.s b/ld/testsuite/ld-mips-elf/emrelocs2.s
new file mode 100644
index 0000000..77570f1
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/emrelocs2.s
@@ -0,0 +1,30 @@
+# emrelocs2.s: local symbols and data which causes relocations.
+
+ .text
+ .p2align 4
+
+ .word 0, 0
+
+ .ent lcl_fun
+lcl_fun: .word 3
+ .end lcl_fun
+
+
+ .sdata
+ .p2align 4
+
+ .word 0, 0
+
+lcl_var: .word 4
+
+ .p2align 4
+
+ .word ext_fun
+ .word ext_var
+ .word lcl_fun
+ .word lcl_var
+
+ .dword ext_fun
+ .dword ext_var
+ .dword lcl_fun
+ .dword lcl_var
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index b47b326..3c4e79f 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -34,5 +34,9 @@ if { [istarget mips*-*-*] } then {
run_dump_test "empic2-fwd-1"
run_dump_test "empic2-rev-0"
run_dump_test "empic2-rev-1"
+
+ # Check generation of embedded relocs section.
+ run_dump_test "emrelocs-eb"
+ run_dump_test "emrelocs-el"
}
}