This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] LD/testsuite: Add 2**4 section alignment FILL script statement test


Complement commit ffe54b3798db ("Pad sections according to current 
script FILL.") and add a FILL script statement test for targets that 
impose the minimum alignment of more than 2**2 for the `.text' section.  
These targets include IA-64 targets, MIPS targets other than bare-metal 
ELF and VxWorks, TILE-Gx targets, TILEPro targets and X86-64 PE targets.

Use the `notarget' tag for configuration triplets that are incompatible 
with the new test, but are supported by the existing FILL test, and 
`xfail' for ones that have issues due to section alignment or padding 
with both tests.  Make a complementary change to the existing FILL test, 
removing the following test issues:

arm-epoc-pe  -FAIL: ld-scripts/fill
mips-elf  -XPASS: ld-scripts/fill
mips-img-elf  -XPASS: ld-scripts/fill
mips-mti-elf  -XPASS: ld-scripts/fill
mips-sde-elf  -XPASS: ld-scripts/fill
mips-vxworks  -XPASS: ld-scripts/fill
mipsel-elf  -XPASS: ld-scripts/fill
mipsel-img-elf  -XPASS: ld-scripts/fill
mipsel-mti-elf  -XPASS: ld-scripts/fill
mipsel-vxworks  -XPASS: ld-scripts/fill
mipsisa32-elf  -XPASS: ld-scripts/fill
mipsisa32el-elf  -XPASS: ld-scripts/fill
mipsisa64-elf  -XPASS: ld-scripts/fill
mipsisa64el-elf  -XPASS: ld-scripts/fill
tilegx-linux  -FAIL: ld-scripts/fill
tilepro-elf  -FAIL: ld-scripts/fill
tx39-elf  -XPASS: ld-scripts/fill

	ld/
	* testsuite/ld-scripts/fill.d: Adjust `xfail' entries.  Add 
	`notarget' entries.  Update comments.
	* testsuite/ld-scripts/fill16.d: New test.
	* testsuite/ld-scripts/fill16_0.s: New test source.
	* testsuite/ld-scripts/fill16_1.s: New test source.
	* testsuite/ld-scripts/fill16_2.s: New test source.
	* testsuite/ld-scripts/data.exp: Run the new test.
---
Hi,

 I have decided to keep a couple of targets not covered by `xfail' or 
`notarget' across the two FILL tests because they have genuine issues of a 
kind different from target-specific section alignment or padding 
peculiarities.  These are:

* `alpha-dec-vms', which fails due to missing `-limagelib', `-lstarlet', 
  `-lsys$public_vectors', as virtually all LD tests for this target,

* `powerpc-*-aix*', `powerpc-*-beos*', `rs6000-*-aix*', which fail due to 
  dropping section contents -- only padding requested is emitted in 
  output.

I have not investigated any further what's causing these problems.

 NB, I've noticed that some a.out targets actually pass either of these 
FILL tests, so perhaps a separate similar change would be good to make, 
followed by the removal of the bulk `is_aout_format' check.  This is also 
why I haven't put `unsupported fill16' under that check.

 OK for master and 2.29?

  Maciej

binutils-ld-test-scripts-fill.diff
---
 ld/testsuite/ld-scripts/data.exp   |    1 
 ld/testsuite/ld-scripts/fill.d     |   33 +++++++++++++++++++++-------
 ld/testsuite/ld-scripts/fill16.d   |   43 +++++++++++++++++++++++++++++++++++++
 ld/testsuite/ld-scripts/fill16_0.s |    6 +++++
 ld/testsuite/ld-scripts/fill16_1.s |    6 +++++
 ld/testsuite/ld-scripts/fill16_2.s |    6 +++++
 6 files changed, 87 insertions(+), 8 deletions(-)

Index: binutils/ld/testsuite/ld-scripts/data.exp
===================================================================
--- binutils.orig/ld/testsuite/ld-scripts/data.exp	2017-07-16 22:06:11.208072005 +0100
+++ binutils/ld/testsuite/ld-scripts/data.exp	2017-07-17 06:45:21.101355869 +0100
@@ -29,3 +29,4 @@ if {[is_aout_format]} {
 
 run_dump_test data
 run_dump_test fill
+run_dump_test fill16
Index: binutils/ld/testsuite/ld-scripts/fill.d
===================================================================
--- binutils.orig/ld/testsuite/ld-scripts/fill.d	2017-07-16 22:06:11.212111152 +0100
+++ binutils/ld/testsuite/ld-scripts/fill.d	2017-07-18 23:24:30.236988437 +0100
@@ -3,20 +3,37 @@
 #source: fill_2.s
 #ld: -T fill.t
 #objdump: -s -j .text
-#xfail: ia64-*-* alpha-*-*ecoff m32c-*-* mips*-*-* sh-*-pe sparc*-*-coff
+#notarget: ia64-*-*
+#notarget: mips*-*-irix* mips*-*-linux* mips*-*-freebsd* mips*-*-gnu*
+#notarget: mips*-*-kfreebsd* mips*-*-netbsd* mips*-*-openbsd* mips*-*-sysv4*
+#notarget: tilegx*-*-*
+#notarget: tilepro-*-*
+#notarget: x86_64-*-cygwin x86_64-*-mingw* x86_64-*-pe*
+#xfail: alpha*-*-*ecoff
+#xfail: arm-epoc-pe
+#xfail: m32c-*-*
+#xfail: sh-*-pe
+#xfail: sparc*-*-coff
 #xfail: tic30-*-coff tic4x-*-* tic54x-*-*
-#xfail: x86_64-*-pe* x86_64-*-mingw* x86_64-*-cygwin z8k-*-*
-# Breaks on ia64 due to minimum alignment of code.  The section alignment
-# could be increased to suit ia64 but then we'd break many coff targets
-# that don't support alignment other than 4 bytes.
-# alpha-linuxecoff always aligns code to 16 bytes.
-# m32c pads out code sections to 8 bytes.
-# mips aligns to 16 bytes
+#xfail: z8k-*-*
+#
+# See also fill16.d.  We use `notarget' for configurations unsupported
+# here that are covered there, and `xfail' for configurations that work
+# in neither place.  See below for details as to why individual
+# configurations are listed above.
+#
+# alpha-linuxecoff pads out code to 16 bytes.
+# arm-epoc-pe always pads out code to 512 bytes.
+# ia64 aligns code to minimum 16 bytes.
+# m32c pads out code sections with 4 NOPs (see `m32c_md_end').
+# mips aligns to minimum 16 bytes (except for bare-metal ELF and VxWorks).
 # sh-pe pads out code sections to 16 bytes
 # sparc-coff aligns to 8 bytes
 # tic30-coff aligns to 2 bytes
 # tic4x has 4 octet bytes
 # tic54x doesn't support .p2align
+# tilegx aligns code to minimum 8 bytes.
+# tilepro aligns code to minimum 8 bytes.
 # x86_64-pe aligns to 16 bytes
 # z8k-coff aligns to 2 bytes
 
Index: binutils/ld/testsuite/ld-scripts/fill16.d
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-scripts/fill16.d	2017-07-18 23:23:38.938388294 +0100
@@ -0,0 +1,43 @@
+#source: fill16_0.s
+#source: fill16_1.s
+#source: fill16_2.s
+#ld: -T fill.t
+#objdump: -s -j .text
+#notarget: arm-*-coff
+#notarget: i[3-7]86-*-coff
+#xfail: alpha*-*-*ecoff
+#xfail: arm-epoc-pe
+#xfail: m32c-*-*
+#xfail: sh-*-pe
+#xfail: sparc*-*-coff
+#xfail: tic30-*-coff tic4x-*-* tic54x-*-*
+#xfail: z8k-*-*
+#
+# See also fill.d.  We use `notarget' for configurations unsupported
+# here that are covered there, and `xfail' for configurations that work
+# with neither place.  See below for details as to why individual
+# configurations are listed above.
+#
+# alpha-linuxecoff pads out code to 16 bytes.
+# arm-epoc-pe always pads out code to 512 bytes.
+# arm-coff always aligns code to 4 bytes.
+# i386-coff always aligns code to 4 bytes.
+# m32c pads out code sections with 4 NOPs (see `m32c_md_end').
+# sh-pe pads out code sections to 16 bytes
+# sparc-coff aligns to 8 bytes
+# tic30-coff aligns to 2 bytes
+# tic4x has 4 octet bytes
+# tic54x doesn't support .p2align
+# z8k-coff aligns to 2 bytes
+
+.*:     file format .*
+
+Contents of section .text:
+ [0-9a-f]+ cafebabe cafebabe cafebabe cafebabe .*
+ [0-9a-f]+ 01010101 01010101 01010101 01010101 .*
+ [0-9a-f]+ 02020202 02020202 02020202 02020202 .*
+ [0-9a-f]+ 12232323 23232323 23232323 23232323 .*
+ [0-9a-f]+ 03030303 03030303 03030303 03030303 .*
+ [0-9a-f]+ 00345600 00004567 000089ab (deadbeef|efbeadde) .*
+ [0-9a-f]+ 00004567 000089ab 0000cdef 00004567 .*
+ [0-9a-f]+ 000089ab 0000cdef 00000123          .*
Index: binutils/ld/testsuite/ld-scripts/fill16_0.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-scripts/fill16_0.s	2017-07-17 06:45:21.143764591 +0100
@@ -0,0 +1,6 @@
+ .text
+ .p2align 4, 0
+ .byte 1,1,1,1
+ .byte 1,1,1,1
+ .byte 1,1,1,1
+ .byte 1,1,1,1
Index: binutils/ld/testsuite/ld-scripts/fill16_1.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-scripts/fill16_1.s	2017-07-17 06:45:21.146811732 +0100
@@ -0,0 +1,6 @@
+ .text
+ .p2align 4, 0
+ .byte 2,2,2,2
+ .byte 2,2,2,2
+ .byte 2,2,2,2
+ .byte 2,2,2,2
Index: binutils/ld/testsuite/ld-scripts/fill16_2.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/ld/testsuite/ld-scripts/fill16_2.s	2017-07-17 06:45:21.159910636 +0100
@@ -0,0 +1,6 @@
+ .text
+ .p2align 4, 0
+ .byte 3,3,3,3
+ .byte 3,3,3,3
+ .byte 3,3,3,3
+ .byte 3,3,3,3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]