+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
% 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
--- /dev/null
+% 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
--- /dev/null
+#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 .*
+
--- /dev/null
+ .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
--- /dev/null
+#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.
--- /dev/null
+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); }
+}
--- /dev/null
+#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 .*