[PATCH 2/4] gas: add new COFF-specific subdir in testsuite

Jan Beulich jbeulich@suse.com
Fri Apr 25 13:00:23 GMT 2025


... and move the cofftag testcase there (from all/). Just like we have
one for ELF.

--- a/gas/testsuite/gas/all/cofftag.d
+++ /dev/null
@@ -1,25 +0,0 @@
-#objdump: -t
-#name: cofftag
-
-.*:     file format .*
-
-SYMBOL TABLE:
-\[  0\]\(sec -2\)\(fl 0x00\)\(ty    0\)\(scl 103\) \(nx 1\) 0x0+0000 foo.c
-File 
-\[  2\]\(sec  1\)\(fl 0x00\)\(ty    0\)\(scl   6\) \(nx 0\) 0x0+0000 gcc2_compiled.
-\[  3\]\(sec  1\)\(fl 0x00\)\(ty    0\)\(scl   6\) \(nx 0\) 0x0+0000 ___gnu_compiled_c
-\[  4\]\(sec -2\)\(fl 0x00\)\(ty    a\)\(scl  15\) \(nx 1\) 0x0+0000 _token
-AUX lnno 0 size 0x4 tagndx 0 endndx 10
-\[  6\]\(sec -(1|2)\)\(fl 0x00\)\(ty    b\)\(scl  16\) \(nx 0\) 0x0+0000 _operator
-\[  7\]\(sec -(1|2)\)\(fl 0x00\)\(ty    b\)\(scl  16\) \(nx 0\) 0x0+0001 _flags
-\[  8\]\(sec -(1|2)\)\(fl 0x00\)\(ty    0\)\(scl 102\) \(nx 1\) 0x0+0004 .eos
-AUX lnno 0 size 0x4 tagndx 4
-\[ 10\]\(sec  1\)\(fl 0x00\)\(ty    0\)\(scl   3\) \(nx 1\) 0x[0-9a-f]+ .text
-AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0
-\[ 12\]\(sec  2\)\(fl 0x00\)\(ty    0\)\(scl   3\) \(nx 1\) 0x[0-9a-f]+ .data
-AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0
-\[ 14\]\(sec  3\)\(fl 0x00\)\(ty    0\)\(scl   3\) \(nx 1\) 0x[0-9a-f]+ .bss
-AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0
-\[ 16\]\(sec  2\)\(fl 0x00\)\(ty    2\)\(scl   2\) \(nx 0\) 0x0+0000 _token
-\[ 17\]\(sec  2\)\(fl 0x00\)\(ty    a\)\(scl   2\) \(nx 1\) 0x[0-9a-f]+ _what
-AUX lnno 0 size 0x4 tagndx 4
--- a/gas/testsuite/gas/all/cofftag.s
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This file was compiled from this C source:
-	char token =0;
-	enum token {
-	        operator,
-	        flags
-	};
-	 
-	enum token what= operator;
-
-   Type numbers have been converted to decimal to make this test pass on
-   ports having NUMBERS_WITH_SUFFIX.
- */
-
-	.file	"foo.c"
-gcc2_compiled.:
-___gnu_compiled_c:
-.globl _token
-.data
-_token:
-	.byte 0
-.text
-	.def	_token
-	.scl	15
-	.type	10
-	.size	4
-	.endef
-	.def	_operator
-	.val	0
-	.scl	16
-	.type	11
-	.endef
-	.def	_flags
-	.val	1
-	.scl	16
-	.type	11
-	.endef
-	.def	.eos
-	.val	4
-	.scl	102
-	.tag	_token
-	.size	4
-	.endef
-.globl _what
-.data
-	.p2align 2
-_what:
-	.long 0
-.text
-	.def	_token
-	.val	_token
-	.scl	2
-	.type	2
-	.endef
-	.def	_what
-	.val	_what
-	.scl	2
-	.tag	_token
-	.size	4
-	.type	10
-	.endef
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -330,21 +330,6 @@ switch -glob $target_triplet {
     }
 }
 
-# This test is for any COFF target.
-# We omit the ARM toolchains because they define locals to
-#  start with '.', which eliminates .eos, .text etc from the output.
-# Omit c54x, since .tag and .def mean something different on that target
-if {   ([istarget *-*-coff*] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff]) \
-     ||([istarget *-*-pe*] && ![istarget arm*-*-pe*]) \
-     || [istarget i*86-*-aix*] \
-     || [istarget i*86-*-go32*] \
-     || [istarget i*86-*-cygwin*] \
-     || [istarget x86_64-*-mingw*] \
-     || [istarget i*86-*-*nt] \
-     || [istarget i*86-*-interix*] } {
-    run_dump_test cofftag
-}
-
 # Test omitting conditionals from listings.
 proc test_cond {} {
     global comp_output
--- /dev/null
+++ b/gas/testsuite/gas/coff/coff.exp
@@ -0,0 +1,32 @@
+# Copyright (C) 2012-2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+#
+# coff tests
+#
+
+if { ![is_coff_format] } then {
+    return
+}
+
+# We omit the ARM toolchains because they define locals to start with '.',
+#  which eliminates .eos, .text etc from the output.
+# Also omit c4x and c54x, since .tag and .def mean something different there.
+if {    ![istarget arm*-*-*]
+     && ![istarget *c4x*-*-*]
+     && ![istarget *c54x*-*-*] } {
+    run_dump_test tag
+}
--- /dev/null
+++ b/gas/testsuite/gas/coff/tag.d
@@ -0,0 +1,25 @@
+#objdump: -t
+#name: cofftag
+
+.*:     file format .*
+
+SYMBOL TABLE:
+\[  0\]\(sec -2\)\(fl 0x00\)\(ty    0\)\(scl 103\) \(nx 1\) 0x0+0000 foo.c
+File *
+\[  2\]\(sec  1\)\(fl 0x00\)\(ty    0\)\(scl   6\) \(nx 0\) 0x0+0000 gcc2_compiled.
+\[  3\]\(sec  1\)\(fl 0x00\)\(ty    0\)\(scl   6\) \(nx 0\) 0x0+0000 ___gnu_compiled_c
+\[  4\]\(sec -2\)\(fl 0x00\)\(ty    a\)\(scl  15\) \(nx 1\) 0x0+0000 _token
+AUX lnno 0 size 0x4 tagndx 0 endndx 10
+\[  6\]\(sec -(1|2)\)\(fl 0x00\)\(ty    b\)\(scl  16\) \(nx 0\) 0x0+0000 _operator
+\[  7\]\(sec -(1|2)\)\(fl 0x00\)\(ty    b\)\(scl  16\) \(nx 0\) 0x0+0001 _flags
+\[  8\]\(sec -(1|2)\)\(fl 0x00\)\(ty    0\)\(scl 102\) \(nx 1\) 0x0+0004 .eos
+AUX lnno 0 size 0x4 tagndx 4
+\[ 10\]\(sec  1\)\(fl 0x00\)\(ty    0\)\(scl   3\) \(nx 1\) 0x[0-9a-f]+ .text
+AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0
+\[ 12\]\(sec  2\)\(fl 0x00\)\(ty    0\)\(scl   3\) \(nx 1\) 0x[0-9a-f]+ .data
+AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0
+\[ 14\]\(sec  3\)\(fl 0x00\)\(ty    0\)\(scl   3\) \(nx 1\) 0x[0-9a-f]+ .bss
+AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0
+\[ 16\]\(sec  2\)\(fl 0x00\)\(ty    2\)\(scl   2\) \(nx 0\) 0x0+0000 _token
+\[ 17\]\(sec  2\)\(fl 0x00\)\(ty    a\)\(scl   2\) \(nx 1\) 0x[0-9a-f]+ _what
+AUX lnno 0 size 0x4 tagndx 4
--- /dev/null
+++ b/gas/testsuite/gas/coff/tag.s
@@ -0,0 +1,60 @@
+/* This file was compiled from this C source:
+	char token =0;
+	enum token {
+	        operator,
+	        flags
+	};
+
+	enum token what= operator;
+
+   Type numbers have been converted to decimal to make this test pass on
+   ports having NUMBERS_WITH_SUFFIX.
+ */
+
+	.file	"foo.c"
+gcc2_compiled.:
+___gnu_compiled_c:
+.globl _token
+.data
+_token:
+	.byte 0
+.text
+	.def	_token
+	.scl	15
+	.type	10
+	.size	4
+	.endef
+	.def	_operator
+	.val	0
+	.scl	16
+	.type	11
+	.endef
+	.def	_flags
+	.val	1
+	.scl	16
+	.type	11
+	.endef
+	.def	.eos
+	.val	4
+	.scl	102
+	.tag	_token
+	.size	4
+	.endef
+.globl _what
+.data
+	.p2align 2
+_what:
+	.long 0
+.text
+	.def	_token
+	.val	_token
+	.scl	2
+	.type	2
+	.endef
+	.def	_what
+	.val	_what
+	.scl	2
+	.tag	_token
+	.size	4
+	.type	10
+	.endef



More information about the Binutils mailing list