2002-01-29 Chris Demetriou <cgd@broadcom.com>
authorChris Demetriou <cgd@google.com>
Wed, 30 Jan 2002 02:20:13 +0000 (02:20 +0000)
committerChris Demetriou <cgd@google.com>
Wed, 30 Jan 2002 02:20:13 +0000 (02:20 +0000)
        * 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.

ld/testsuite/ChangeLog
ld/testsuite/ld-mips-elf/emrelocs-eb.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/emrelocs-el.d [new file with mode: 0644]
ld/testsuite/ld-mips-elf/emrelocs.ld [new file with mode: 0644]
ld/testsuite/ld-mips-elf/emrelocs1.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/emrelocs2.s [new file with mode: 0644]
ld/testsuite/ld-mips-elf/mips-elf.exp

index 720fe8e61896e1c7b799b64cb5de5d51c213a4be..2035cbc5338138391f6cd20d1b89fb8b7ca0c622 100644 (file)
@@ -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 (file)
index 0000000..dd79bdd
--- /dev/null
@@ -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 (file)
index 0000000..ad1e495
--- /dev/null
@@ -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 (file)
index 0000000..557f139
--- /dev/null
@@ -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 (file)
index 0000000..3e679ae
--- /dev/null
@@ -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 (file)
index 0000000..77570f1
--- /dev/null
@@ -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
index b47b32628f87b1f49776e2d62ddca5f291edc61b..3c4e79f1f56766c012290b5b5552e82eca9e2031 100644 (file)
@@ -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"
     }
 }