]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Pass -B to objcopy binary symbol test
authorAlan Modra <amodra@gmail.com>
Thu, 30 Oct 2025 22:57:46 +0000 (09:27 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 30 Oct 2025 23:14:38 +0000 (09:44 +1030)
objcopy -I binary -O some_coff_target does not currently work without
choosing a valid arch with -B.  This used to be the case for ELF
targets too, until commit 6765ee1825d9.

* testsuite/binutils-all/objcopy.exp (binary_symbol): Pass
-B arch to objcopy.  Choose different output object files for
the two tests.

binutils/testsuite/binutils-all/objcopy.exp

index fe915187f0ec435c89308bd6ea59aab3ad0ed62c..e6fcf5f7f12d03eeaa3aa8f15b9c4a5ea314e01a 100644 (file)
@@ -1613,10 +1613,12 @@ proc binary_symbol {name file args symbol} {
     set test "binary symbol ($name)"
 
     # detect a valid target, take the first supported
-    set target [lindex [split [binutils_run $OBJCOPY "--info"] \n] 1]
+    set inf [split [binutils_run $OBJCOPY "--info"] \n]
+    set target [lindex $inf 1]
+    set arch [string trim [lindex $inf 3]]
 
-    set out tmpdir/binary_symbol.o
-    set got [binutils_run $OBJCOPY "-I binary -O $target $args $file $out"]
+    set out tmpdir/binary_${name}.o
+    set got [binutils_run $OBJCOPY "-I binary -B $arch -O $target $args $file $out"]
 
     set expected [list "${symbol}_end" "${symbol}_size" "${symbol}_start"]