commit: c78cf59f7aa856e8fcec076ad3cd6d17711a04c5 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sun Aug 3 19:28:44 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sun Aug 3 19:30:42 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c78cf59f
sys-devel/binutils: drop LTO strip patch from 2.44 This needed some followups in the end so let's back it out of 2.44 and instead handle it in 2.45 (where most of it is upstream but some fixes need to be backported). In particular, see https://sourceware.org/PR33230 and https://sourceware.org/PR33246 which got reported post-release. This may have caused bug #960493 too. Having 2.44 be "vanilla" in this regard will make it much easier to test and debug. TL;DR: Drop the backports we did, the functionality we needed from them is in 2.45 anyway. Bug: https://bugs.gentoo.org/960493 Signed-off-by: Sam James <sam <AT> gentoo.org> ...tils-2.44-r3.ebuild => binutils-2.44-r4.ebuild} | 9 +- .../files/binutils-2.44-strip-static.patch | 155 --------------------- 2 files changed, 6 insertions(+), 158 deletions(-) diff --git a/sys-devel/binutils/binutils-2.44-r3.ebuild b/sys-devel/binutils/binutils-2.44-r4.ebuild similarity index 97% rename from sys-devel/binutils/binutils-2.44-r3.ebuild rename to sys-devel/binutils/binutils-2.44-r4.ebuild index 18bb5a30165d..26d2aa5a5075 100644 --- a/sys-devel/binutils/binutils-2.44-r3.ebuild +++ b/sys-devel/binutils/binutils-2.44-r4.ebuild @@ -134,13 +134,16 @@ src_prepare() { if [[ -n ${PATCH_VER} ]] || [[ ${PV} == *9999 ]] ; then if ! use vanilla; then + # We backported a patch in 2.44 but it needed a few + # followups. Better to just handle it in 2.45 instead. + rm "${WORKDIR}/patch/0007-strip-Add-GCC-LTO-IR-support.patch" \ + "${WORKDIR}/patch/0008-ld-testsuite-Use-plug_opt-for-plugin-option.patch" \ + "${WORKDIR}/patch/0009-binutils-Don-t-complain-plugin-with-all-LTO-sections.patch" || die + einfo "Applying binutils patchset ${patchsetname}" eapply "${WORKDIR}/patch" einfo "Done." - # This is a fix on top of a patch we backported to 2.44 - eapply "${FILESDIR}"/${P}-strip-static.patch - # This is applied conditionally for now just out of caution. # It should be okay on non-prefix systems though. See bug #892549. if is_cross || use prefix; then diff --git a/sys-devel/binutils/files/binutils-2.44-strip-static.patch b/sys-devel/binutils/files/binutils-2.44-strip-static.patch deleted file mode 100644 index 2e94e96545fd..000000000000 --- a/sys-devel/binutils/files/binutils-2.44-strip-static.patch +++ /dev/null @@ -1,155 +0,0 @@ -https://bugs.gentoo.org/957882 -https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=eee822a66066a17529d7af544b1be767517a6c72 - -From eee822a66066a17529d7af544b1be767517a6c72 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" <[email protected]> -Date: Fri, 13 Jun 2025 08:20:49 +0800 -Subject: [PATCH] objcopy: Correctly check archive element for LTO IR - -commit 717a38e9a02109fcbcb18bb2ec3aa251e2ad0a0d -Author: H.J. Lu <[email protected]> -Date: Sun May 4 05:12:46 2025 +0800 - - strip: Add GCC LTO IR support - -added: - -@@ -3744,6 +3768,12 @@ copy_archive (bfd *ibfd, bfd *obfd, const char -*output_target, - goto cleanup_and_exit; - } - -+#if BFD_SUPPORTS_PLUGINS -+ /* Copy LTO IR file as unknown object. */ -+ if (bfd_plugin_target_p (ibfd->xvec)) - ^^^^ A typo, should be this_element. -+ ok_object = false; -+ else -+#endif - if (ok_object) - { - ok = copy_object (this_element, output_element, input_arch); - -to check if the archive element is a LTO IR file. "ibfd" is the archive -BFD. "this_element" should be used to check for LTO IR in the archive -element. Fix it by replacing "ibfd" with "this_element". - - PR binutils/33078 - * objcopy.c (copy_archive): Correctly check archive element for - LTO IR. - * testsuite/binutils-all/objcopy.exp (strip_test_archive): New. - Run strip_test_archive. - -Signed-off-by: H.J. Lu <[email protected]> ---- - binutils/objcopy.c | 2 +- - binutils/testsuite/binutils-all/objcopy.exp | 81 +++++++++++++++++++++ - 2 files changed, 82 insertions(+), 1 deletion(-) - -diff --git a/binutils/objcopy.c b/binutils/objcopy.c -index a973789b1d5..366e1079d82 100644 ---- a/binutils/objcopy.c -+++ b/binutils/objcopy.c -@@ -3770,7 +3770,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target, - - #if BFD_SUPPORTS_PLUGINS - /* Copy LTO IR file as unknown object. */ -- if (bfd_plugin_target_p (ibfd->xvec)) -+ if (bfd_plugin_target_p (this_element->xvec)) - ok_object = false; - else - #endif -diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp -index cf94570642c..6aa6d2d9fe7 100644 ---- a/binutils/testsuite/binutils-all/objcopy.exp -+++ b/binutils/testsuite/binutils-all/objcopy.exp -@@ -661,6 +661,87 @@ proc strip_test_with_saving_a_symbol { } { - - strip_test_with_saving_a_symbol - -+# Test stripping an archive. -+ -+proc strip_test_archive { } { -+ global AR -+ global CC -+ global STRIP -+ global srcdir -+ global subdir -+ -+ set test "strip -g on archive" -+ -+ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { -+ untested $test -+ return -+ } -+ -+ set stripobjfile tmpdir/striptestprog.o -+ set stripobjarchive testprog.o -+ if [is_remote host] { -+ set archive libstrip.a -+ set objfile [remote_download host tmpdir/testprog.o] -+ remote_file host delete $archive -+ remote_file host delete $stripobjfile -+ remote_file host delete $stripobjarchive -+ } else { -+ set archive tmpdir/libstrip.a -+ set objfile tmpdir/testprog.o -+ remote_file build delete $stripobjfile -+ remote_file build delete $stripobjarchive -+ } -+ -+ remote_file build delete tmpdir/libstrip.a -+ -+ set exec_output [binutils_run $STRIP "-g -o $stripobjfile $objfile"] -+ set exec_output [prune_warnings $exec_output] -+ if ![string equal "" $exec_output] { -+ fail $test -+ return -+ } -+ -+ set exec_output [binutils_run $AR "rc $archive ${objfile}"] -+ set exec_output [prune_warnings $exec_output] -+ if ![string equal "" $exec_output] { -+ fail $test -+ return -+ } -+ -+ set exec_output [binutils_run $STRIP "-g $archive"] -+ set exec_output [prune_warnings $exec_output] -+ if ![string equal "" $exec_output] { -+ fail $test -+ return -+ } -+ -+ set exec_output [binutils_run $AR "x $archive"] -+ set exec_output [prune_warnings $exec_output] -+ if ![string equal "" $exec_output] { -+ fail $test -+ return -+ } -+ -+ if [is_remote host] { -+ set stripobjfile [remote_download host $stripobjfile] -+ set stripobjarchive [remote_download host $stripobjarchive] -+ } -+ -+ send_log "cmp $stripobjarchive $stripobjfile\n" -+ verbose "cmp $stripobjarchive $stripobjfile" -+ set status [remote_exec build cmp "$stripobjarchive $stripobjfile"] -+ set exec_output [lindex $status 1] -+ set exec_output [prune_warnings $exec_output] -+ -+ if [string equal "" $exec_output] then { -+ pass $test -+ } else { -+ fail $test -+ } -+} -+ -+strip_test_archive -+ - # Build a final executable. - - set exe [exeext] --- -2.43.5
