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]

Remove run_dump_test support for objcopy as a dump program


We have three copies of run_dump_test in the testsuite.  This is a first
step towards consolidating them.

A few tests use objcopy to convert to verilog or srec output, then
check that output is as expected.  Those tests can just as easily use
objdump, keeping the set of dump programs (addr2line, nm, objdump,
readelf, size) separate from utilities under test.  That in turn makes
auto-detecting the dump program possible in more places.

binutils/
	* testsuite/binutils-all/group-7a.d,
	* testsuite/binutils-all/group-7b.d,
	* testsuite/binutils-all/group-7c.d,
	* testsuite/binutils-all/symbols-1.d,
	* testsuite/binutils-all/symbols-2.d,
	* testsuite/binutils-all/symbols-3.d,
	* testsuite/binutils-all/symbols-4.d: Remove DUMPPROG.
gas/
	* testsuite/gas/mri/char.d: Don't objcopy to srec, objdump instead.
	* testsuite/gas/mri/float.d: Likewise.
	* testsuite/lib/gas-defs.exp (run_dump_test): Remove support
	for objcopy as a dump tool.
ld/
	* testsuite/ld-elf/interleave-0.d,
	* testsuite/ld-elf/interleave-4.d: Don't objcopy to srec,
	objdump instead.
	* testsuite/ld-gc/all-debug-sections.d,
	* testsuite/ld-scripts/provide-4.d,
	* testsuite/ld-scripts/provide-5.d,
	* testsuite/ld-scripts/provide-6.d,
	* testsuite/ld-scripts/provide-7.d,
	* testsuite/ld-scripts/provide-8.d,
	* testsuite/ld-scripts/segment-start.d: Remove PROG, specify
	nm instead.
	* testsuite/lib/ld-lib.exp (run_dump_test): Remove support
	for objcopy as a dump tool.

diff --git a/binutils/testsuite/binutils-all/group-7a.d b/binutils/testsuite/binutils-all/group-7a.d
index fa8db60d9e..8fdc6aaff9 100644
--- a/binutils/testsuite/binutils-all/group-7a.d
+++ b/binutils/testsuite/binutils-all/group-7a.d
@@ -1,7 +1,6 @@
 #name: copy removing reloc group member
 #source: group-7.s
 #PROG: objcopy
-#DUMPPROG: readelf
 #objcopy: --remove-section .data.foo
 #readelf: -Sg --wide
 
diff --git a/binutils/testsuite/binutils-all/group-7b.d b/binutils/testsuite/binutils-all/group-7b.d
index b674545362..c2691168ea 100644
--- a/binutils/testsuite/binutils-all/group-7b.d
+++ b/binutils/testsuite/binutils-all/group-7b.d
@@ -1,7 +1,6 @@
 #name: copy removing non-reloc group member
 #source: group-7.s
 #PROG: objcopy
-#DUMPPROG: readelf
 #objcopy: --remove-section .data2.foo
 #readelf: -Sg --wide
 
diff --git a/binutils/testsuite/binutils-all/group-7c.d b/binutils/testsuite/binutils-all/group-7c.d
index 83e91156ee..034a8725d3 100644
--- a/binutils/testsuite/binutils-all/group-7c.d
+++ b/binutils/testsuite/binutils-all/group-7c.d
@@ -1,7 +1,6 @@
 #name: copy removing reloc and non-reloc group member
 #source: group-7.s
 #PROG: objcopy
-#DUMPPROG: readelf
 #objcopy: -R .data.foo -R .data2.foo
 #readelf: -g --wide
 
diff --git a/binutils/testsuite/binutils-all/symbols-1.d b/binutils/testsuite/binutils-all/symbols-1.d
index a2d8f55bc3..bfcd6aa1bf 100644
--- a/binutils/testsuite/binutils-all/symbols-1.d
+++ b/binutils/testsuite/binutils-all/symbols-1.d
@@ -2,7 +2,6 @@
 #PROG: objcopy
 #objcopy: -w -L !foo -L fo*
 #source: symbols.s
-#DUMPPROG: nm
 #nm: -n
 
 #...
diff --git a/binutils/testsuite/binutils-all/symbols-2.d b/binutils/testsuite/binutils-all/symbols-2.d
index 68fa6737ec..b9fd907387 100644
--- a/binutils/testsuite/binutils-all/symbols-2.d
+++ b/binutils/testsuite/binutils-all/symbols-2.d
@@ -2,7 +2,6 @@
 #PROG: objcopy
 #objcopy: -w -W !foo -W fo*
 #source: symbols.s
-#DUMPPROG: nm
 #nm: -n
 
 #...
diff --git a/binutils/testsuite/binutils-all/symbols-3.d b/binutils/testsuite/binutils-all/symbols-3.d
index 0815238a46..d415e981f8 100644
--- a/binutils/testsuite/binutils-all/symbols-3.d
+++ b/binutils/testsuite/binutils-all/symbols-3.d
@@ -2,7 +2,6 @@
 #PROG: objcopy
 #objcopy: -w -W !foo -W fo* -L foo
 #source: symbols.s
-#DUMPPROG: nm
 #nm: -n
 
 #...
diff --git a/binutils/testsuite/binutils-all/symbols-4.d b/binutils/testsuite/binutils-all/symbols-4.d
index 7480b0de59..6dd2900efc 100644
--- a/binutils/testsuite/binutils-all/symbols-4.d
+++ b/binutils/testsuite/binutils-all/symbols-4.d
@@ -2,7 +2,6 @@
 #PROG: objcopy
 #objcopy: -w -W !foo -W !bar -W *
 #source: symbols.s
-#DUMPPROG: nm
 #nm: -n
 
 #...
diff --git a/gas/testsuite/gas/mri/char.d b/gas/testsuite/gas/mri/char.d
index 025f4b5914..7d237acfe9 100644
--- a/gas/testsuite/gas/mri/char.d
+++ b/gas/testsuite/gas/mri/char.d
@@ -1,9 +1,9 @@
-#objcopy: -O srec
 #name: MRI character constants
 #as: -M
+#objdump: -s
 
-# Test MRI character constants
+.*:     file format .*
 
-S0.*
-S113....(61616263616263646500000061276200)|(61616263646362610000006500622761).*
-#pass
+Contents of section \.text:
+
+ 0+0 (61616263 61626364 65000000 61276200)|(61616263 64636261 00000065 00622761) .*
diff --git a/gas/testsuite/gas/mri/float.d b/gas/testsuite/gas/mri/float.d
index 21ecf2e384..27f4fdc54c 100644
--- a/gas/testsuite/gas/mri/float.d
+++ b/gas/testsuite/gas/mri/float.d
@@ -1,10 +1,9 @@
-#objcopy: -O srec
 #name: MRI floating point constants
 #as: -M
+#objdump: -s
 
-# Test MRI floating point constants
+.*:     file format .*
 
-S0.*
-S113....(123456789ABCDEF03F80000041200000)|(F0DEBC9A785634120000803F00002041).*
-S10.....(4120000042C80000)|(000020410000C842).*
-#pass
+Contents of section \.text:
+ 0+00 (12345678 9abcdef0 3f800000 41200000)|(f0debc9a 78563412 0000803f 00002041) .*
+ 0+10 (41200000 42c80000)|(000020 410000c842) .*
diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp
index 22984c70e1..b7cc06edef 100644
--- a/gas/testsuite/lib/gas-defs.exp
+++ b/gas/testsuite/lib/gas-defs.exp
@@ -359,14 +359,13 @@ proc run_dump_tests { testcases {extra_options {}} } {
 #
 #   addr2line: FLAGS
 #   nm: FLAGS
-#   objcopy: FLAGS
 #   objdump: FLAGS
 #   readelf: FLAGS
 #	Use the specified program to analyze the .o file, and pass it
 #	FLAGS, in addition to the .o file name.  Note that they are run
 #	with LC_ALL=C in the environment to give consistent sorting
 #	of symbols.  If no FLAGS are needed then use:
-#        PROG: [nm objcopy objdump readelf addr2line]
+#        PROG: [nm objdump readelf addr2line]
 #       instead.
 #	Note: for objdump, we automatically replaces the standard section
 #	names (.text, .data and .bss) by target ones if any (eg. rx-elf
@@ -414,8 +413,8 @@ proc run_dump_tests { testcases {extra_options {}} } {
 #
 #   error: REGEX
 #	An error with message matching REGEX must be emitted for the test
-#	to pass.  The PROG, objdump, nm and objcopy options have no
-#	meaning and need not supplied if this is present.
+#	to pass.  The PROG, addr2line, nm, objdump, and readelf options
+#	have no meaning and need not supplied if this is present.
 #
 #   warning: REGEX
 #	Expect a gas warning matching REGEX.  It is an error to issue
@@ -424,12 +423,12 @@ proc run_dump_tests { testcases {extra_options {}} } {
 #   stderr: FILE
 #       FILE contains regexp lines to be matched against the diagnostic
 #       output of the assembler.  This does not preclude the use of
-#       PROG, nm, objdump, or objcopy.
+#       PROG, addr2line, nm, objdump, or readelf.
 #
 #   error-output: FILE
 #       Means the same as 'stderr', but also indicates that the assembler
-#       is expected to exit unsuccessfully (therefore PROG, objdump, nm,
-#       and objcopy have no meaning and should not be supplied).
+#       is expected to exit unsuccessfully (therefore PROG, addr2line, nm,
+#	objdump, and readelf have no meaning and should not be supplied).
 #
 #   section-subst: no
 #       Means that the section substitution for objdump is disabled.
@@ -465,7 +464,6 @@ proc run_dump_test { name {extra_options {}} } {
     set opts(as) {}
     set opts(objdump) {}
     set opts(nm) {}
-    set opts(objcopy) {}
     set opts(readelf) {}
     set opts(name) {}
     set opts(PROG) {}
@@ -546,7 +544,6 @@ proc run_dump_test { name {extra_options {}} } {
 		addr2line { set program addr2line }
 		objdump	{ set program objdump }
 		nm	{ set program nm }
-		objcopy	{ set program objcopy }
 		readelf	{ set program readelf }
 		default	{
 		    perror "unrecognized program option $opts(PROG) in $file.d"
@@ -555,7 +552,7 @@ proc run_dump_test { name {extra_options {}} } {
 	    }
 	} else {
 	    # Guess which program to run, by seeing which option was specified.
-	    foreach p {objdump objcopy nm readelf addr2line} {
+	    foreach p {objdump nm readelf addr2line} {
 		if {$opts($p) != ""} {
 		    if {$program != ""} {
 			perror "ambiguous dump program in $file.d"
@@ -741,15 +738,8 @@ proc run_dump_test { name {extra_options {}} } {
     if { $progopts1 == "" } { set $progopts1 "-r" }
     verbose "running $binary $progopts $progopts1" 3
 
-    # Objcopy, unlike the other two, won't send its output to stdout,
-    # so we have to run it specially.
     set cmd "$binary $progopts $progopts1 dump.o"
     set redir ">dump.out"
-    if { $program == "objcopy" } {
-	set cmd "$binary $progopts $progopts1 dump.o dump.out"
-	set redir ""
-    }
-
     send_log "$cmd\n"
     set status [gas_host_run "$cmd" "$redir"]
     set comp_output [prune_warnings [lindex $status 1]]
diff --git a/ld/testsuite/ld-elf/interleave-0.d b/ld/testsuite/ld-elf/interleave-0.d
index 837223c83a..c497a532c8 100644
--- a/ld/testsuite/ld-elf/interleave-0.d
+++ b/ld/testsuite/ld-elf/interleave-0.d
@@ -1,9 +1,12 @@
 #name: --interleave test byte 0
 #source: interleave.s
 #ld: -Tinterleave.ld
-#objcopy: --interleave=8 --interleave-width=1 --byte=0 -O verilog
+#objcopy_linked_file: --interleave=8 --interleave-width=1 --byte=0
+#objdump: -s
 
-@0+0
-00 
-@0+2
-14 
+.*:     file format .*
+
+Contents of section \.a0:
+ 0+0 00                                   .*
+Contents of section \.a1:
+ 0+c 14                                   .*
diff --git a/ld/testsuite/ld-elf/interleave-4.d b/ld/testsuite/ld-elf/interleave-4.d
index a4bb808ab6..fa104bc77e 100644
--- a/ld/testsuite/ld-elf/interleave-4.d
+++ b/ld/testsuite/ld-elf/interleave-4.d
@@ -1,9 +1,12 @@
 #name: --interleave test byte 4
 #source: interleave.s
 #ld: -Tinterleave.ld
-#objcopy: --interleave=8 --interleave-width=1 --byte=4 -O verilog
+#objcopy_linked_file: --interleave=8 --interleave-width=1 --byte=4
+#objdump: -s
 
-@0+0
-04 
-@0+1
-10 
+.*:     file format .*
+
+Contents of section \.a0:
+ 0+0 04                                   .*
+Contents of section \.a1:
+ 0+c 10                                   .*
diff --git a/ld/testsuite/ld-gc/all-debug-sections.d b/ld/testsuite/ld-gc/all-debug-sections.d
index 5e3373a63f..45ed1bad31 100644
--- a/ld/testsuite/ld-gc/all-debug-sections.d
+++ b/ld/testsuite/ld-gc/all-debug-sections.d
@@ -1,7 +1,7 @@
 #name: --gc-sections with multiple debug sections for a function section
 #as: -gdwarf-sections
 #ld: --gc-sections -e _start
-#PROG: nm
+#nm: -B
 
 #...
 [0-9a-f]+ N +debug_aranges_main
diff --git a/ld/testsuite/ld-scripts/provide-4.d b/ld/testsuite/ld-scripts/provide-4.d
index 18699f221d..b77b7dc194 100644
--- a/ld/testsuite/ld-scripts/provide-4.d
+++ b/ld/testsuite/ld-scripts/provide-4.d
@@ -1,6 +1,6 @@
 #source: provide-2.s
 #ld: -T provide-4.t
-#PROG: nm
+#nm: -B
 #map: provide-4.map
 #...
 0+3 A baz
diff --git a/ld/testsuite/ld-scripts/provide-5.d b/ld/testsuite/ld-scripts/provide-5.d
index 2a8baec605..c7f9ddb7ba 100644
--- a/ld/testsuite/ld-scripts/provide-5.d
+++ b/ld/testsuite/ld-scripts/provide-5.d
@@ -1,6 +1,6 @@
 #source: provide-5.s
 #ld: -T provide-5.t
-#PROG: nm
+#nm: -B
 #map: provide-5.map
 #...
 0+10 A foo
diff --git a/ld/testsuite/ld-scripts/provide-6.d b/ld/testsuite/ld-scripts/provide-6.d
index dd40515119..fda3c2bd27 100644
--- a/ld/testsuite/ld-scripts/provide-6.d
+++ b/ld/testsuite/ld-scripts/provide-6.d
@@ -1,6 +1,6 @@
 #source: provide-5.s
 #ld: -T provide-6.t
-#PROG: nm
+#nm: -B
 #xfail: x86_64-*-cygwin
 
 #...
diff --git a/ld/testsuite/ld-scripts/provide-7.d b/ld/testsuite/ld-scripts/provide-7.d
index c524fe428a..e2c9504002 100644
--- a/ld/testsuite/ld-scripts/provide-7.d
+++ b/ld/testsuite/ld-scripts/provide-7.d
@@ -1,6 +1,6 @@
 #source: provide-5.s
 #ld: -T provide-7.t
-#PROG: nm
+#nm: -B
 
 #...
 0+10 A foo
diff --git a/ld/testsuite/ld-scripts/provide-8.d b/ld/testsuite/ld-scripts/provide-8.d
index a4029370ca..f5abc524e8 100644
--- a/ld/testsuite/ld-scripts/provide-8.d
+++ b/ld/testsuite/ld-scripts/provide-8.d
@@ -1,6 +1,6 @@
 #source: provide-5.s
 #ld: -T provide-8.t
-#PROG: nm
+#nm: -B
 #xfail: x86_64-*-cygwin mmix-*-* sh-*-pe spu-*-*
 
 #...
diff --git a/ld/testsuite/ld-scripts/segment-start.d b/ld/testsuite/ld-scripts/segment-start.d
index fcbcfb3ab9..fde7661efe 100644
--- a/ld/testsuite/ld-scripts/segment-start.d
+++ b/ld/testsuite/ld-scripts/segment-start.d
@@ -1,7 +1,7 @@
-#PROG: nm
 #name: SEGMENT_START expression not absolute
 #source: segment-start.s
 #ld: -e 0 -u __executable_start -T segment-start.ld
+#nm: -B
 #xfail: mmix-*-* pdp11-*-* powerpc-*-aix* powerpc-*-beos* rs6000-*-* sh-*-pe
 #xfail: c30-*-*aout* tic30-*-*aout* c54x*-*-*coff* tic54x-*-*coff*
 # XFAIL targets that are not expected to handle SEGMENT_START correctly.
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 1833bdd2f0..c1ce8ee2f0 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -511,7 +511,6 @@ proc ld_link_defsyms {} {
 #   readelf: FLAGS
 #   objdump: FLAGS
 #   nm: FLAGS
-#   objcopy: FLAGS
 #	Use the specified program to analyze the assembler or linker
 #       output file, and pass it FLAGS, in addition to the output name.
 #	Note that they are run with LC_ALL=C in the environment to give
@@ -568,7 +567,7 @@ proc ld_link_defsyms {} {
 #
 #   error: REGEX
 #	An error with message matching REGEX must be emitted for the test
-#	to pass.  The PROG, readelf, objdump, nm and objcopy options have
+#	to pass.  The PROG, readelf, objdump, and nm options have
 #	no meaning and need not be supplied if this is present.  Multiple
 #	"error" directives append to the expected linker error message.
 #
@@ -647,7 +646,6 @@ proc run_dump_test { name {extra_options {}} } {
     set opts(noskip) {}
     set opts(objdump) {}
     set opts(nm) {}
-    set opts(objcopy) {}
     set opts(readelf) {}
     set opts(name) {}
     set opts(PROG) {}
@@ -825,7 +823,6 @@ proc run_dump_test { name {extra_options {}} } {
 	    switch -- $opts(PROG) {
 		objdump	{ set program objdump }
 		nm	{ set program nm }
-		objcopy	{ set program objcopy }
 		readelf	{ set program readelf }
 		default
 		{ perror "unrecognized program option $opts(PROG) in $file.d"
@@ -834,7 +831,7 @@ proc run_dump_test { name {extra_options {}} } {
 	    }
 	} else {
 	# Guess which program to run, by seeing which option was specified.
-	    foreach p {objdump objcopy nm readelf} {
+	    foreach p {objdump nm readelf} {
 		if {$opts($p) != ""} {
 		    if {$program != ""} {
 			perror "ambiguous dump program in $file.d"
@@ -1104,13 +1101,7 @@ proc run_dump_test { name {extra_options {}} } {
 
     if { $progopts1 == "" } { set $progopts1 "-r" }
     verbose "running $binary $progopts $progopts1" 3
-
-    # Objcopy, unlike the other two, won't send its output to stdout,
-    # so we have to run it specially.
     set cmd "$binary $progopts $progopts1 $objfile > $dumpfile"
-    if { $program == "objcopy" } {
-	set cmd "$binary $progopts $progopts1 $objfile $dumpfile"
-    }
 
     # Ensure consistent sorting of symbols
     if {[info exists env(LC_ALL)]} {

-- 
Alan Modra
Australia Development Lab, IBM


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