From b46fa76826669b1496cac329d132485ede779d85 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Fri, 2 May 2014 00:31:58 +0200 Subject: [PATCH] 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. --- ld/testsuite/ChangeLog | 7 +++++++ ld/testsuite/ld-mmix/b-offloc.s | 2 +- ld/testsuite/ld-mmix/b-offlocmis.s | 17 +++++++++++++++++ ld/testsuite/ld-mmix/sec-10.d | 18 ++++++++++++++++++ ld/testsuite/ld-mmix/sec-10.s | 8 ++++++++ ld/testsuite/ld-mmix/sec-11.d | 7 +++++++ ld/testsuite/ld-mmix/sec-11.ld | 10 ++++++++++ ld/testsuite/ld-mmix/sec-12.d | 26 ++++++++++++++++++++++++++ 8 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 ld/testsuite/ld-mmix/b-offlocmis.s create mode 100644 ld/testsuite/ld-mmix/sec-10.d create mode 100644 ld/testsuite/ld-mmix/sec-10.s create mode 100644 ld/testsuite/ld-mmix/sec-11.d create mode 100644 ld/testsuite/ld-mmix/sec-11.ld create mode 100644 ld/testsuite/ld-mmix/sec-12.d diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 678ae078f0..cc292979d7 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2014-05-01 Hans-Peter Nilsson + + * 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 * 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 c2fb2cc3b4..1114b34069 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 0000000000..4f2b3402a7 --- /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 0000000000..a1c558de81 --- /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 0000000000..2729e552df --- /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 0000000000..3a609347fd --- /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 0000000000..a36ca1e11b --- /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 0000000000..720789e8ed --- /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 .* -- 2.34.1