ld/testsuite:
authorHans-Peter Nilsson <hp@bitrange.com>
Thu, 1 May 2014 22:31:58 +0000 (00:31 +0200)
committerHans-Peter Nilsson <hp@bitrange.com>
Thu, 1 May 2014 22:31:58 +0000 (00:31 +0200)
* ld-mmix/sec-11.d, ld-mmix/sec-11.ld, ld-mmix/sec-10.s,
ld-mmix/sec-10.d, ld-mmix/b-offlocmis.s, ld-mmix/sec-12.d: New
tests.
* ld-mmix/b-offloc.s: Correct address in comment.

ld/testsuite/ChangeLog
ld/testsuite/ld-mmix/b-offloc.s
ld/testsuite/ld-mmix/b-offlocmis.s [new file with mode: 0644]
ld/testsuite/ld-mmix/sec-10.d [new file with mode: 0644]
ld/testsuite/ld-mmix/sec-10.s [new file with mode: 0644]
ld/testsuite/ld-mmix/sec-11.d [new file with mode: 0644]
ld/testsuite/ld-mmix/sec-11.ld [new file with mode: 0644]
ld/testsuite/ld-mmix/sec-12.d [new file with mode: 0644]

index 678ae078f009ad88d8466a7f9364168888a1749b..cc292979d7a66249c780ad3f3c3b01ba488117a1 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-01  Hans-Peter Nilsson  <hp@bitrange.com>
+
+       * ld-mmix/sec-11.d, ld-mmix/sec-11.ld, ld-mmix/sec-10.s,
+       ld-mmix/sec-10.d, ld-mmix/b-offlocmis.s, ld-mmix/sec-12.d: New
+       tests.
+       * ld-mmix/b-offloc.s: Correct address in comment.
+
 2014-04-23  Will Newton  <will.newton@linaro.org>
 
        * ld-arm/arm-no-rel-plt.ld: Remove OUTPUT_FORMAT and
index c2fb2cc3b471a9d8183be643910bc611a2425bf3..1114b34069f561199abbe8049a9a8a9b147b614f 100644 (file)
@@ -1,6 +1,6 @@
 % The .text contents is supposed to be linked --oformat binary with
 % b-post1.s and b-goodmain.s.  The code below will provide a LOP_LOC
-% with a 64-bit address (0x789abcdef0123456) then 16 bytes of % random data.
+% with a 64-bit address (0x789abcdef0123458) then 16 bytes of % random data.
 
  .text
  .byte 0x98,1,0,2
diff --git a/ld/testsuite/ld-mmix/b-offlocmis.s b/ld/testsuite/ld-mmix/b-offlocmis.s
new file mode 100644 (file)
index 0000000..4f2b340
--- /dev/null
@@ -0,0 +1,17 @@
+% The .text contents is supposed to be linked --oformat binary with
+% b-post1.s and b-goodmain.s.  The code below will provide a LOP_LOC
+% with a 64-bit address (0x789abcdef012345b) then 16 bytes of % random
+% data.  Note that the address is misaligned and the contents should
+% be handled as at 0x789abcdef0123458.  After that, there's another
+% LOP_LOC, about 32 bytes further on, also at a misaligned address:
+% this time the data (0x12345677) is entered with a LOP_QUOTE.
+
+ .text
+ .byte 0x98,1,0,2
+ .8byte 0x789abcdef012345b
+ .byte 0xb0,0x45,0x19,0x7d,0x2c,0x1b,0x3,0xb2
+ .byte 0xe4,0xdb,0xf8,0x77,0xf,0xc7,0x66,0xfb
+ .byte 0x98,1,0,2
+ .8byte 0x789abcdef012347a
+ .byte 0x98,0,0,1
+ .byte 0x12,0x34,0x56,0x77
diff --git a/ld/testsuite/ld-mmix/sec-10.d b/ld/testsuite/ld-mmix/sec-10.d
new file mode 100644 (file)
index 0000000..a1c558d
--- /dev/null
@@ -0,0 +1,18 @@
+#source: start.s
+#source: sec-10.s
+#ld: -m mmo
+#objdump: -s
+
+# There was yet another bug in the strip-zeros-at-beginning-and-end-of-data
+# code: it requires outputting the location when data is stripped, and that
+# location is only valid for tetra alignments as the low bits are ignored.
+
+.*:     file format mmo
+
+Contents of section \.text:
+ 0*0 e3fd0001 2a000000 00000000 00000000  .*
+ 0*10 00000000 00000000 00000000 00000000  .*
+#...
+ 0*7ff0 00000000 00000000 00000000 00000000  .*
+ 0*8000 00000000 00000000 00000000 2b2c0000  .*
+
diff --git a/ld/testsuite/ld-mmix/sec-10.s b/ld/testsuite/ld-mmix/sec-10.s
new file mode 100644 (file)
index 0000000..2729e55
--- /dev/null
@@ -0,0 +1,8 @@
+ .section .text.1
+ .byte 42
+ .byte 0,0,0,0,  0,0,0,0,  0,0,0,0
+
+ .section .text.2
+ .space 32752
+ .byte 0,0,0,0,  0,0,0,0,  0,0,0 
+ .byte 43,44,0,0
diff --git a/ld/testsuite/ld-mmix/sec-11.d b/ld/testsuite/ld-mmix/sec-11.d
new file mode 100644 (file)
index 0000000..3a60934
--- /dev/null
@@ -0,0 +1,7 @@
+#source: start.s
+#ld: -m mmo -T$srcdir/$subdir/sec-11.ld
+#error: contents at non-multiple-of-4 address
+
+# A trivial check that we get a graceful error when trying to emit
+# (loadable, addressable) contents at a misaligned address.  Note
+# that e.g. debug sections do not have loadable contents.
diff --git a/ld/testsuite/ld-mmix/sec-11.ld b/ld/testsuite/ld-mmix/sec-11.ld
new file mode 100644 (file)
index 0000000..a36ca1e
--- /dev/null
@@ -0,0 +1,10 @@
+OUTPUT_ARCH(mmix)
+ENTRY(Main)
+SECTIONS
+{
+  .text 0x101 : /* Note the misaligned address; must trig a linker error.  */
+  { *(.text*); Main = _start; }
+
+  .MMIX.reg_contents :
+  { *(.MMIX.reg_contents.linker_allocated); *(.MMIX.reg_contents); }
+}
diff --git a/ld/testsuite/ld-mmix/sec-12.d b/ld/testsuite/ld-mmix/sec-12.d
new file mode 100644 (file)
index 0000000..720789e
--- /dev/null
@@ -0,0 +1,26 @@
+#source: b-twoinsn.s
+#source: b-offlocmis.s
+#source: b-post1.s
+#source: b-goodmain.s
+#ld: --oformat binary
+#objdump: -sh
+
+# Check that a LOP_LOC at a misaligned location followed by a
+# LOP_QUOTE hits the corresponding aligned address.  This is a
+# variant of sec-5.d with the lop_loc having a misalignment, followed
+# by another misaligned lop_loc with a lop_quot.
+
+.*:     file format mmo
+
+Sections:
+Idx Name          Size      VMA               LMA               File off  Algn
+  0 \.text         0+8  0+  0+  0+  2\*\*2
+                  CONTENTS, ALLOC, LOAD, CODE
+  1 \.MMIX\.sec\.0   0+24  789abcdef0123458  789abcdef0123458  0+  2\*\*2
+                  CONTENTS, ALLOC, LOAD
+Contents of section \.text:
+ 0+ e3fd0001 e3fd0004                  .*
+Contents of section \.MMIX\.sec\.0:
+ 789abcdef0123458 b045197d 2c1b03b2 e4dbf877 0fc766fb  .*
+ 789abcdef0123468 00000000 00000000 00000000 00000000  .*
+ 789abcdef0123478 12345677  .*