[PATCH 2/3] binutils/testsuite: Support REL and MIPS64 reloc formats with `strip-13'

Maciej W. Rozycki macro@mips.com
Wed Apr 4 20:10:00 GMT 2018


Add source variants for the `strip-13' test that produce relocations in 
the REL and MIPS64 formats, fixing a failure for the `mips64el-openbsd' 
target.  This also corrects output for `i*86-*', `i960-*', `m6812-*' and 
`m68hc12-*', o32 `mips*-*', and `score*-*' targets, which however does 
not show up as a test result change due to lax error message matching 
causing `bad value' previously produced by `strip' as a result of input 
file rejection to be accepted as a test pass.

For `m6811-*' aka `m68hc11-*' targets this causes a phantom regression, 
because they use 16-bit addressing and therefore `.dc.a' emits 16-bit 
quantities causing relocation data constructed in assembly not to be as 
expected.  Previously input was rejected by `strip' with a `bad value' 
message and now it is accepted, however due to the relocation data error 
the relocation number is not one of the unsupported ones and the tool 
completes successfully, which scores as a test failure.

Disable the test case for `m6811-*' and `m68hc11-*' targets then, as it 
is a test case bug rather than a problem with the relevant backend.  A 
separate change to the test case is required to correct this problem, at 
which point the test case can be enabled for the affected targets.

	testsuite/
	* testsuite/binutils-all/strip-13.s: Rename to...
	* testsuite/binutils-all/strip-13rela.s: ... this.
	* testsuite/binutils-all/strip-13rel.s: New test source.
	* testsuite/binutils-all/strip-13mips64.s: New test source.
	* testsuite/binutils-all/strip-13.d: Remove `arm-*', `d10v-*',
	`dlx-*' and `xgate-*' from `not-target' list.  Add `m6811-*' and 
	`m68hc11-*' to `not-target' list.
	* testsuite/binutils-all/objcopy.exp: Switch between sources for 
	`strip-13'.
---
Hi,

 I haven't looked into updating the H8300, IP2K or RX targets.  The two 
formers use 16-bit addressing and like the 68HC11 will require using 
`.dc.l' rather than `.dc.a' for the test case to work, as shown with 
upcoming `strip-14' test case.  The latter may require a more thorough 
examination.

 No regressions across my usual targets.  OK to apply?

  Maciej
---
 binutils/testsuite/binutils-all/objcopy.exp      |   24 ++++++++++++++++++++++-
 binutils/testsuite/binutils-all/strip-13.d       |    8 +++----
 binutils/testsuite/binutils-all/strip-13.s       |   12 -----------
 binutils/testsuite/binutils-all/strip-13mips64.s |   14 +++++++++++++
 binutils/testsuite/binutils-all/strip-13rel.s    |   10 +++++++++
 binutils/testsuite/binutils-all/strip-13rela.s   |   12 +++++++++++
 6 files changed, 63 insertions(+), 17 deletions(-)

binutils-strip-13-test-reloc-format.diff
Index: binutils/binutils/testsuite/binutils-all/objcopy.exp
===================================================================
--- binutils.orig/binutils/testsuite/binutils-all/objcopy.exp	2018-04-04 19:18:18.912347282 +0100
+++ binutils/binutils/testsuite/binutils-all/objcopy.exp	2018-04-04 20:29:22.009825595 +0100
@@ -1084,7 +1084,29 @@ if [is_elf_format] {
     run_dump_test "strip-8"
     run_dump_test "strip-9"
     run_dump_test "strip-12"
-    run_dump_test "strip-13"
+
+    if { [istarget "mips64*-*-openbsd*"] } {
+	set reloc_format mips64
+    } elseif { [istarget "arm-*"] \
+	       || [istarget "d10v-*"] \
+	       || [istarget "dlx-*"] \
+	       || [istarget "i*86-*"] \
+	       || [istarget "i960-*"] \
+	       || [istarget "m681*-*"] \
+	       || [istarget "m68hc1*-*"] \
+	       || ([istarget "mips*-*"] \
+		   && ![istarget "mips64*-ps2-elf*"] \
+		   && ![istarget "*-*-irix6*"] \
+		   && ![istarget "mips64*-*-freebsd*"] \
+		   && ![istarget "mips64*-*-kfreebsd*-gnu"] \
+		   && ![istarget "mips64*-*-linux*"]) \
+	       || [istarget "score*-*"] \
+	       || [istarget "xgate-*"] } {
+	set reloc_format rel
+    } else {
+	set reloc_format rela
+    }
+    run_dump_test "strip-13" [list [list source strip-13${reloc_format}.s]]
 
     # This requires STB_GNU_UNIQUE support with OSABI set to GNU.
     if { [supports_gnu_unique] } {
Index: binutils/binutils/testsuite/binutils-all/strip-13.d
===================================================================
--- binutils.orig/binutils/testsuite/binutils-all/strip-13.d	2018-04-04 19:27:32.512341052 +0100
+++ binutils/binutils/testsuite/binutils-all/strip-13.d	2018-04-04 20:33:25.185337506 +0100
@@ -1,8 +1,8 @@
 #PROG: strip
 #strip: -g
 #error: .* bad value
-#not-target: arm-* d10v-* dlx-* h8300-* ip2k-* rx-* xgate-*
-# The D10V, DLX and XGATE targets only support REL relocations but this test uses RELA relocations.
-# The ARM target does support both types, but defaults to REL.
-# The H8300-*, IP2K and RX targets do not complain about unrecognised relocs, unless they are actually used
+#not-target: h8300-* ip2k-* m6811-* m68hc11-* rx-*
+# The H8300-*, IP2K and 68HC11 targets use 16-bit addressing, so `.dc.a'
+#  does not work for manual relocation data construction.
+# The RX targets do not complain about unrecognised relocs, unless they are actually used
 #  (which is what should really happen with the other targets...)
Index: binutils/binutils/testsuite/binutils-all/strip-13.s
===================================================================
--- binutils.orig/binutils/testsuite/binutils-all/strip-13.s	2018-04-04 19:27:32.544762541 +0100
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,12 +0,0 @@
-	.text
-foo:
-	.dc.l    0x12345678
-
-	.section .rela.text
-	.dc.a	 0
-	.dc.a    0x0000008f
-	.dc.a	 0x0000008f
-
-	.dc.a	 0
-	.dc.a    0
-	.dc.a	 0
Index: binutils/binutils/testsuite/binutils-all/strip-13mips64.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/binutils/testsuite/binutils-all/strip-13mips64.s	2018-04-04 19:27:32.692703475 +0100
@@ -0,0 +1,14 @@
+	.text
+foo:
+	.dc.l    0x12345678
+
+	.section .rela.text
+	.dc.a	 0
+	.dc.l    0
+	.dc.b    0, 0, 0, 0x8f
+	.dc.a	 0x0000008f
+
+	.dc.a	 0
+	.dc.w    0
+	.dc.b    0, 0, 0, 0
+	.dc.a	 0
Index: binutils/binutils/testsuite/binutils-all/strip-13rel.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/binutils/testsuite/binutils-all/strip-13rel.s	2018-04-04 19:27:32.706139162 +0100
@@ -0,0 +1,10 @@
+	.text
+foo:
+	.dc.l    0x12345678
+
+	.section .rel.text
+	.dc.a	 0
+	.dc.a    0x0000008f
+
+	.dc.a	 0
+	.dc.a    0
Index: binutils/binutils/testsuite/binutils-all/strip-13rela.s
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ binutils/binutils/testsuite/binutils-all/strip-13rela.s	2018-04-04 19:27:32.716412449 +0100
@@ -0,0 +1,12 @@
+	.text
+foo:
+	.dc.l    0x12345678
+
+	.section .rela.text
+	.dc.a	 0
+	.dc.a    0x0000008f
+	.dc.a	 0x0000008f
+
+	.dc.a	 0
+	.dc.a    0
+	.dc.a	 0



More information about the Binutils mailing list