aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@bitrange.com>2014-05-02 00:31:58 +0200
committerHans-Peter Nilsson <hp@bitrange.com>2014-05-02 00:31:58 +0200
commitb46fa76826669b1496cac329d132485ede779d85 (patch)
tree6f15a2e75875f807f45ac1283d4f347019b05021 /ld
parent1218d67db11b6a1aceeb477855047f70d4856854 (diff)
downloadfsf-binutils-gdb-b46fa76826669b1496cac329d132485ede779d85.zip
fsf-binutils-gdb-b46fa76826669b1496cac329d132485ede779d85.tar.gz
fsf-binutils-gdb-b46fa76826669b1496cac329d132485ede779d85.tar.bz2
ld/testsuite:
* 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.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-mmix/b-offloc.s2
-rw-r--r--ld/testsuite/ld-mmix/b-offlocmis.s17
-rw-r--r--ld/testsuite/ld-mmix/sec-10.d18
-rw-r--r--ld/testsuite/ld-mmix/sec-10.s8
-rw-r--r--ld/testsuite/ld-mmix/sec-11.d7
-rw-r--r--ld/testsuite/ld-mmix/sec-11.ld10
-rw-r--r--ld/testsuite/ld-mmix/sec-12.d26
8 files changed, 94 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 678ae07..cc29297 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -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
diff --git a/ld/testsuite/ld-mmix/b-offloc.s b/ld/testsuite/ld-mmix/b-offloc.s
index c2fb2cc..1114b34 100644
--- a/ld/testsuite/ld-mmix/b-offloc.s
+++ b/ld/testsuite/ld-mmix/b-offloc.s
@@ -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
index 0000000..4f2b340
--- /dev/null
+++ b/ld/testsuite/ld-mmix/b-offlocmis.s
@@ -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
index 0000000..a1c558d
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-10.d
@@ -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
index 0000000..2729e55
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-10.s
@@ -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
index 0000000..3a60934
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-11.d
@@ -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
index 0000000..a36ca1e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-11.ld
@@ -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
index 0000000..720789e
--- /dev/null
+++ b/ld/testsuite/ld-mmix/sec-12.d
@@ -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 .*