From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4C48115808A for ; Thu, 31 Jul 2025 11:39:23 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 2DBC9341FBF for ; Thu, 31 Jul 2025 11:39:23 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 28F69110377; Thu, 31 Jul 2025 11:39:22 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 1D414110377 for ; Thu, 31 Jul 2025 11:39:22 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9E5D2341FBF for ; Thu, 31 Jul 2025 11:39:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4026A29A9 for ; Thu, 31 Jul 2025 11:39:20 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1753961957.8eb5c7fc4e1325c68456d935a20c3f2821682fa4.sam@gentoo> Subject: [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/ X-VCS-Repository: proj/toolchain/binutils-patches X-VCS-Files: 9999/0006-strip-Treat-default-output_target-as-unspecified.patch X-VCS-Directories: 9999/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 8eb5c7fc4e1325c68456d935a20c3f2821682fa4 X-VCS-Branch: master Date: Thu, 31 Jul 2025 11:39:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b28e3094-4c8a-461b-8d23-b0e93ab417e8 X-Archives-Hash: 92f9ff46d85cd8c83e9f5f722085ca5d commit: 8eb5c7fc4e1325c68456d935a20c3f2821682fa4 Author: Sam James gentoo org> AuthorDate: Thu Jul 31 11:07:40 2025 +0000 Commit: Sam James gentoo org> CommitDate: Thu Jul 31 11:39:17 2025 +0000 URL: https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=8eb5c7fc 9999: add test failure fix Signed-off-by: Sam James gentoo.org> ...reat-default-output_target-as-unspecified.patch | 151 +++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/9999/0006-strip-Treat-default-output_target-as-unspecified.patch b/9999/0006-strip-Treat-default-output_target-as-unspecified.patch new file mode 100644 index 0000000..4694921 --- /dev/null +++ b/9999/0006-strip-Treat-default-output_target-as-unspecified.patch @@ -0,0 +1,151 @@ +https://inbox.sourceware.org/binutils/CAMe9rOqPdWMoGgvmecsu-PBokZ2x5J9WK3S01Mv5tCqSFyW-Sg@mail.gmail.com/ + +From 044bbf7a436f73d54aed5c41e932bad518dc64bf Mon Sep 17 00:00:00 2001 +Message-ID: <044bbf7a436f73d54aed5c41e932bad518dc64bf.1753960038.git.sam@gentoo.org> +From: "H.J. Lu" +Date: Wed, 30 Jul 2025 20:34:46 -0700 +Subject: [PATCH] strip: Treat "default" output_target as unspecified + +Treat output target as unspecified if it is set to "default". + +binutils/ + + PR binutils/33230 + * objcopy.c (copy_file): Treat "default" output_target as + unspecified. + +binutils/testsuite/ + + PR binutils/33230 + * binutils-all/x86-64/x86-64.exp (run_pr33230_test): New. + Run binutils/33230 tests with readelf if supported. + +Signed-off-by: H.J. Lu +--- + binutils/objcopy.c | 6 +- + .../testsuite/binutils-all/x86-64/x86-64.exp | 76 ++++++++++++++----- + 2 files changed, 60 insertions(+), 22 deletions(-) + +diff --git a/binutils/objcopy.c b/binutils/objcopy.c +index e90117af90b..5774711abe6 100644 +--- a/binutils/objcopy.c ++++ b/binutils/objcopy.c +@@ -3953,7 +3953,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd, + + /* bfd_get_target does not return the correct value until + bfd_check_format succeeds. */ +- if (output_target == NULL) ++ if (output_target == NULL ++ || strcmp (output_target, "default") == 0) + { + output_target = bfd_get_target (ibfd); + force_output_target = false; +@@ -4008,7 +4009,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd, + + /* bfd_get_target does not return the correct value until + bfd_check_format succeeds. */ +- if (output_target == NULL) ++ if (output_target == NULL ++ || strcmp (output_target, "default") == 0) + output_target = bfd_get_target (ibfd); + + if (ofd >= 0) +diff --git a/binutils/testsuite/binutils-all/x86-64/x86-64.exp b/binutils/testsuite/binutils-all/x86-64/x86-64.exp +index a3fe6b13a7c..6d1b308eca6 100644 +--- a/binutils/testsuite/binutils-all/x86-64/x86-64.exp ++++ b/binutils/testsuite/binutils-all/x86-64/x86-64.exp +@@ -255,6 +255,56 @@ run_pr33198_test "-fat" "-R .gnu.lto_* -R .gnu.debuglto_* -R .llvm.lto -N __gnu_ + run_pr33198_test "" "-R .llvm.lto" + run_pr33198_test "-fat" "-R .llvm.lto" + ++proc run_pr33230_test { testname obj strip_flags run_readelf } { ++ global srcdir ++ global subdir ++ global READELF ++ global STRIP ++ ++ append strip_flags " --strip-debug" ++ append testname " ($strip_flags)" ++ ++ set cmd "$STRIP $strip_flags $obj -o ${obj}.strip" ++ send_log "$cmd\n" ++ verbose "$cmd" 1 ++ catch "exec $cmd" got ++ if { $run_readelf == "yes" } { ++ if ![string match "" $got] then { ++ send_log "$got\n" ++ verbose "$got" 1 ++ fail "$testname (${obj})" ++ return ++ } ++ set cmd "$READELF -h $obj" ++ send_log "$cmd\n" ++ verbose "$cmd" 1 ++ catch "exec $cmd" got ++ if { ![regexp "Machine: +AArch64" $got] } then { ++ send_log "$got\n" ++ verbose "$got" 1 ++ fail "$testname (${obj})" ++ return ++ } ++ set cmd "$READELF -h ${obj}.strip" ++ send_log "$cmd\n" ++ verbose "$cmd" 1 ++ catch "exec $cmd" got ++ if { ![regexp "Machine: +AArch64" $got] } then { ++ send_log "$got\n" ++ verbose "$got" 1 ++ fail "$testname (${obj}.strip)" ++ return ++ } ++ } elseif { ![regexp "Unable to recognise the format" $got] } then { ++ send_log "$got\n" ++ verbose "$got" 1 ++ fail "$testname" ++ return ++ } ++ ++ pass "$testname" ++} ++ + set t $srcdir/$subdir/pr33230.obj.bz2 + # We need to strip the ".bz2", but can leave the dirname. + set test $subdir/[file tail $t] +@@ -264,26 +314,12 @@ set obj tmpdir/pr33230.o + if {[catch "system \"bzip2 -dc $t > $obj\""] != 0} { + untested "bzip2 -dc ($testname)" + } else { +- set cmd "$STRIP $obj -o ${obj}.strip" +- send_log "$cmd\n" +- verbose "$cmd" 1 +- catch "exec $cmd" got +- if [regexp "Unable to recognise the format" $got] then { +- pass "$testname" +- } else { +- send_log "$got\n" +- verbose "$got" 1 +- fail "$testname" +- } +- set cmd "$STRIP --input-target=default $obj -o ${obj}.strip" +- send_log "$cmd\n" +- verbose "$cmd" 1 +- catch "exec $cmd" got +- if [regexp "Unable to recognise the format" $got] then { +- pass "$testname" ++ catch "exec $STRIP --help" got ++ if { [regexp "elf64-littleaarch64" $got] } { ++ set run_readelf "yes" + } else { +- send_log "$got\n" +- verbose "$got" 1 +- fail "$testname (--input-target=default)" ++ set run_readelf "no" + } ++ run_pr33230_test "$testname" $obj "" $run_readelf ++ run_pr33230_test "$testname" $obj "--input-target=default" $run_readelf + } + +base-commit: c7c272f06d2d456d1d99762325fd0dd7db31d540 +-- +2.50.1 +