public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2021-07-20 19:53 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2021-07-20 19:53 UTC (permalink / raw
  To: gentoo-commits

commit:     c32b45b7537a82b63613ea95e00f8468d31a25d9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 20 19:52:55 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 20 19:52:55 2021 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=c32b45b7

Renumber patches

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...ch => 0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch} | 0
 ...tch => 0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch} | 0
 ...ch => 0003-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch} | 0
 ...ion.patch => 0004-Gentoo-add-with-extra-soversion-suffix-option.patch} | 0
 ...ch => 0005-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch} | 0
 ...-Pass-hash-style-sysv.patch => 0006-Gentoo-Pass-hash-style-sysv.patch} | 0
 6 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
similarity index 100%
rename from 9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
rename to 9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch

diff --git a/9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
similarity index 100%
rename from 9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
rename to 9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch

diff --git a/9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch b/9999/0003-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
similarity index 100%
rename from 9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
rename to 9999/0003-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch

diff --git a/9999/0006-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0004-Gentoo-add-with-extra-soversion-suffix-option.patch
similarity index 100%
rename from 9999/0006-Gentoo-add-with-extra-soversion-suffix-option.patch
rename to 9999/0004-Gentoo-add-with-extra-soversion-suffix-option.patch

diff --git a/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch b/9999/0005-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
similarity index 100%
rename from 9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
rename to 9999/0005-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch

diff --git a/9999/0009-Gentoo-Pass-hash-style-sysv.patch b/9999/0006-Gentoo-Pass-hash-style-sysv.patch
similarity index 100%
rename from 9999/0009-Gentoo-Pass-hash-style-sysv.patch
rename to 9999/0006-Gentoo-Pass-hash-style-sysv.patch


^ permalink raw reply	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-05-14  7:14 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-05-14  7:14 UTC (permalink / raw
  To: gentoo-commits

commit:     bca64bf5b98dc7bb07a2fb1c470a960ec43fb638
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May 14 07:14:27 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 14 07:14:27 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=bca64bf5

9999: drop now-upstream strip LTO patch

\o/

Signed-off-by: Sam James <sam <AT> gentoo.org>

 9999/0006-strip-lto-plugin.patch | 784 ---------------------------------------
 1 file changed, 784 deletions(-)

diff --git a/9999/0006-strip-lto-plugin.patch b/9999/0006-strip-lto-plugin.patch
deleted file mode 100644
index ac3cdfd..0000000
--- a/9999/0006-strip-lto-plugin.patch
+++ /dev/null
@@ -1,784 +0,0 @@
-https://bugs.gentoo.org/866422
-https://inbox.sourceware.org/binutils/CAMe9rOrW5hQ42pSMkZ9XW1LcDkv++YmG_hWoOUexMDMXZ4kaRw@mail.gmail.com/
-
-From 1e0ffbb5fd03eb10d3c4a77f2d6c05a296f970c8 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sun, 4 May 2025 05:12:46 +0800
-Subject: [PATCH v3] strip: Add GCC LTO IR support
-
-Add GCC LTO IR support to strip by copying GCC LTO IR input as unknown
-object file.  Don't enable LTO plugin in strip unless all LTO sections
-should be removed, assuming all LTO sections will be removed with
--R .gnu.lto_.*.  Add linker LTO tests for strip with --strip-unneeded
-and GCC LTO IR inputs.
-
-binutils/
-
-	PR binutils/21479
-	* objcopy.c: Include "plugin-api.h" and "plugin.h".
-	(lto_sections_removed): New.
-	(command_line_switch): Add OPTION_PLUGIN.
-	(strip_options): Likewise.
-	(strip_usage): Display "--plugin NAME".
-	(copy_unknown_file): New function.
-	(copy_unknown_object): Call copy_unknown_file.
-	(copy_archive): Copy input LTO IR member as unknown object.
-	(copy_file): Set input target to "plugin" for strip if it is
-	unset unless all LTO sections should be removed.  Copy input
-	LTO IR file as unknown file.
-	(strip_main): Call bfd_plugin_set_program_name. Handle
-	OPTION_PLUGIN.  Set lto_sections_removed to true if all GCC
-	LTO sections should be removed.
-	* doc/binutils.texi: Document --plugin for strip.
-
-ld/
-
-	PR binutils/21479
-	* testsuite/ld-plugin/lto-binutils.exp: New file.
-	* testsuite/ld-plugin/strip-1a-fat.c: Likewise.
-	* testsuite/ld-plugin/strip-1a-fat.rd: Likewise.
-	* testsuite/ld-plugin/strip-1b-fat.c: Likewise.
-	* testsuite/ld-plugin/strip-1b-fat.rd: Likewise.
-	* testsuite/ld-plugin/strip-1a.c: Likewise.
-	* testsuite/ld-plugin/strip-1b.c: Likewise.
-	* testsuite/lib/ld-lib.exp (run_cc_link_tests): Add optional
-	trailing ld options.
-
-Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
----
- binutils/doc/binutils.texi              |  21 ++
- binutils/objcopy.c                      | 112 ++++++--
- ld/testsuite/ld-plugin/lto-binutils.exp | 341 ++++++++++++++++++++++++
- ld/testsuite/ld-plugin/strip-1a-fat.c   |   1 +
- ld/testsuite/ld-plugin/strip-1a-fat.rd  |   6 +
- ld/testsuite/ld-plugin/strip-1a.c       |   4 +
- ld/testsuite/ld-plugin/strip-1b-fat.c   |   1 +
- ld/testsuite/ld-plugin/strip-1b-fat.rd  |   5 +
- ld/testsuite/ld-plugin/strip-1b.c       |   3 +
- ld/testsuite/lib/ld-lib.exp             |   9 +-
- 10 files changed, 477 insertions(+), 26 deletions(-)
- create mode 100644 ld/testsuite/ld-plugin/lto-binutils.exp
- create mode 100644 ld/testsuite/ld-plugin/strip-1a-fat.c
- create mode 100644 ld/testsuite/ld-plugin/strip-1a-fat.rd
- create mode 100644 ld/testsuite/ld-plugin/strip-1a.c
- create mode 100644 ld/testsuite/ld-plugin/strip-1b-fat.c
- create mode 100644 ld/testsuite/ld-plugin/strip-1b-fat.rd
- create mode 100644 ld/testsuite/ld-plugin/strip-1b.c
-
-diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
-index 7f041d9deda..d094f7d7091 100644
---- a/binutils/doc/binutils.texi
-+++ b/binutils/doc/binutils.texi
-@@ -3566,6 +3566,7 @@ strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
-       [@option{--keep-section-symbols}]
-       [@option{--keep-file-symbols}]
-       [@option{--only-keep-debug}]
-+      [@option{--plugin} @var{name}]
-       [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
-       [@option{--help}] [@option{--info}]
-       @var{objfile}@dots{}
-@@ -3825,6 +3826,26 @@ currently only supports the presence of one filename containing
- debugging information, not multiple filenames on a one-per-object-file
- basis.
- 
-+@item --plugin @var{name}
-+@cindex plugins
-+Load the plugin called @var{name} to add support for extra target
-+types.  This option is only available if the toolchain has been built
-+with plugin support enabled.
-+
-+If @option{--plugin} is not provided, but plugin support has been
-+enabled then @command{strip} iterates over the files in
-+@file{$@{libdir@}/bfd-plugins} in alphabetic order and the first
-+plugin that claims the object in question is used.
-+
-+Please note that this plugin search directory is @emph{not} the one
-+used by @command{ld}'s @option{-plugin} option.  In order to make
-+@command{strip} use the  linker plugin it must be copied into the
-+@file{$@{libdir@}/bfd-plugins} directory.  For GCC based compilations
-+the linker plugin is called @file{liblto_plugin.so.0.0.0}.  For Clang
-+based compilations it is called @file{LLVMgold.so}.  The GCC plugin
-+is always backwards compatible with earlier versions, so it is
-+sufficient to just copy the newest one.
-+
- @item -V
- @itemx --version
- Show the version number for @command{strip}.
-diff --git a/binutils/objcopy.c b/binutils/objcopy.c
-index 31933e13b7a..9ae6830dff3 100644
---- a/binutils/objcopy.c
-+++ b/binutils/objcopy.c
-@@ -30,6 +30,8 @@
- #include "coff/internal.h"
- #include "libcoff.h"
- #include "safe-ctype.h"
-+#include "plugin-api.h"
-+#include "plugin.h"
- 
- /* FIXME: See bfd/peXXigen.c for why we include an architecture specific
-    header in generic PE code.  */
-@@ -165,6 +167,11 @@ static struct section_list *change_sections;
- /* TRUE if some sections are to be removed.  */
- static bool sections_removed;
- 
-+#if BFD_SUPPORTS_PLUGINS
-+/* TRUE if all GCC LTO sections are to be removed.  */
-+static bool lto_sections_removed;
-+#endif
-+
- /* TRUE if only some sections are to be copied.  */
- static bool sections_copied;
- 
-@@ -359,6 +366,7 @@ enum command_line_switch
-   OPTION_RENAME_SECTION,
-   OPTION_REVERSE_BYTES,
-   OPTION_PE_SECTION_ALIGNMENT,
-+  OPTION_PLUGIN,
-   OPTION_SET_SECTION_FLAGS,
-   OPTION_SET_SECTION_ALIGNMENT,
-   OPTION_SET_START,
-@@ -402,6 +410,7 @@ static struct option strip_options[] =
-   {"output-file", required_argument, 0, 'o'},
-   {"output-format", required_argument, 0, 'O'},	/* Obsolete */
-   {"output-target", required_argument, 0, 'O'},
-+  {"plugin", required_argument, 0, OPTION_PLUGIN},
-   {"preserve-dates", no_argument, 0, 'p'},
-   {"remove-section", required_argument, 0, 'R'},
-   {"remove-relocations", required_argument, 0, OPTION_REMOVE_RELOCS},
-@@ -758,6 +767,10 @@ strip_usage (FILE *stream, int exit_status)
-      --info                        List object formats & architectures supported\n\
-   -o <file>                        Place stripped output into <file>\n\
- "));
-+#if BFD_SUPPORTS_PLUGINS
-+  fprintf (stream, _("\
-+      --plugin NAME                Load the specified plugin\n"));
-+#endif
- 
-   list_supported_targets (program_name, stream);
-   if (REPORT_BUGS_TO[0] && exit_status == 0)
-@@ -1916,20 +1929,11 @@ add_redefine_syms_file (const char *filename)
-    Returns TRUE upon success, FALSE otherwise.  */
- 
- static bool
--copy_unknown_object (bfd *ibfd, bfd *obfd)
-+copy_unknown_file (bfd *ibfd, bfd *obfd, off_t size, unsigned int mode)
- {
-   char *cbuf;
-   bfd_size_type tocopy;
--  off_t size;
--  struct stat buf;
--
--  if (bfd_stat_arch_elt (ibfd, &buf) != 0)
--    {
--      bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
--      return false;
--    }
- 
--  size = buf.st_size;
-   if (size < 0)
-     {
-       non_fatal (_("stat returns negative size for `%s'"),
-@@ -1974,11 +1978,31 @@ copy_unknown_object (bfd *ibfd, bfd *obfd)
- 
-   /* We should at least to be able to read it back when copying an
-      unknown object in an archive.  */
--  chmod (bfd_get_filename (obfd), buf.st_mode | S_IRUSR);
-+  chmod (bfd_get_filename (obfd), mode | S_IRUSR);
-   free (cbuf);
-   return true;
- }
- 
-+/* Copy unknown object file archive member IBFD onto OBFD.
-+   Returns TRUE upon success, FALSE otherwise.  */
-+
-+static bool
-+copy_unknown_object (bfd *ibfd, bfd *obfd)
-+{
-+  struct stat buf;
-+
-+  if (bfd_stat_arch_elt (ibfd, &buf) != 0)
-+    {
-+      bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
-+      return false;
-+    }
-+
-+  if (!copy_unknown_file (ibfd, obfd, buf.st_size, buf.st_mode))
-+    return false;
-+
-+  return true;
-+}
-+
- typedef struct objcopy_internal_note
- {
-   Elf_Internal_Note  note;
-@@ -3744,7 +3768,10 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
- 	  goto cleanup_and_exit;
- 	}
- 
--      if (ok_object)
-+      /* Copy LTO IR file as unknown object.  */
-+      if (bfd_plugin_target_p (ibfd->xvec))
-+	ok_object = false;
-+      else if (ok_object)
- 	{
- 	  ok = copy_object (this_element, output_element, input_arch);
- 
-@@ -3845,6 +3872,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
-   char **obj_matching;
-   char **core_matching;
-   off_t size = get_file_size (input_filename);
-+  const char *target = input_target;
- 
-   if (size < 1)
-     {
-@@ -3855,9 +3883,16 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
-       return;
-     }
- 
-+#if BFD_SUPPORTS_PLUGINS
-+  /* Enable LTO plugin in strip unless all LTO sections should be
-+     removed.  */
-+  if (is_strip && !target && !lto_sections_removed)
-+    target = "plugin";
-+#endif
-+
-   /* To allow us to do "strip *" without dying on the first
-      non-object file, failures are nonfatal.  */
--  ibfd = bfd_openr (input_filename, input_target);
-+  ibfd = bfd_openr (input_filename, target);
-   if (ibfd == NULL || bfd_stat (ibfd, in_stat) != 0)
-     {
-       bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
-@@ -3974,17 +4009,29 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
-  	  return;
-  	}
- 
--      if (! copy_object (ibfd, obfd, input_arch))
--	status = 1;
--
--      /* PR 17512: file: 0f15796a.
--	 If the file could not be copied it may not be in a writeable
--	 state.  So use bfd_close_all_done to avoid the possibility of
--	 writing uninitialised data into the file.  */
--      if (! (status ? bfd_close_all_done (obfd) : bfd_close (obfd)))
-+      if (bfd_plugin_target_p (ibfd->xvec))
- 	{
--	  status = 1;
--	  bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
-+	  /* Copy LTO IR file as unknown file.  */
-+	  if (!copy_unknown_file (ibfd, obfd, in_stat->st_size,
-+				  in_stat->st_mode))
-+	    status = 1;
-+	  else if (!bfd_close_all_done (obfd))
-+	    status = 1;
-+	}
-+      else
-+	{
-+	  if (! copy_object (ibfd, obfd, input_arch))
-+	    status = 1;
-+
-+	  /* PR 17512: file: 0f15796a.
-+	     If the file could not be copied it may not be in a writeable
-+	     state.  So use bfd_close_all_done to avoid the possibility of
-+	     writing uninitialised data into the file.  */
-+	  if (! (status ? bfd_close_all_done (obfd) : bfd_close (obfd)))
-+	    {
-+	      status = 1;
-+	      bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
-+	    }
- 	}
- 
-       if (!bfd_close (ibfd))
-@@ -4837,6 +4884,10 @@ strip_main (int argc, char *argv[])
-   char *output_file = NULL;
-   bool merge_notes_set = false;
- 
-+#if BFD_SUPPORTS_PLUGINS
-+  bfd_plugin_set_program_name (argv[0]);
-+#endif
-+
-   while ((c = getopt_long (argc, argv, "I:O:F:K:MN:R:o:sSpdgxXHhVvwDU",
- 			   strip_options, (int *) 0)) != EOF)
-     {
-@@ -4927,6 +4978,13 @@ strip_main (int argc, char *argv[])
- 	case OPTION_KEEP_SECTION_SYMBOLS:
- 	  keep_section_symbols = true;
- 	  break;
-+	case OPTION_PLUGIN:	/* --plugin */
-+#if BFD_SUPPORTS_PLUGINS
-+	  bfd_plugin_set_plugin (optarg);
-+#else
-+	  fatal (_("sorry - this program has been built without plugin support\n"));
-+#endif
-+	  break;
- 	case 0:
- 	  /* We've been given a long option.  */
- 	  break;
-@@ -4971,6 +5029,14 @@ strip_main (int argc, char *argv[])
-   if (output_target == NULL)
-     output_target = input_target;
- 
-+#if BFD_SUPPORTS_PLUGINS
-+  /* Check if all GCC LTO sections should be removed, assuming all LTO
-+     sections will be removed with -R .gnu.lto_.*.  * Remove .gnu.lto_.*
-+     sections will also remove .gnu.debuglto_.  sections.  */
-+  lto_sections_removed = !!find_section_list (".gnu.lto_.*", false,
-+					      SECTION_CONTEXT_REMOVE);
-+#endif
-+
-   i = optind;
-   if (i == argc
-       || (output_file != NULL && (i + 1) < argc))
-diff --git a/ld/testsuite/ld-plugin/lto-binutils.exp b/ld/testsuite/ld-plugin/lto-binutils.exp
-new file mode 100644
-index 00000000000..db18a63a7b5
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-binutils.exp
-@@ -0,0 +1,341 @@
-+# Expect script for binutils tests with LTO
-+# Copyright (C) 2025 Free Software Foundation, Inc.
-+#
-+# This file is part of the GNU Binutils.
-+#
-+# 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.
-+#
-+
-+# Make sure that binutils can correctly handle LTO IR in ELF.
-+
-+if { !([istarget *-*-linux*]
-+       || [istarget arm*-*-uclinuxfdpiceabi]
-+       || [istarget *-*-nacl*]
-+       || [istarget *-*-gnu*]) || [istarget *ecoff] } then {
-+    return
-+}
-+
-+# Check to see if the C and C++ compilers work
-+if { ![check_compiler_available] || [which $CXX_FOR_TARGET] == 0 } {
-+    return
-+}
-+
-+# These tests require plugin and LTO.
-+if { ![check_plugin_api_available]
-+     || ![check_lto_available] } {
-+    return
-+}
-+
-+set lto_fat ""
-+set lto_no_fat ""
-+if { [check_lto_fat_available] } {
-+  set lto_fat "-ffat-lto-objects"
-+  set lto_no_fat "-fno-fat-lto-objects"
-+  set no_lto "-fno-lto"
-+}
-+
-+set lto_plugin [string trim [run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so"]]
-+
-+# List contains test-items:
-+#  0:program name
-+#  1:program options
-+#  2:input file
-+#  3:output file
-+#  4:action list (optional)
-+#
-+proc run_lto_binutils_test { lto_tests } {
-+    global srcdir
-+    global subdir
-+    global nm
-+    global objcopy
-+    global objdump
-+    global READELF
-+    global strip
-+    global lto_plugin
-+
-+    foreach testitem $lto_tests {
-+	set prog_name [lindex $testitem 0]
-+	set prog_options [lindex $testitem 1]
-+	set input tmpdir/[lindex $testitem 2]
-+	set output tmpdir/[lindex $testitem 3]
-+	set actions [lindex $testitem 4]
-+	set objfiles {}
-+	set is_unresolved 0
-+	set failed 0
-+
-+#	eval set prog \$$prog_name
-+	switch -- $prog_name {
-+	objcopy
-+	    {
-+		set prog $objcopy
-+		set prog_output "$output"
-+	    }
-+	strip
-+	    {
-+		set prog $strip
-+		set prog_output "-o $output"
-+	    }
-+	default
-+	    {
-+		perror "Unrecognized action $action"
-+		set is_unresolved 1
-+		break
-+	    }
-+	}
-+
-+	# Don't leave previous output around
-+	if { $output ne "tmpdir/" } {
-+	    remote_file host delete $output
-+	}
-+
-+	append prog_options " --plugin $lto_plugin"
-+
-+	set cmd_options "$prog_options $prog_output $input"
-+	set test_name "$prog_name $cmd_options"
-+
-+	set cmd "$prog $cmd_options"
-+	send_log "$cmd\n"
-+	set got [remote_exec host "$cmd"]
-+	if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
-+	    send_log "$got\n"
-+	    fail "$test_name"
-+	    continue
-+	}
-+
-+	if { $failed == 0 } {
-+	    foreach actionlist $actions {
-+		set action [lindex $actionlist 0]
-+		set progopts [lindex $actionlist 1]
-+
-+		# There are actions where we run regexp_diff on the
-+		# output, and there are other actions (presumably).
-+		# Handling of the former look the same.
-+		set dump_prog ""
-+		switch -- $action {
-+		    objdump
-+			{ set dump_prog $objdump }
-+		    nm
-+			{ set dump_prog $nm }
-+		    readelf
-+			{ set dump_prog $READELF }
-+		    default
-+			{
-+			    perror "Unrecognized action $action"
-+			    set is_unresolved 1
-+			    break
-+			}
-+		    }
-+
-+		if { $dump_prog != "" } {
-+		    set dumpfile [lindex $actionlist 2]
-+		    set binary $dump_prog
-+
-+		    # Ensure consistent sorting of symbols
-+		    if {[info exists env(LC_ALL)]} {
-+			set old_lc_all $env(LC_ALL)
-+		    }
-+		    set env(LC_ALL) "C"
-+		    set cmd "$binary $progopts $output > tmpdir/dump.out"
-+		    send_log "$cmd\n"
-+		    catch "exec $cmd" comp_output
-+		    if {[info exists old_lc_all]} {
-+			set env(LC_ALL) $old_lc_all
-+		    } else {
-+			unset env(LC_ALL)
-+		    }
-+		    set comp_output [prune_warnings $comp_output]
-+
-+		    if ![string match "" $comp_output] then {
-+			send_log "$comp_output\n"
-+			set failed 1
-+			break
-+		    }
-+
-+		    if { [regexp_diff "tmpdir/dump.out" "$srcdir/$subdir/$dumpfile"] } then {
-+			verbose -log "output is [file_contents "tmpdir/dump.out"]" 2
-+			set failed 1
-+			break
-+		    }
-+		}
-+	    }
-+	}
-+
-+	if { $failed } {
-+	    fail $test_name
-+	} elseif { $is_unresolved } {
-+	    unresolved $test_name
-+	} else {
-+	    pass $test_name
-+	}
-+    }
-+}
-+
-+run_cc_link_tests [list \
-+    [list \
-+	"Build strip-1a.o" \
-+	"" \
-+	"-O2 -flto $lto_no_fat" \
-+	{ strip-1a.c } \
-+    ] \
-+    [list \
-+	"Build libstrip-1a.a" \
-+	"--plugin $lto_plugin" \
-+	"-O2 -flto $lto_no_fat" \
-+	{ strip-1a.c } \
-+	{} \
-+	"libstrip-1a.a" \
-+    ] \
-+    [list \
-+	"Build strip-1a-fat.o" \
-+	"" \
-+	"-O2 -flto $lto_fat" \
-+	{ strip-1a-fat.c } \
-+    ] \
-+    [list \
-+	"Build libstrip-1a-fat.a" \
-+	"--plugin $lto_plugin" \
-+	"-O2 -flto $lto_fat" \
-+	{ strip-1a-fat.c } \
-+	{} \
-+	"libstrip-1a-fat.a" \
-+    ] \
-+]
-+
-+run_lto_binutils_test [list \
-+    [list \
-+	"strip" \
-+	"--strip-unneeded" \
-+	"libstrip-1a.a" \
-+	"libstrip-1a-s.a" \
-+    ] \
-+    [list \
-+	"strip" \
-+	"--strip-unneeded" \
-+	"strip-1a.o" \
-+	"strip-1a-s.o" \
-+    ] \
-+    [list \
-+	"strip" \
-+	"--strip-unneeded -R .gnu.*lto_* -N __gnu_lto_v1" \
-+	"libstrip-1a-fat.a" \
-+	"libstrip-1a-fat-s.a" \
-+	{{readelf -SW strip-1a-fat.rd}} \
-+    ] \
-+    [list \
-+	"strip" \
-+	"--strip-unneeded -R .gnu.*lto_* -N __gnu_lto_v1" \
-+	"strip-1a-fat.o" \
-+	"strip-1a-fat-s.o" \
-+	{{readelf -SW strip-1a-fat.rd}} \
-+    ] \
-+    [list \
-+	"strip" \
-+	"--strip-unneeded -R .gnu.debuglto_*" \
-+	"libstrip-1a-fat.a" \
-+	"libstrip-1b-fat-s.a" \
-+	{{readelf -SW strip-1b-fat.rd}} \
-+    ] \
-+    [list \
-+	"strip" \
-+	"--strip-unneeded -R .gnu.debuglto_*" \
-+	"strip-1a-fat.o" \
-+	"strip-1b-fat-s.o" \
-+	{{readelf -SW strip-1b-fat.rd}} \
-+    ] \
-+]
-+
-+run_cc_link_tests [list \
-+    [list \
-+	"Build strip-1a (strip-1a.o)" \
-+	"" \
-+	"-O2 -flto $lto_no_fat" \
-+	{ strip-1b.c } \
-+	{} \
-+	"libstrip-1a" \
-+	"C" \
-+	"tmpdir/strip-1a.o" \
-+    ] \
-+    [list \
-+	"Build strip-1b (strip-1a-s.o)" \
-+	"" \
-+	"-O2 -flto $lto_no_fat" \
-+	{ strip-1b.c } \
-+	{} \
-+	"libstrip-1b" \
-+	"C" \
-+	"tmpdir/strip-1a-s.o" \
-+    ] \
-+    [list \
-+	"Build strip-1c (libstrip-1a.a)" \
-+	"" \
-+	"-O2 -flto $lto_no_fat" \
-+	{ strip-1b.c } \
-+	{} \
-+	"libstrip-1c" \
-+	"C" \
-+	"tmpdir/libstrip-1a.a" \
-+    ] \
-+    [list \
-+	"Build strip-1d (libstrip-1a-s.a)" \
-+	"" \
-+	"-O2 -flto $lto_no_fat" \
-+	{ strip-1b.c } \
-+	{} \
-+	"libstrip-1d" \
-+	"C" \
-+	"tmpdir/libstrip-1a-s.a" \
-+    ] \
-+    [list \
-+	"Build strip-1e (strip-1a-fat-s.o)" \
-+	"" \
-+	"-O2 -flto $lto_fat" \
-+	{ strip-1b-fat.c } \
-+	{} \
-+	"libstrip-1e" \
-+	"C" \
-+	"tmpdir/strip-1a-fat-s.o" \
-+    ] \
-+    [list \
-+	"Build strip-1f (libstrip-1a-fat-s.a)" \
-+	"" \
-+	"-O2 -flto $lto_fat" \
-+	{ strip-1b-fat.c } \
-+	{} \
-+	"libstrip-1f" \
-+	"C" \
-+	"tmpdir/libstrip-1a-fat-s.a" \
-+    ] \
-+    [list \
-+	"Build strip-1g (strip-1b-fat-s.o)" \
-+	"" \
-+	"-O2 -flto $lto_fat" \
-+	{ strip-1b-fat.c } \
-+	{} \
-+	"libstrip-1g" \
-+	"C" \
-+	"tmpdir/strip-1b-fat-s.o" \
-+    ] \
-+    [list \
-+	"Build strip-1h (libstrip-1b-fat-s.a)" \
-+	"" \
-+	"-O2 -flto $lto_fat" \
-+	{ strip-1b-fat.c } \
-+	{} \
-+	"libstrip-1h" \
-+	"C" \
-+	"tmpdir/libstrip-1b-fat-s.a" \
-+    ] \
-+]
-diff --git a/ld/testsuite/ld-plugin/strip-1a-fat.c b/ld/testsuite/ld-plugin/strip-1a-fat.c
-new file mode 100644
-index 00000000000..03b2a5c2275
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/strip-1a-fat.c
-@@ -0,0 +1 @@
-+#include "strip-1a.c"
-diff --git a/ld/testsuite/ld-plugin/strip-1a-fat.rd b/ld/testsuite/ld-plugin/strip-1a-fat.rd
-new file mode 100644
-index 00000000000..aefe1c55013
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/strip-1a-fat.rd
-@@ -0,0 +1,6 @@
-+#failif
-+#...
-+Section Headers:
-+#...
-+  \[[ 0-9]+\] \.gnu.lto_.*
-+#...
-diff --git a/ld/testsuite/ld-plugin/strip-1a.c b/ld/testsuite/ld-plugin/strip-1a.c
-new file mode 100644
-index 00000000000..d84af205338
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/strip-1a.c
-@@ -0,0 +1,4 @@
-+extern void foo2(void);
-+extern void foo3(void);
-+void foo1(void) { foo3(); }
-+int main(void) { foo2(); }
-diff --git a/ld/testsuite/ld-plugin/strip-1b-fat.c b/ld/testsuite/ld-plugin/strip-1b-fat.c
-new file mode 100644
-index 00000000000..1a2e4d2d86a
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/strip-1b-fat.c
-@@ -0,0 +1 @@
-+#include "strip-1b.c"
-diff --git a/ld/testsuite/ld-plugin/strip-1b-fat.rd b/ld/testsuite/ld-plugin/strip-1b-fat.rd
-new file mode 100644
-index 00000000000..e3a266f8bee
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/strip-1b-fat.rd
-@@ -0,0 +1,5 @@
-+#...
-+Section Headers:
-+#...
-+  \[[ 0-9]+\] \.gnu.lto_.*
-+#pass
-diff --git a/ld/testsuite/ld-plugin/strip-1b.c b/ld/testsuite/ld-plugin/strip-1b.c
-new file mode 100644
-index 00000000000..967872a0f12
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/strip-1b.c
-@@ -0,0 +1,3 @@
-+extern void foo1(void);
-+void foo2(void) { foo1(); }
-+void foo3(void) {}
-diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index 96152718d6f..119410bc523 100644
---- a/ld/testsuite/lib/ld-lib.exp
-+++ b/ld/testsuite/lib/ld-lib.exp
-@@ -860,14 +860,15 @@ proc run_ld_link_exec_tests { ldtests args } {
- }
- 
- # List contains test-items with 3 items followed by 2 lists, one item and
--# one optional item:
-+# 2 optional items:
- #  0:name
--#  1:ld or ar options
-+#  1:leading ld or ar options
- #  2:compile options
- #  3:filenames of source files
- #  4:action and options.
- #  5:name of output file
- #  6:language (optional)
-+#  7:trailing ld options (optional), placed after object files
- #
- # Actions:
- # objdump: Apply objdump options on result.  Compare with regex (last arg).
-@@ -899,6 +900,7 @@ proc run_cc_link_tests { ldtests } {
- 	set actions [lindex $testitem 4]
- 	set binfile tmpdir/[lindex $testitem 5]
- 	set lang [lindex $testitem 6]
-+	set trailing_ldflags [lindex $testitem 7]
- 	set objfiles {}
- 	set is_unresolved 0
- 	set failed 0
-@@ -927,6 +929,7 @@ proc run_cc_link_tests { ldtests } {
- 	#verbose -log "actions   is $actions"
- 	#verbose -log "binfile   is $binfile"
- 	#verbose -log "lang      is $lang"
-+	#verbose -log "trailing_ldflags is $trailing_ldflags"
- 
- 	foreach actionlist $actions {
- 	    set action [lindex $actionlist 0]
-@@ -1006,7 +1009,7 @@ proc run_cc_link_tests { ldtests } {
- 		untested $testname
- 		continue
- 	    }
--	    ld_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"
-+	    ld_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles $trailing_ldflags"
- 	    set ld_output "$exec_output"
- 
- 	    if { $check_ld(source) == "regexp" } then {
--- 
-2.49.0
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-05-14  3:59 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-05-14  3:59 UTC (permalink / raw
  To: gentoo-commits

commit:     f7d21e0bc037916a14b50584e9f23b64e5d3ce50
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May 14 03:59:20 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 14 03:59:20 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=f7d21e0b

9999: refresh LTO strip patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 9999/0006-strip-lto-plugin.patch | 64 ++++++++++++++++++----------------------
 1 file changed, 29 insertions(+), 35 deletions(-)

diff --git a/9999/0006-strip-lto-plugin.patch b/9999/0006-strip-lto-plugin.patch
index 06480f4..ac3cdfd 100644
--- a/9999/0006-strip-lto-plugin.patch
+++ b/9999/0006-strip-lto-plugin.patch
@@ -1,10 +1,10 @@
 https://bugs.gentoo.org/866422
-https://inbox.sourceware.org/binutils/CAMe9rOq_LMn22bBNAQs2=-vDxEaONziAPEvuCAJy1K3+Chu7_g@mail.gmail.com/
+https://inbox.sourceware.org/binutils/CAMe9rOrW5hQ42pSMkZ9XW1LcDkv++YmG_hWoOUexMDMXZ4kaRw@mail.gmail.com/
 
-From 55472ad8a1329a22c1b6fc97021b36059a73de61 Mon Sep 17 00:00:00 2001
+From 1e0ffbb5fd03eb10d3c4a77f2d6c05a296f970c8 Mon Sep 17 00:00:00 2001
 From: "H.J. Lu" <hjl.tools@gmail.com>
 Date: Sun, 4 May 2025 05:12:46 +0800
-Subject: [PATCH] strip: Add GCC LTO IR support
+Subject: [PATCH v3] strip: Add GCC LTO IR support
 
 Add GCC LTO IR support to strip by copying GCC LTO IR input as unknown
 object file.  Don't enable LTO plugin in strip unless all LTO sections
@@ -47,7 +47,7 @@ ld/
 Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
 ---
  binutils/doc/binutils.texi              |  21 ++
- binutils/objcopy.c                      | 119 +++++++--
+ binutils/objcopy.c                      | 112 ++++++--
  ld/testsuite/ld-plugin/lto-binutils.exp | 341 ++++++++++++++++++++++++
  ld/testsuite/ld-plugin/strip-1a-fat.c   |   1 +
  ld/testsuite/ld-plugin/strip-1a-fat.rd  |   6 +
@@ -56,7 +56,7 @@ Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
  ld/testsuite/ld-plugin/strip-1b-fat.rd  |   5 +
  ld/testsuite/ld-plugin/strip-1b.c       |   3 +
  ld/testsuite/lib/ld-lib.exp             |   9 +-
- 10 files changed, 484 insertions(+), 26 deletions(-)
+ 10 files changed, 477 insertions(+), 26 deletions(-)
  create mode 100644 ld/testsuite/ld-plugin/lto-binutils.exp
  create mode 100644 ld/testsuite/ld-plugin/strip-1a-fat.c
  create mode 100644 ld/testsuite/ld-plugin/strip-1a-fat.rd
@@ -66,7 +66,7 @@ Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
  create mode 100644 ld/testsuite/ld-plugin/strip-1b.c
 
 diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
-index c74526e929a..05a10d20924 100644
+index 7f041d9deda..d094f7d7091 100644
 --- a/binutils/doc/binutils.texi
 +++ b/binutils/doc/binutils.texi
 @@ -3566,6 +3566,7 @@ strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
@@ -105,7 +105,7 @@ index c74526e929a..05a10d20924 100644
  @itemx --version
  Show the version number for @command{strip}.
 diff --git a/binutils/objcopy.c b/binutils/objcopy.c
-index 31933e13b7a..1396dd10bbe 100644
+index 31933e13b7a..9ae6830dff3 100644
 --- a/binutils/objcopy.c
 +++ b/binutils/objcopy.c
 @@ -30,6 +30,8 @@
@@ -117,17 +117,19 @@ index 31933e13b7a..1396dd10bbe 100644
  
  /* FIXME: See bfd/peXXigen.c for why we include an architecture specific
     header in generic PE code.  */
-@@ -165,6 +167,9 @@ static struct section_list *change_sections;
+@@ -165,6 +167,11 @@ static struct section_list *change_sections;
  /* TRUE if some sections are to be removed.  */
  static bool sections_removed;
  
++#if BFD_SUPPORTS_PLUGINS
 +/* TRUE if all GCC LTO sections are to be removed.  */
 +static bool lto_sections_removed;
++#endif
 +
  /* TRUE if only some sections are to be copied.  */
  static bool sections_copied;
  
-@@ -359,6 +364,7 @@ enum command_line_switch
+@@ -359,6 +366,7 @@ enum command_line_switch
    OPTION_RENAME_SECTION,
    OPTION_REVERSE_BYTES,
    OPTION_PE_SECTION_ALIGNMENT,
@@ -135,7 +137,7 @@ index 31933e13b7a..1396dd10bbe 100644
    OPTION_SET_SECTION_FLAGS,
    OPTION_SET_SECTION_ALIGNMENT,
    OPTION_SET_START,
-@@ -402,6 +408,7 @@ static struct option strip_options[] =
+@@ -402,6 +410,7 @@ static struct option strip_options[] =
    {"output-file", required_argument, 0, 'o'},
    {"output-format", required_argument, 0, 'O'},	/* Obsolete */
    {"output-target", required_argument, 0, 'O'},
@@ -143,7 +145,7 @@ index 31933e13b7a..1396dd10bbe 100644
    {"preserve-dates", no_argument, 0, 'p'},
    {"remove-section", required_argument, 0, 'R'},
    {"remove-relocations", required_argument, 0, OPTION_REMOVE_RELOCS},
-@@ -758,6 +765,10 @@ strip_usage (FILE *stream, int exit_status)
+@@ -758,6 +767,10 @@ strip_usage (FILE *stream, int exit_status)
       --info                        List object formats & architectures supported\n\
    -o <file>                        Place stripped output into <file>\n\
  "));
@@ -154,7 +156,7 @@ index 31933e13b7a..1396dd10bbe 100644
  
    list_supported_targets (program_name, stream);
    if (REPORT_BUGS_TO[0] && exit_status == 0)
-@@ -1916,20 +1927,11 @@ add_redefine_syms_file (const char *filename)
+@@ -1916,20 +1929,11 @@ add_redefine_syms_file (const char *filename)
     Returns TRUE upon success, FALSE otherwise.  */
  
  static bool
@@ -165,18 +167,18 @@ index 31933e13b7a..1396dd10bbe 100644
    bfd_size_type tocopy;
 -  off_t size;
 -  struct stat buf;
- 
+-
 -  if (bfd_stat_arch_elt (ibfd, &buf) != 0)
 -    {
 -      bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
 -      return false;
 -    }
--
+ 
 -  size = buf.st_size;
    if (size < 0)
      {
        non_fatal (_("stat returns negative size for `%s'"),
-@@ -1974,11 +1976,40 @@ copy_unknown_object (bfd *ibfd, bfd *obfd)
+@@ -1974,11 +1978,31 @@ copy_unknown_object (bfd *ibfd, bfd *obfd)
  
    /* We should at least to be able to read it back when copying an
       unknown object in an archive.  */
@@ -192,7 +194,6 @@ index 31933e13b7a..1396dd10bbe 100644
 +static bool
 +copy_unknown_object (bfd *ibfd, bfd *obfd)
 +{
-+  off_t size;
 +  struct stat buf;
 +
 +  if (bfd_stat_arch_elt (ibfd, &buf) != 0)
@@ -201,15 +202,7 @@ index 31933e13b7a..1396dd10bbe 100644
 +      return false;
 +    }
 +
-+  size = buf.st_size;
-+  if (size < 0)
-+    {
-+      non_fatal (_("stat returns negative size for `%s'"),
-+		 bfd_get_archive_filename (ibfd));
-+      return false;
-+    }
-+
-+  if (!copy_unknown_file (ibfd, obfd, size, buf.st_mode))
++  if (!copy_unknown_file (ibfd, obfd, buf.st_size, buf.st_mode))
 +    return false;
 +
 +  return true;
@@ -218,7 +211,7 @@ index 31933e13b7a..1396dd10bbe 100644
  typedef struct objcopy_internal_note
  {
    Elf_Internal_Note  note;
-@@ -3744,7 +3775,10 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
+@@ -3744,7 +3768,10 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
  	  goto cleanup_and_exit;
  	}
  
@@ -230,7 +223,7 @@ index 31933e13b7a..1396dd10bbe 100644
  	{
  	  ok = copy_object (this_element, output_element, input_arch);
  
-@@ -3845,6 +3879,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
+@@ -3845,6 +3872,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
    char **obj_matching;
    char **core_matching;
    off_t size = get_file_size (input_filename);
@@ -238,7 +231,7 @@ index 31933e13b7a..1396dd10bbe 100644
  
    if (size < 1)
      {
-@@ -3855,9 +3890,16 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
+@@ -3855,9 +3883,16 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
        return;
      }
  
@@ -256,7 +249,7 @@ index 31933e13b7a..1396dd10bbe 100644
    if (ibfd == NULL || bfd_stat (ibfd, in_stat) != 0)
      {
        bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
-@@ -3974,17 +4016,29 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
+@@ -3974,17 +4009,29 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
   	  return;
   	}
  
@@ -296,7 +289,7 @@ index 31933e13b7a..1396dd10bbe 100644
  	}
  
        if (!bfd_close (ibfd))
-@@ -4837,6 +4891,10 @@ strip_main (int argc, char *argv[])
+@@ -4837,6 +4884,10 @@ strip_main (int argc, char *argv[])
    char *output_file = NULL;
    bool merge_notes_set = false;
  
@@ -307,7 +300,7 @@ index 31933e13b7a..1396dd10bbe 100644
    while ((c = getopt_long (argc, argv, "I:O:F:K:MN:R:o:sSpdgxXHhVvwDU",
  			   strip_options, (int *) 0)) != EOF)
      {
-@@ -4927,6 +4985,13 @@ strip_main (int argc, char *argv[])
+@@ -4927,6 +4978,13 @@ strip_main (int argc, char *argv[])
  	case OPTION_KEEP_SECTION_SYMBOLS:
  	  keep_section_symbols = true;
  	  break;
@@ -321,7 +314,7 @@ index 31933e13b7a..1396dd10bbe 100644
  	case 0:
  	  /* We've been given a long option.  */
  	  break;
-@@ -4971,6 +5036,14 @@ strip_main (int argc, char *argv[])
+@@ -4971,6 +5029,14 @@ strip_main (int argc, char *argv[])
    if (output_target == NULL)
      output_target = input_target;
  
@@ -338,7 +331,7 @@ index 31933e13b7a..1396dd10bbe 100644
        || (output_file != NULL && (i + 1) < argc))
 diff --git a/ld/testsuite/ld-plugin/lto-binutils.exp b/ld/testsuite/ld-plugin/lto-binutils.exp
 new file mode 100644
-index 00000000000..c475d42b728
+index 00000000000..db18a63a7b5
 --- /dev/null
 +++ b/ld/testsuite/ld-plugin/lto-binutils.exp
 @@ -0,0 +1,341 @@
@@ -653,9 +646,9 @@ index 00000000000..c475d42b728
 +	"tmpdir/strip-1a-fat-s.o" \
 +    ] \
 +    [list \
-+	"Build strip-1f" \
++	"Build strip-1f (libstrip-1a-fat-s.a)" \
 +	"" \
-+	"-O2 -flto $lto_fat (libstrip-1a-fat-s.a)" \
++	"-O2 -flto $lto_fat" \
 +	{ strip-1b-fat.c } \
 +	{} \
 +	"libstrip-1f" \
@@ -788,3 +781,4 @@ index 96152718d6f..119410bc523 100644
  	    if { $check_ld(source) == "regexp" } then {
 -- 
 2.49.0
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-05-05  9:46 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-05-05  9:46 UTC (permalink / raw
  To: gentoo-commits

commit:     15b090aa1cb5d2522cb317db004d42ffd6180f2f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May  5 09:46:16 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May  5 09:46:16 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=15b090aa

9999: add ML reference to strip patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 9999/0006-strip-lto-plugin.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/9999/0006-strip-lto-plugin.patch b/9999/0006-strip-lto-plugin.patch
index ae85de1..06480f4 100644
--- a/9999/0006-strip-lto-plugin.patch
+++ b/9999/0006-strip-lto-plugin.patch
@@ -1,5 +1,5 @@
 https://bugs.gentoo.org/866422
-https://sourceware.org/bugzilla/show_bug.cgi?id=21479#c11
+https://inbox.sourceware.org/binutils/CAMe9rOq_LMn22bBNAQs2=-vDxEaONziAPEvuCAJy1K3+Chu7_g@mail.gmail.com/
 
 From 55472ad8a1329a22c1b6fc97021b36059a73de61 Mon Sep 17 00:00:00 2001
 From: "H.J. Lu" <hjl.tools@gmail.com>


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-05-05  3:06 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-05-05  3:06 UTC (permalink / raw
  To: gentoo-commits

commit:     50adca177a5923795d493308ae2b4cedfbeaa15b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May  5 03:05:58 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May  5 03:05:58 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=50adca17

9999: update strip patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 9999/0006-strip-lto-plugin.patch | 141 +++++++++++++++++++++++++--------------
 1 file changed, 90 insertions(+), 51 deletions(-)

diff --git a/9999/0006-strip-lto-plugin.patch b/9999/0006-strip-lto-plugin.patch
index 962be2d..ae85de1 100644
--- a/9999/0006-strip-lto-plugin.patch
+++ b/9999/0006-strip-lto-plugin.patch
@@ -1,15 +1,16 @@
 https://bugs.gentoo.org/866422
-https://sourceware.org/bugzilla/show_bug.cgi?id=21479#c10
+https://sourceware.org/bugzilla/show_bug.cgi?id=21479#c11
 
-From 245176a7d6a92ab5283887a28a375c47585e41ee Mon Sep 17 00:00:00 2001
+From 55472ad8a1329a22c1b6fc97021b36059a73de61 Mon Sep 17 00:00:00 2001
 From: "H.J. Lu" <hjl.tools@gmail.com>
 Date: Sun, 4 May 2025 05:12:46 +0800
-Subject: [PATCH] strip: Add LTO IR support
+Subject: [PATCH] strip: Add GCC LTO IR support
 
-Add LTO IR support to strip by copying LTO IR input as unknown object
-file.  Don't enable LTO plugin in strip unless all LTO sections should
-be removed.  Add linker LTO tests for strip with --strip-unneeded and
-removing all LTO section.
+Add GCC LTO IR support to strip by copying GCC LTO IR input as unknown
+object file.  Don't enable LTO plugin in strip unless all LTO sections
+should be removed, assuming all LTO sections will be removed with
+-R .gnu.lto_.*.  Add linker LTO tests for strip with --strip-unneeded
+and GCC LTO IR inputs.
 
 binutils/
 
@@ -46,8 +47,8 @@ ld/
 Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
 ---
  binutils/doc/binutils.texi              |  21 ++
- binutils/objcopy.c                      | 130 +++++++++--
- ld/testsuite/ld-plugin/lto-binutils.exp | 292 ++++++++++++++++++++++++
+ binutils/objcopy.c                      | 119 +++++++--
+ ld/testsuite/ld-plugin/lto-binutils.exp | 341 ++++++++++++++++++++++++
  ld/testsuite/ld-plugin/strip-1a-fat.c   |   1 +
  ld/testsuite/ld-plugin/strip-1a-fat.rd  |   6 +
  ld/testsuite/ld-plugin/strip-1a.c       |   4 +
@@ -55,7 +56,7 @@ Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
  ld/testsuite/ld-plugin/strip-1b-fat.rd  |   5 +
  ld/testsuite/ld-plugin/strip-1b.c       |   3 +
  ld/testsuite/lib/ld-lib.exp             |   9 +-
- 10 files changed, 446 insertions(+), 26 deletions(-)
+ 10 files changed, 484 insertions(+), 26 deletions(-)
  create mode 100644 ld/testsuite/ld-plugin/lto-binutils.exp
  create mode 100644 ld/testsuite/ld-plugin/strip-1a-fat.c
  create mode 100644 ld/testsuite/ld-plugin/strip-1a-fat.rd
@@ -104,7 +105,7 @@ index c74526e929a..05a10d20924 100644
  @itemx --version
  Show the version number for @command{strip}.
 diff --git a/binutils/objcopy.c b/binutils/objcopy.c
-index 31933e13b7a..4990e6a7856 100644
+index 31933e13b7a..1396dd10bbe 100644
 --- a/binutils/objcopy.c
 +++ b/binutils/objcopy.c
 @@ -30,6 +30,8 @@
@@ -164,13 +165,13 @@ index 31933e13b7a..4990e6a7856 100644
    bfd_size_type tocopy;
 -  off_t size;
 -  struct stat buf;
--
+ 
 -  if (bfd_stat_arch_elt (ibfd, &buf) != 0)
 -    {
 -      bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
 -      return false;
 -    }
- 
+-
 -  size = buf.st_size;
    if (size < 0)
      {
@@ -295,25 +296,18 @@ index 31933e13b7a..4990e6a7856 100644
  	}
  
        if (!bfd_close (ibfd))
-@@ -4837,6 +4891,17 @@ strip_main (int argc, char *argv[])
+@@ -4837,6 +4891,10 @@ strip_main (int argc, char *argv[])
    char *output_file = NULL;
    bool merge_notes_set = false;
  
 +#if BFD_SUPPORTS_PLUGINS
-+  /* All GCC LTO section prefixes.  */
-+  const char *GCC_LTO_sections[] =
-+    {
-+      ".gnu.debuglto_.",
-+      ".gnu.lto_."
-+    };
-+
 +  bfd_plugin_set_program_name (argv[0]);
 +#endif
 +
    while ((c = getopt_long (argc, argv, "I:O:F:K:MN:R:o:sSpdgxXHhVvwDU",
  			   strip_options, (int *) 0)) != EOF)
      {
-@@ -4927,6 +4992,13 @@ strip_main (int argc, char *argv[])
+@@ -4927,6 +4985,13 @@ strip_main (int argc, char *argv[])
  	case OPTION_KEEP_SECTION_SYMBOLS:
  	  keep_section_symbols = true;
  	  break;
@@ -327,20 +321,16 @@ index 31933e13b7a..4990e6a7856 100644
  	case 0:
  	  /* We've been given a long option.  */
  	  break;
-@@ -4971,6 +5043,18 @@ strip_main (int argc, char *argv[])
+@@ -4971,6 +5036,14 @@ strip_main (int argc, char *argv[])
    if (output_target == NULL)
      output_target = input_target;
  
 +#if BFD_SUPPORTS_PLUGINS
-+  /* Check if all GCC LTO sections should be removed.  */
-+  lto_sections_removed = true;
-+  for (i = 0; i < (int) ARRAY_SIZE (GCC_LTO_sections); i++)
-+    if (!find_section_list (GCC_LTO_sections[i], false,
-+			    SECTION_CONTEXT_REMOVE))
-+      {
-+	lto_sections_removed = false;
-+	break;
-+      }
++  /* Check if all GCC LTO sections should be removed, assuming all LTO
++     sections will be removed with -R .gnu.lto_.*.  * Remove .gnu.lto_.*
++     sections will also remove .gnu.debuglto_.  sections.  */
++  lto_sections_removed = !!find_section_list (".gnu.lto_.*", false,
++					      SECTION_CONTEXT_REMOVE);
 +#endif
 +
    i = optind;
@@ -348,10 +338,10 @@ index 31933e13b7a..4990e6a7856 100644
        || (output_file != NULL && (i + 1) < argc))
 diff --git a/ld/testsuite/ld-plugin/lto-binutils.exp b/ld/testsuite/ld-plugin/lto-binutils.exp
 new file mode 100644
-index 00000000000..aeb03ea8326
+index 00000000000..c475d42b728
 --- /dev/null
 +++ b/ld/testsuite/ld-plugin/lto-binutils.exp
-@@ -0,0 +1,292 @@
+@@ -0,0 +1,341 @@
 +# Expect script for binutils tests with LTO
 +# Copyright (C) 2025 Free Software Foundation, Inc.
 +#
@@ -410,7 +400,7 @@ index 00000000000..aeb03ea8326
 +#  3:output file
 +#  4:action list (optional)
 +#
-+proc lto_binutils_test { lto_tests } {
++proc run_lto_binutils_test { lto_tests } {
 +    global srcdir
 +    global subdir
 +    global nm
@@ -427,20 +417,40 @@ index 00000000000..aeb03ea8326
 +	set output tmpdir/[lindex $testitem 3]
 +	set actions [lindex $testitem 4]
 +	set objfiles {}
++	set is_unresolved 0
 +	set failed 0
 +
++#	eval set prog \$$prog_name
++	switch -- $prog_name {
++	objcopy
++	    {
++		set prog $objcopy
++		set prog_output "$output"
++	    }
++	strip
++	    {
++		set prog $strip
++		set prog_output "-o $output"
++	    }
++	default
++	    {
++		perror "Unrecognized action $action"
++		set is_unresolved 1
++		break
++	    }
++	}
++
 +	# Don't leave previous output around
 +	if { $output ne "tmpdir/" } {
 +	    remote_file host delete $output
 +	}
 +
-+	eval set prog \$$prog_name
-+
 +	append prog_options " --plugin $lto_plugin"
 +
-+	set test_name "$prog_name $prog_options ($input)"
++	set cmd_options "$prog_options $prog_output $input"
++	set test_name "$prog_name $cmd_options"
 +
-+	set cmd "$prog $prog_options -o $output $input"
++	set cmd "$prog $cmd_options"
 +	send_log "$cmd\n"
 +	set got [remote_exec host "$cmd"]
 +	if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
@@ -509,6 +519,8 @@ index 00000000000..aeb03ea8326
 +
 +	if { $failed } {
 +	    fail $test_name
++	} elseif { $is_unresolved } {
++	    unresolved $test_name
 +	} else {
 +	    pass $test_name
 +	}
@@ -546,7 +558,7 @@ index 00000000000..aeb03ea8326
 +    ] \
 +]
 +
-+lto_binutils_test [list \
++run_lto_binutils_test [list \
 +    [list \
 +	"strip" \
 +	"--strip-unneeded" \
@@ -561,21 +573,28 @@ index 00000000000..aeb03ea8326
 +    ] \
 +    [list \
 +	"strip" \
-+	"-R .gnu.*lto_* -N __gnu_lto_v1" \
++	"--strip-unneeded -R .gnu.*lto_* -N __gnu_lto_v1" \
 +	"libstrip-1a-fat.a" \
 +	"libstrip-1a-fat-s.a" \
 +	{{readelf -SW strip-1a-fat.rd}} \
 +    ] \
 +    [list \
 +	"strip" \
-+	"-R .gnu.*lto_* -N __gnu_lto_v1" \
++	"--strip-unneeded -R .gnu.*lto_* -N __gnu_lto_v1" \
 +	"strip-1a-fat.o" \
 +	"strip-1a-fat-s.o" \
 +	{{readelf -SW strip-1a-fat.rd}} \
 +    ] \
 +    [list \
 +	"strip" \
-+	"-R .gnu.lto_*" \
++	"--strip-unneeded -R .gnu.debuglto_*" \
++	"libstrip-1a-fat.a" \
++	"libstrip-1b-fat-s.a" \
++	{{readelf -SW strip-1b-fat.rd}} \
++    ] \
++    [list \
++	"strip" \
++	"--strip-unneeded -R .gnu.debuglto_*" \
 +	"strip-1a-fat.o" \
 +	"strip-1b-fat-s.o" \
 +	{{readelf -SW strip-1b-fat.rd}} \
@@ -584,7 +603,7 @@ index 00000000000..aeb03ea8326
 +
 +run_cc_link_tests [list \
 +    [list \
-+	"Build strip-1a" \
++	"Build strip-1a (strip-1a.o)" \
 +	"" \
 +	"-O2 -flto $lto_no_fat" \
 +	{ strip-1b.c } \
@@ -594,7 +613,7 @@ index 00000000000..aeb03ea8326
 +	"tmpdir/strip-1a.o" \
 +    ] \
 +    [list \
-+	"Build strip-1b" \
++	"Build strip-1b (strip-1a-s.o)" \
 +	"" \
 +	"-O2 -flto $lto_no_fat" \
 +	{ strip-1b.c } \
@@ -604,7 +623,7 @@ index 00000000000..aeb03ea8326
 +	"tmpdir/strip-1a-s.o" \
 +    ] \
 +    [list \
-+	"Build strip-1c" \
++	"Build strip-1c (libstrip-1a.a)" \
 +	"" \
 +	"-O2 -flto $lto_no_fat" \
 +	{ strip-1b.c } \
@@ -614,7 +633,7 @@ index 00000000000..aeb03ea8326
 +	"tmpdir/libstrip-1a.a" \
 +    ] \
 +    [list \
-+	"Build strip-1d" \
++	"Build strip-1d (libstrip-1a-s.a)" \
 +	"" \
 +	"-O2 -flto $lto_no_fat" \
 +	{ strip-1b.c } \
@@ -624,25 +643,45 @@ index 00000000000..aeb03ea8326
 +	"tmpdir/libstrip-1a-s.a" \
 +    ] \
 +    [list \
-+	"Build strip-1e" \
++	"Build strip-1e (strip-1a-fat-s.o)" \
 +	"" \
 +	"-O2 -flto $lto_fat" \
 +	{ strip-1b-fat.c } \
 +	{} \
-+	"libstrip-1b" \
++	"libstrip-1e" \
 +	"C" \
 +	"tmpdir/strip-1a-fat-s.o" \
 +    ] \
 +    [list \
 +	"Build strip-1f" \
 +	"" \
-+	"-O2 -flto $lto_fat" \
++	"-O2 -flto $lto_fat (libstrip-1a-fat-s.a)" \
 +	{ strip-1b-fat.c } \
 +	{} \
-+	"libstrip-1d" \
++	"libstrip-1f" \
 +	"C" \
 +	"tmpdir/libstrip-1a-fat-s.a" \
 +    ] \
++    [list \
++	"Build strip-1g (strip-1b-fat-s.o)" \
++	"" \
++	"-O2 -flto $lto_fat" \
++	{ strip-1b-fat.c } \
++	{} \
++	"libstrip-1g" \
++	"C" \
++	"tmpdir/strip-1b-fat-s.o" \
++    ] \
++    [list \
++	"Build strip-1h (libstrip-1b-fat-s.a)" \
++	"" \
++	"-O2 -flto $lto_fat" \
++	{ strip-1b-fat.c } \
++	{} \
++	"libstrip-1h" \
++	"C" \
++	"tmpdir/libstrip-1b-fat-s.a" \
++    ] \
 +]
 diff --git a/ld/testsuite/ld-plugin/strip-1a-fat.c b/ld/testsuite/ld-plugin/strip-1a-fat.c
 new file mode 100644


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-05-04 10:15 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-05-04 10:15 UTC (permalink / raw
  To: gentoo-commits

commit:     dbbd30a6cf0ba45b316f11a01f25428230fe2768
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun May  4 10:14:41 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May  4 10:14:41 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=dbbd30a6

9999: add H.J.'s patch for strip --plugin

Bug: https://sourceware.org/PR21479
Bug: https://bugs.gentoo.org/866422
Bug: https://bugs.gentoo.org/926120
Signed-off-by: Sam James <sam <AT> gentoo.org>

 9999/0006-strip-lto-plugin.patch | 751 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 751 insertions(+)

diff --git a/9999/0006-strip-lto-plugin.patch b/9999/0006-strip-lto-plugin.patch
new file mode 100644
index 0000000..962be2d
--- /dev/null
+++ b/9999/0006-strip-lto-plugin.patch
@@ -0,0 +1,751 @@
+https://bugs.gentoo.org/866422
+https://sourceware.org/bugzilla/show_bug.cgi?id=21479#c10
+
+From 245176a7d6a92ab5283887a28a375c47585e41ee Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Sun, 4 May 2025 05:12:46 +0800
+Subject: [PATCH] strip: Add LTO IR support
+
+Add LTO IR support to strip by copying LTO IR input as unknown object
+file.  Don't enable LTO plugin in strip unless all LTO sections should
+be removed.  Add linker LTO tests for strip with --strip-unneeded and
+removing all LTO section.
+
+binutils/
+
+	PR binutils/21479
+	* objcopy.c: Include "plugin-api.h" and "plugin.h".
+	(lto_sections_removed): New.
+	(command_line_switch): Add OPTION_PLUGIN.
+	(strip_options): Likewise.
+	(strip_usage): Display "--plugin NAME".
+	(copy_unknown_file): New function.
+	(copy_unknown_object): Call copy_unknown_file.
+	(copy_archive): Copy input LTO IR member as unknown object.
+	(copy_file): Set input target to "plugin" for strip if it is
+	unset unless all LTO sections should be removed.  Copy input
+	LTO IR file as unknown file.
+	(strip_main): Call bfd_plugin_set_program_name. Handle
+	OPTION_PLUGIN.  Set lto_sections_removed to true if all GCC
+	LTO sections should be removed.
+	* doc/binutils.texi: Document --plugin for strip.
+
+ld/
+
+	PR binutils/21479
+	* testsuite/ld-plugin/lto-binutils.exp: New file.
+	* testsuite/ld-plugin/strip-1a-fat.c: Likewise.
+	* testsuite/ld-plugin/strip-1a-fat.rd: Likewise.
+	* testsuite/ld-plugin/strip-1b-fat.c: Likewise.
+	* testsuite/ld-plugin/strip-1b-fat.rd: Likewise.
+	* testsuite/ld-plugin/strip-1a.c: Likewise.
+	* testsuite/ld-plugin/strip-1b.c: Likewise.
+	* testsuite/lib/ld-lib.exp (run_cc_link_tests): Add optional
+	trailing ld options.
+
+Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
+---
+ binutils/doc/binutils.texi              |  21 ++
+ binutils/objcopy.c                      | 130 +++++++++--
+ ld/testsuite/ld-plugin/lto-binutils.exp | 292 ++++++++++++++++++++++++
+ ld/testsuite/ld-plugin/strip-1a-fat.c   |   1 +
+ ld/testsuite/ld-plugin/strip-1a-fat.rd  |   6 +
+ ld/testsuite/ld-plugin/strip-1a.c       |   4 +
+ ld/testsuite/ld-plugin/strip-1b-fat.c   |   1 +
+ ld/testsuite/ld-plugin/strip-1b-fat.rd  |   5 +
+ ld/testsuite/ld-plugin/strip-1b.c       |   3 +
+ ld/testsuite/lib/ld-lib.exp             |   9 +-
+ 10 files changed, 446 insertions(+), 26 deletions(-)
+ create mode 100644 ld/testsuite/ld-plugin/lto-binutils.exp
+ create mode 100644 ld/testsuite/ld-plugin/strip-1a-fat.c
+ create mode 100644 ld/testsuite/ld-plugin/strip-1a-fat.rd
+ create mode 100644 ld/testsuite/ld-plugin/strip-1a.c
+ create mode 100644 ld/testsuite/ld-plugin/strip-1b-fat.c
+ create mode 100644 ld/testsuite/ld-plugin/strip-1b-fat.rd
+ create mode 100644 ld/testsuite/ld-plugin/strip-1b.c
+
+diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
+index c74526e929a..05a10d20924 100644
+--- a/binutils/doc/binutils.texi
++++ b/binutils/doc/binutils.texi
+@@ -3566,6 +3566,7 @@ strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
+       [@option{--keep-section-symbols}]
+       [@option{--keep-file-symbols}]
+       [@option{--only-keep-debug}]
++      [@option{--plugin} @var{name}]
+       [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
+       [@option{--help}] [@option{--info}]
+       @var{objfile}@dots{}
+@@ -3825,6 +3826,26 @@ currently only supports the presence of one filename containing
+ debugging information, not multiple filenames on a one-per-object-file
+ basis.
+ 
++@item --plugin @var{name}
++@cindex plugins
++Load the plugin called @var{name} to add support for extra target
++types.  This option is only available if the toolchain has been built
++with plugin support enabled.
++
++If @option{--plugin} is not provided, but plugin support has been
++enabled then @command{strip} iterates over the files in
++@file{$@{libdir@}/bfd-plugins} in alphabetic order and the first
++plugin that claims the object in question is used.
++
++Please note that this plugin search directory is @emph{not} the one
++used by @command{ld}'s @option{-plugin} option.  In order to make
++@command{strip} use the  linker plugin it must be copied into the
++@file{$@{libdir@}/bfd-plugins} directory.  For GCC based compilations
++the linker plugin is called @file{liblto_plugin.so.0.0.0}.  For Clang
++based compilations it is called @file{LLVMgold.so}.  The GCC plugin
++is always backwards compatible with earlier versions, so it is
++sufficient to just copy the newest one.
++
+ @item -V
+ @itemx --version
+ Show the version number for @command{strip}.
+diff --git a/binutils/objcopy.c b/binutils/objcopy.c
+index 31933e13b7a..4990e6a7856 100644
+--- a/binutils/objcopy.c
++++ b/binutils/objcopy.c
+@@ -30,6 +30,8 @@
+ #include "coff/internal.h"
+ #include "libcoff.h"
+ #include "safe-ctype.h"
++#include "plugin-api.h"
++#include "plugin.h"
+ 
+ /* FIXME: See bfd/peXXigen.c for why we include an architecture specific
+    header in generic PE code.  */
+@@ -165,6 +167,9 @@ static struct section_list *change_sections;
+ /* TRUE if some sections are to be removed.  */
+ static bool sections_removed;
+ 
++/* TRUE if all GCC LTO sections are to be removed.  */
++static bool lto_sections_removed;
++
+ /* TRUE if only some sections are to be copied.  */
+ static bool sections_copied;
+ 
+@@ -359,6 +364,7 @@ enum command_line_switch
+   OPTION_RENAME_SECTION,
+   OPTION_REVERSE_BYTES,
+   OPTION_PE_SECTION_ALIGNMENT,
++  OPTION_PLUGIN,
+   OPTION_SET_SECTION_FLAGS,
+   OPTION_SET_SECTION_ALIGNMENT,
+   OPTION_SET_START,
+@@ -402,6 +408,7 @@ static struct option strip_options[] =
+   {"output-file", required_argument, 0, 'o'},
+   {"output-format", required_argument, 0, 'O'},	/* Obsolete */
+   {"output-target", required_argument, 0, 'O'},
++  {"plugin", required_argument, 0, OPTION_PLUGIN},
+   {"preserve-dates", no_argument, 0, 'p'},
+   {"remove-section", required_argument, 0, 'R'},
+   {"remove-relocations", required_argument, 0, OPTION_REMOVE_RELOCS},
+@@ -758,6 +765,10 @@ strip_usage (FILE *stream, int exit_status)
+      --info                        List object formats & architectures supported\n\
+   -o <file>                        Place stripped output into <file>\n\
+ "));
++#if BFD_SUPPORTS_PLUGINS
++  fprintf (stream, _("\
++      --plugin NAME                Load the specified plugin\n"));
++#endif
+ 
+   list_supported_targets (program_name, stream);
+   if (REPORT_BUGS_TO[0] && exit_status == 0)
+@@ -1916,20 +1927,11 @@ add_redefine_syms_file (const char *filename)
+    Returns TRUE upon success, FALSE otherwise.  */
+ 
+ static bool
+-copy_unknown_object (bfd *ibfd, bfd *obfd)
++copy_unknown_file (bfd *ibfd, bfd *obfd, off_t size, unsigned int mode)
+ {
+   char *cbuf;
+   bfd_size_type tocopy;
+-  off_t size;
+-  struct stat buf;
+-
+-  if (bfd_stat_arch_elt (ibfd, &buf) != 0)
+-    {
+-      bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
+-      return false;
+-    }
+ 
+-  size = buf.st_size;
+   if (size < 0)
+     {
+       non_fatal (_("stat returns negative size for `%s'"),
+@@ -1974,11 +1976,40 @@ copy_unknown_object (bfd *ibfd, bfd *obfd)
+ 
+   /* We should at least to be able to read it back when copying an
+      unknown object in an archive.  */
+-  chmod (bfd_get_filename (obfd), buf.st_mode | S_IRUSR);
++  chmod (bfd_get_filename (obfd), mode | S_IRUSR);
+   free (cbuf);
+   return true;
+ }
+ 
++/* Copy unknown object file archive member IBFD onto OBFD.
++   Returns TRUE upon success, FALSE otherwise.  */
++
++static bool
++copy_unknown_object (bfd *ibfd, bfd *obfd)
++{
++  off_t size;
++  struct stat buf;
++
++  if (bfd_stat_arch_elt (ibfd, &buf) != 0)
++    {
++      bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
++      return false;
++    }
++
++  size = buf.st_size;
++  if (size < 0)
++    {
++      non_fatal (_("stat returns negative size for `%s'"),
++		 bfd_get_archive_filename (ibfd));
++      return false;
++    }
++
++  if (!copy_unknown_file (ibfd, obfd, size, buf.st_mode))
++    return false;
++
++  return true;
++}
++
+ typedef struct objcopy_internal_note
+ {
+   Elf_Internal_Note  note;
+@@ -3744,7 +3775,10 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
+ 	  goto cleanup_and_exit;
+ 	}
+ 
+-      if (ok_object)
++      /* Copy LTO IR file as unknown object.  */
++      if (bfd_plugin_target_p (ibfd->xvec))
++	ok_object = false;
++      else if (ok_object)
+ 	{
+ 	  ok = copy_object (this_element, output_element, input_arch);
+ 
+@@ -3845,6 +3879,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
+   char **obj_matching;
+   char **core_matching;
+   off_t size = get_file_size (input_filename);
++  const char *target = input_target;
+ 
+   if (size < 1)
+     {
+@@ -3855,9 +3890,16 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
+       return;
+     }
+ 
++#if BFD_SUPPORTS_PLUGINS
++  /* Enable LTO plugin in strip unless all LTO sections should be
++     removed.  */
++  if (is_strip && !target && !lto_sections_removed)
++    target = "plugin";
++#endif
++
+   /* To allow us to do "strip *" without dying on the first
+      non-object file, failures are nonfatal.  */
+-  ibfd = bfd_openr (input_filename, input_target);
++  ibfd = bfd_openr (input_filename, target);
+   if (ibfd == NULL || bfd_stat (ibfd, in_stat) != 0)
+     {
+       bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
+@@ -3974,17 +4016,29 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
+  	  return;
+  	}
+ 
+-      if (! copy_object (ibfd, obfd, input_arch))
+-	status = 1;
+-
+-      /* PR 17512: file: 0f15796a.
+-	 If the file could not be copied it may not be in a writeable
+-	 state.  So use bfd_close_all_done to avoid the possibility of
+-	 writing uninitialised data into the file.  */
+-      if (! (status ? bfd_close_all_done (obfd) : bfd_close (obfd)))
++      if (bfd_plugin_target_p (ibfd->xvec))
+ 	{
+-	  status = 1;
+-	  bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
++	  /* Copy LTO IR file as unknown file.  */
++	  if (!copy_unknown_file (ibfd, obfd, in_stat->st_size,
++				  in_stat->st_mode))
++	    status = 1;
++	  else if (!bfd_close_all_done (obfd))
++	    status = 1;
++	}
++      else
++	{
++	  if (! copy_object (ibfd, obfd, input_arch))
++	    status = 1;
++
++	  /* PR 17512: file: 0f15796a.
++	     If the file could not be copied it may not be in a writeable
++	     state.  So use bfd_close_all_done to avoid the possibility of
++	     writing uninitialised data into the file.  */
++	  if (! (status ? bfd_close_all_done (obfd) : bfd_close (obfd)))
++	    {
++	      status = 1;
++	      bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
++	    }
+ 	}
+ 
+       if (!bfd_close (ibfd))
+@@ -4837,6 +4891,17 @@ strip_main (int argc, char *argv[])
+   char *output_file = NULL;
+   bool merge_notes_set = false;
+ 
++#if BFD_SUPPORTS_PLUGINS
++  /* All GCC LTO section prefixes.  */
++  const char *GCC_LTO_sections[] =
++    {
++      ".gnu.debuglto_.",
++      ".gnu.lto_."
++    };
++
++  bfd_plugin_set_program_name (argv[0]);
++#endif
++
+   while ((c = getopt_long (argc, argv, "I:O:F:K:MN:R:o:sSpdgxXHhVvwDU",
+ 			   strip_options, (int *) 0)) != EOF)
+     {
+@@ -4927,6 +4992,13 @@ strip_main (int argc, char *argv[])
+ 	case OPTION_KEEP_SECTION_SYMBOLS:
+ 	  keep_section_symbols = true;
+ 	  break;
++	case OPTION_PLUGIN:	/* --plugin */
++#if BFD_SUPPORTS_PLUGINS
++	  bfd_plugin_set_plugin (optarg);
++#else
++	  fatal (_("sorry - this program has been built without plugin support\n"));
++#endif
++	  break;
+ 	case 0:
+ 	  /* We've been given a long option.  */
+ 	  break;
+@@ -4971,6 +5043,18 @@ strip_main (int argc, char *argv[])
+   if (output_target == NULL)
+     output_target = input_target;
+ 
++#if BFD_SUPPORTS_PLUGINS
++  /* Check if all GCC LTO sections should be removed.  */
++  lto_sections_removed = true;
++  for (i = 0; i < (int) ARRAY_SIZE (GCC_LTO_sections); i++)
++    if (!find_section_list (GCC_LTO_sections[i], false,
++			    SECTION_CONTEXT_REMOVE))
++      {
++	lto_sections_removed = false;
++	break;
++      }
++#endif
++
+   i = optind;
+   if (i == argc
+       || (output_file != NULL && (i + 1) < argc))
+diff --git a/ld/testsuite/ld-plugin/lto-binutils.exp b/ld/testsuite/ld-plugin/lto-binutils.exp
+new file mode 100644
+index 00000000000..aeb03ea8326
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-binutils.exp
+@@ -0,0 +1,292 @@
++# Expect script for binutils tests with LTO
++# Copyright (C) 2025 Free Software Foundation, Inc.
++#
++# This file is part of the GNU Binutils.
++#
++# 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.
++#
++
++# Make sure that binutils can correctly handle LTO IR in ELF.
++
++if { !([istarget *-*-linux*]
++       || [istarget arm*-*-uclinuxfdpiceabi]
++       || [istarget *-*-nacl*]
++       || [istarget *-*-gnu*]) || [istarget *ecoff] } then {
++    return
++}
++
++# Check to see if the C and C++ compilers work
++if { ![check_compiler_available] || [which $CXX_FOR_TARGET] == 0 } {
++    return
++}
++
++# These tests require plugin and LTO.
++if { ![check_plugin_api_available]
++     || ![check_lto_available] } {
++    return
++}
++
++set lto_fat ""
++set lto_no_fat ""
++if { [check_lto_fat_available] } {
++  set lto_fat "-ffat-lto-objects"
++  set lto_no_fat "-fno-fat-lto-objects"
++  set no_lto "-fno-lto"
++}
++
++set lto_plugin [string trim [run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so"]]
++
++# List contains test-items:
++#  0:program name
++#  1:program options
++#  2:input file
++#  3:output file
++#  4:action list (optional)
++#
++proc lto_binutils_test { lto_tests } {
++    global srcdir
++    global subdir
++    global nm
++    global objcopy
++    global objdump
++    global READELF
++    global strip
++    global lto_plugin
++
++    foreach testitem $lto_tests {
++	set prog_name [lindex $testitem 0]
++	set prog_options [lindex $testitem 1]
++	set input tmpdir/[lindex $testitem 2]
++	set output tmpdir/[lindex $testitem 3]
++	set actions [lindex $testitem 4]
++	set objfiles {}
++	set failed 0
++
++	# Don't leave previous output around
++	if { $output ne "tmpdir/" } {
++	    remote_file host delete $output
++	}
++
++	eval set prog \$$prog_name
++
++	append prog_options " --plugin $lto_plugin"
++
++	set test_name "$prog_name $prog_options ($input)"
++
++	set cmd "$prog $prog_options -o $output $input"
++	send_log "$cmd\n"
++	set got [remote_exec host "$cmd"]
++	if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
++	    send_log "$got\n"
++	    fail "$test_name"
++	    continue
++	}
++
++	if { $failed == 0 } {
++	    foreach actionlist $actions {
++		set action [lindex $actionlist 0]
++		set progopts [lindex $actionlist 1]
++
++		# There are actions where we run regexp_diff on the
++		# output, and there are other actions (presumably).
++		# Handling of the former look the same.
++		set dump_prog ""
++		switch -- $action {
++		    objdump
++			{ set dump_prog $objdump }
++		    nm
++			{ set dump_prog $nm }
++		    readelf
++			{ set dump_prog $READELF }
++		    default
++			{
++			    perror "Unrecognized action $action"
++			    set is_unresolved 1
++			    break
++			}
++		    }
++
++		if { $dump_prog != "" } {
++		    set dumpfile [lindex $actionlist 2]
++		    set binary $dump_prog
++
++		    # Ensure consistent sorting of symbols
++		    if {[info exists env(LC_ALL)]} {
++			set old_lc_all $env(LC_ALL)
++		    }
++		    set env(LC_ALL) "C"
++		    set cmd "$binary $progopts $output > tmpdir/dump.out"
++		    send_log "$cmd\n"
++		    catch "exec $cmd" comp_output
++		    if {[info exists old_lc_all]} {
++			set env(LC_ALL) $old_lc_all
++		    } else {
++			unset env(LC_ALL)
++		    }
++		    set comp_output [prune_warnings $comp_output]
++
++		    if ![string match "" $comp_output] then {
++			send_log "$comp_output\n"
++			set failed 1
++			break
++		    }
++
++		    if { [regexp_diff "tmpdir/dump.out" "$srcdir/$subdir/$dumpfile"] } then {
++			verbose -log "output is [file_contents "tmpdir/dump.out"]" 2
++			set failed 1
++			break
++		    }
++		}
++	    }
++	}
++
++	if { $failed } {
++	    fail $test_name
++	} else {
++	    pass $test_name
++	}
++    }
++}
++
++run_cc_link_tests [list \
++    [list \
++	"Build strip-1a.o" \
++	"" \
++	"-O2 -flto $lto_no_fat" \
++	{ strip-1a.c } \
++    ] \
++    [list \
++	"Build libstrip-1a.a" \
++	"--plugin $lto_plugin" \
++	"-O2 -flto $lto_no_fat" \
++	{ strip-1a.c } \
++	{} \
++	"libstrip-1a.a" \
++    ] \
++    [list \
++	"Build strip-1a-fat.o" \
++	"" \
++	"-O2 -flto $lto_fat" \
++	{ strip-1a-fat.c } \
++    ] \
++    [list \
++	"Build libstrip-1a-fat.a" \
++	"--plugin $lto_plugin" \
++	"-O2 -flto $lto_fat" \
++	{ strip-1a-fat.c } \
++	{} \
++	"libstrip-1a-fat.a" \
++    ] \
++]
++
++lto_binutils_test [list \
++    [list \
++	"strip" \
++	"--strip-unneeded" \
++	"libstrip-1a.a" \
++	"libstrip-1a-s.a" \
++    ] \
++    [list \
++	"strip" \
++	"--strip-unneeded" \
++	"strip-1a.o" \
++	"strip-1a-s.o" \
++    ] \
++    [list \
++	"strip" \
++	"-R .gnu.*lto_* -N __gnu_lto_v1" \
++	"libstrip-1a-fat.a" \
++	"libstrip-1a-fat-s.a" \
++	{{readelf -SW strip-1a-fat.rd}} \
++    ] \
++    [list \
++	"strip" \
++	"-R .gnu.*lto_* -N __gnu_lto_v1" \
++	"strip-1a-fat.o" \
++	"strip-1a-fat-s.o" \
++	{{readelf -SW strip-1a-fat.rd}} \
++    ] \
++    [list \
++	"strip" \
++	"-R .gnu.lto_*" \
++	"strip-1a-fat.o" \
++	"strip-1b-fat-s.o" \
++	{{readelf -SW strip-1b-fat.rd}} \
++    ] \
++]
++
++run_cc_link_tests [list \
++    [list \
++	"Build strip-1a" \
++	"" \
++	"-O2 -flto $lto_no_fat" \
++	{ strip-1b.c } \
++	{} \
++	"libstrip-1a" \
++	"C" \
++	"tmpdir/strip-1a.o" \
++    ] \
++    [list \
++	"Build strip-1b" \
++	"" \
++	"-O2 -flto $lto_no_fat" \
++	{ strip-1b.c } \
++	{} \
++	"libstrip-1b" \
++	"C" \
++	"tmpdir/strip-1a-s.o" \
++    ] \
++    [list \
++	"Build strip-1c" \
++	"" \
++	"-O2 -flto $lto_no_fat" \
++	{ strip-1b.c } \
++	{} \
++	"libstrip-1c" \
++	"C" \
++	"tmpdir/libstrip-1a.a" \
++    ] \
++    [list \
++	"Build strip-1d" \
++	"" \
++	"-O2 -flto $lto_no_fat" \
++	{ strip-1b.c } \
++	{} \
++	"libstrip-1d" \
++	"C" \
++	"tmpdir/libstrip-1a-s.a" \
++    ] \
++    [list \
++	"Build strip-1e" \
++	"" \
++	"-O2 -flto $lto_fat" \
++	{ strip-1b-fat.c } \
++	{} \
++	"libstrip-1b" \
++	"C" \
++	"tmpdir/strip-1a-fat-s.o" \
++    ] \
++    [list \
++	"Build strip-1f" \
++	"" \
++	"-O2 -flto $lto_fat" \
++	{ strip-1b-fat.c } \
++	{} \
++	"libstrip-1d" \
++	"C" \
++	"tmpdir/libstrip-1a-fat-s.a" \
++    ] \
++]
+diff --git a/ld/testsuite/ld-plugin/strip-1a-fat.c b/ld/testsuite/ld-plugin/strip-1a-fat.c
+new file mode 100644
+index 00000000000..03b2a5c2275
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/strip-1a-fat.c
+@@ -0,0 +1 @@
++#include "strip-1a.c"
+diff --git a/ld/testsuite/ld-plugin/strip-1a-fat.rd b/ld/testsuite/ld-plugin/strip-1a-fat.rd
+new file mode 100644
+index 00000000000..aefe1c55013
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/strip-1a-fat.rd
+@@ -0,0 +1,6 @@
++#failif
++#...
++Section Headers:
++#...
++  \[[ 0-9]+\] \.gnu.lto_.*
++#...
+diff --git a/ld/testsuite/ld-plugin/strip-1a.c b/ld/testsuite/ld-plugin/strip-1a.c
+new file mode 100644
+index 00000000000..d84af205338
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/strip-1a.c
+@@ -0,0 +1,4 @@
++extern void foo2(void);
++extern void foo3(void);
++void foo1(void) { foo3(); }
++int main(void) { foo2(); }
+diff --git a/ld/testsuite/ld-plugin/strip-1b-fat.c b/ld/testsuite/ld-plugin/strip-1b-fat.c
+new file mode 100644
+index 00000000000..1a2e4d2d86a
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/strip-1b-fat.c
+@@ -0,0 +1 @@
++#include "strip-1b.c"
+diff --git a/ld/testsuite/ld-plugin/strip-1b-fat.rd b/ld/testsuite/ld-plugin/strip-1b-fat.rd
+new file mode 100644
+index 00000000000..e3a266f8bee
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/strip-1b-fat.rd
+@@ -0,0 +1,5 @@
++#...
++Section Headers:
++#...
++  \[[ 0-9]+\] \.gnu.lto_.*
++#pass
+diff --git a/ld/testsuite/ld-plugin/strip-1b.c b/ld/testsuite/ld-plugin/strip-1b.c
+new file mode 100644
+index 00000000000..967872a0f12
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/strip-1b.c
+@@ -0,0 +1,3 @@
++extern void foo1(void);
++void foo2(void) { foo1(); }
++void foo3(void) {}
+diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
+index 96152718d6f..119410bc523 100644
+--- a/ld/testsuite/lib/ld-lib.exp
++++ b/ld/testsuite/lib/ld-lib.exp
+@@ -860,14 +860,15 @@ proc run_ld_link_exec_tests { ldtests args } {
+ }
+ 
+ # List contains test-items with 3 items followed by 2 lists, one item and
+-# one optional item:
++# 2 optional items:
+ #  0:name
+-#  1:ld or ar options
++#  1:leading ld or ar options
+ #  2:compile options
+ #  3:filenames of source files
+ #  4:action and options.
+ #  5:name of output file
+ #  6:language (optional)
++#  7:trailing ld options (optional), placed after object files
+ #
+ # Actions:
+ # objdump: Apply objdump options on result.  Compare with regex (last arg).
+@@ -899,6 +900,7 @@ proc run_cc_link_tests { ldtests } {
+ 	set actions [lindex $testitem 4]
+ 	set binfile tmpdir/[lindex $testitem 5]
+ 	set lang [lindex $testitem 6]
++	set trailing_ldflags [lindex $testitem 7]
+ 	set objfiles {}
+ 	set is_unresolved 0
+ 	set failed 0
+@@ -927,6 +929,7 @@ proc run_cc_link_tests { ldtests } {
+ 	#verbose -log "actions   is $actions"
+ 	#verbose -log "binfile   is $binfile"
+ 	#verbose -log "lang      is $lang"
++	#verbose -log "trailing_ldflags is $trailing_ldflags"
+ 
+ 	foreach actionlist $actions {
+ 	    set action [lindex $actionlist 0]
+@@ -1006,7 +1009,7 @@ proc run_cc_link_tests { ldtests } {
+ 		untested $testname
+ 		continue
+ 	    }
+-	    ld_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles"
++	    ld_link $cc_cmd $binfile "-L$srcdir/$subdir $ldflags $objfiles $trailing_ldflags"
+ 	    set ld_output "$exec_output"
+ 
+ 	    if { $check_ld(source) == "regexp" } then {
+-- 
+2.49.0


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-04-10 17:35 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-04-10 17:35 UTC (permalink / raw
  To: gentoo-commits

commit:     d942e7ae10ce3c8fd06e893c6ce01ccd1258e877
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 10 17:34:57 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Apr 10 17:34:57 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=d942e7ae

9999: drop merged LTO patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-LTO-archive-member-only-for-the-earlier-.patch | 186 ---------------------
 1 file changed, 186 deletions(-)

diff --git a/9999/0006-ld-Skip-the-LTO-archive-member-only-for-the-earlier-.patch b/9999/0006-ld-Skip-the-LTO-archive-member-only-for-the-earlier-.patch
deleted file mode 100644
index 1eb52fc..0000000
--- a/9999/0006-ld-Skip-the-LTO-archive-member-only-for-the-earlier-.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-https://inbox.sourceware.org/binutils/20250408201002.383836-1-hjl.tools@gmail.com/
-
-From b6ccbf6faecf5e2d43d776fab90f0a5d673a2817 Mon Sep 17 00:00:00 2001
-Message-ID: <b6ccbf6faecf5e2d43d776fab90f0a5d673a2817.1744165403.git.sam@gentoo.org>
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Tue, 8 Apr 2025 13:10:02 -0700
-Subject: [PATCH] ld: Skip the LTO archive member only for the earlier DSO
-
-commit 2707d55e539ef323dd14a1293e762bf3d9739ee7
-Author: Michael Matz <matz@suse.de>
-Date:   Mon Mar 31 15:57:08 2025 +0200
-
-skipped the LTO archive member even when the earlier item is also an
-archive.  Instead, skip the LTO archive member only if the earlier item
-is a shared library.
-
-bfd/
-
-	PR ld/32846
-	PR ld/32854
-	* elflink.c (elf_link_add_archive_symbols): Skip the LTO archive
-	member only if the earlier item is a shared library.
-
-ld/
-
-	PR ld/32846
-	PR ld/32854
-	* testsuite/ld-plugin/lto.exp: Run ld/32846 test.
-	* testsuite/ld-plugin/pr32846a.c: New file.
-	* testsuite/ld-plugin/pr32846b.c: Likewise.
-	* testsuite/ld-plugin/pr32846c.c: Likewise.
-	* testsuite/ld-plugin/pr32846d.c: Likewise.
-	* testsuite/ld-plugin/pr32846e.c: Likewise.
-
-Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
----
- bfd/elflink.c                     |  8 +++++---
- ld/testsuite/ld-plugin/lto.exp    | 32 +++++++++++++++++++++++++++++++
- ld/testsuite/ld-plugin/pr32846a.c |  6 ++++++
- ld/testsuite/ld-plugin/pr32846b.c |  4 ++++
- ld/testsuite/ld-plugin/pr32846c.c |  6 ++++++
- ld/testsuite/ld-plugin/pr32846d.c | 12 ++++++++++++
- ld/testsuite/ld-plugin/pr32846e.c |  4 ++++
- 7 files changed, 69 insertions(+), 3 deletions(-)
- create mode 100644 ld/testsuite/ld-plugin/pr32846a.c
- create mode 100644 ld/testsuite/ld-plugin/pr32846b.c
- create mode 100644 ld/testsuite/ld-plugin/pr32846c.c
- create mode 100644 ld/testsuite/ld-plugin/pr32846d.c
- create mode 100644 ld/testsuite/ld-plugin/pr32846e.c
-
-diff --git a/bfd/elflink.c b/bfd/elflink.c
-index a76e8e38da7..2ac12144990 100644
---- a/bfd/elflink.c
-+++ b/bfd/elflink.c
-@@ -6290,8 +6290,8 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
- 		    continue;
- 
- 		  /* In the pre-LTO-plugin pass we must not mistakenly
--		     include this archive member if an earlier BFD
--		     defined this symbol.  */
-+		     include this archive member if an earlier shared
-+		     library defined this symbol.  */
- 		  struct elf_link_hash_table *htab = elf_hash_table (info);
- 		  if (htab->first_hash)
- 		    {
-@@ -6299,7 +6299,9 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
- 			  = ((struct elf_link_first_hash_entry *)
- 			     bfd_hash_lookup (htab->first_hash, symdef->name,
- 					      false, false));
--		      if (e && e->abfd != abfd)
-+		      if (e
-+			  && (e->abfd->flags & DYNAMIC) != 0
-+			  && e->abfd != abfd)
- 			continue;
- 		    }
- 		}
-diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
-index 93491902674..726dd933329 100644
---- a/ld/testsuite/ld-plugin/lto.exp
-+++ b/ld/testsuite/ld-plugin/lto.exp
-@@ -1212,6 +1212,38 @@ if { [is_elf_format] } {
- 
- if { [is_elf_format] && [check_lto_shared_available] } {
-     run_ld_link_exec_tests $lto_run_elf_shared_tests
-+    if { [check_lto_fat_available] } {
-+	run_cc_link_tests [list \
-+	    [list \
-+	    	"Build libpr32846a.a" \
-+	    	"$plug_opt" "-O2 -flto $lto_no_fat" \
-+	    	{pr32846a.c pr32846b.c} {} "libpr32846a.a" \
-+	    ] \
-+	    [list \
-+		"Build libpr32846b.a" \
-+	    	"$plug_opt" "-O2 -flto $lto_no_fat" \
-+		{pr32846a.c pr32846b.c pr32846c.c} {} "libpr32846b.a" \
-+	    ] \
-+	    [list \
-+	    	"Build pr32846d.o" \
-+	    	"$plug_opt" "-O2 -flto $lto_no_fat" \
-+	    	{pr32846d.c} {} \
-+	    ] \
-+	    [list \
-+	    	"Build pr32846e.o" \
-+	    	"$plug_opt" "-O2 -flto $lto_no_fat" \
-+	    	{pr32846e.c} {} \
-+	    ] \
-+	    [list \
-+		"Build pr32846" \
-+		"-shared -fPIC -O2 -flto $lto_no_fat -Wl,--no-undefined \
-+		 tmpdir/pr32846d.o tmpdir/libpr32846a.a \
-+		 tmpdir/libpr32846b.a tmpdir/pr32846e.o" \
-+		"-O2 -fPIC -flto $lto_no_fat" \
-+		{dummy.c} {} "pr32846" \
-+	    ] \
-+	] \
-+    }
- }
- 
- proc pr20103 {cflags libs} {
-diff --git a/ld/testsuite/ld-plugin/pr32846a.c b/ld/testsuite/ld-plugin/pr32846a.c
-new file mode 100644
-index 00000000000..8c161711bd9
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/pr32846a.c
-@@ -0,0 +1,6 @@
-+extern void mkdir_p (void);
-+void
-+mkdir_parents (void)
-+{
-+  mkdir_p ();
-+}
-diff --git a/ld/testsuite/ld-plugin/pr32846b.c b/ld/testsuite/ld-plugin/pr32846b.c
-new file mode 100644
-index 00000000000..9776a372d7a
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/pr32846b.c
-@@ -0,0 +1,4 @@
-+void
-+hash_new (void)
-+{
-+}
-diff --git a/ld/testsuite/ld-plugin/pr32846c.c b/ld/testsuite/ld-plugin/pr32846c.c
-new file mode 100644
-index 00000000000..f87cffb8865
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/pr32846c.c
-@@ -0,0 +1,6 @@
-+extern void hash_new (void);
-+void
-+kmod_new (void)
-+{
-+  hash_new();
-+}
-diff --git a/ld/testsuite/ld-plugin/pr32846d.c b/ld/testsuite/ld-plugin/pr32846d.c
-new file mode 100644
-index 00000000000..c6f41021adf
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/pr32846d.c
-@@ -0,0 +1,12 @@
-+extern void kmod_new (void);
-+extern void mkdir_parents (void);
-+void
-+do_lsmod (void)
-+{
-+  kmod_new ();
-+}
-+void
-+do_static_nodes (void)
-+{
-+  mkdir_parents();
-+}
-diff --git a/ld/testsuite/ld-plugin/pr32846e.c b/ld/testsuite/ld-plugin/pr32846e.c
-new file mode 100644
-index 00000000000..c4e5e56f4f6
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/pr32846e.c
-@@ -0,0 +1,4 @@
-+void
-+mkdir_p (void)
-+{
-+}
-
-base-commit: faaee6b411411f3c1f45768d7ac15559fd27b980
--- 
-2.49.0
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-04-09  2:24 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-04-09  2:24 UTC (permalink / raw
  To: gentoo-commits

commit:     d73d6d120ffc9ed75faca235ab07f831190075bd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Apr  9 02:24:02 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr  9 02:24:02 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=d73d6d12

9999: add H.J.'s fix for earlier revert

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...t-lto-Fix-symlookup-in-archives-vs-shared.patch | 168 -------------------
 ...-LTO-archive-member-only-for-the-earlier-.patch | 186 +++++++++++++++++++++
 2 files changed, 186 insertions(+), 168 deletions(-)

diff --git a/9999/0006-Revert-lto-Fix-symlookup-in-archives-vs-shared.patch b/9999/0006-Revert-lto-Fix-symlookup-in-archives-vs-shared.patch
deleted file mode 100644
index d8386fc..0000000
--- a/9999/0006-Revert-lto-Fix-symlookup-in-archives-vs-shared.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From ba77d9675b2af359875bc5ef785616c18285060b Mon Sep 17 00:00:00 2001
-Message-ID: <ba77d9675b2af359875bc5ef785616c18285060b.1744072567.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Tue, 8 Apr 2025 01:35:58 +0100
-Subject: [PATCH] Revert "[lto] Fix symlookup in archives vs shared"
-
-This reverts commit 2707d55e539ef323dd14a1293e762bf3d9739ee7.
-
-Bug: https://sourceware.org/PR32846
----
- bfd/elflink.c                     | 44 +++++++------------------------
- ld/testsuite/ld-plugin/lto-20.ver |  1 -
- ld/testsuite/ld-plugin/lto-20a.c  |  2 --
- ld/testsuite/ld-plugin/lto-20b.c  | 11 --------
- ld/testsuite/ld-plugin/lto.exp    | 10 -------
- 5 files changed, 10 insertions(+), 58 deletions(-)
- delete mode 100644 ld/testsuite/ld-plugin/lto-20.ver
- delete mode 100644 ld/testsuite/ld-plugin/lto-20a.c
- delete mode 100644 ld/testsuite/ld-plugin/lto-20b.c
-
-diff --git a/bfd/elflink.c b/bfd/elflink.c
-index a76e8e38da7..13993527e3e 100644
---- a/bfd/elflink.c
-+++ b/bfd/elflink.c
-@@ -4965,7 +4965,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
-       asection *sec, *new_sec;
-       flagword flags;
-       const char *name;
--      const char *defvername;
-       bool must_copy_name = false;
-       struct elf_link_hash_entry *h;
-       struct elf_link_hash_entry *hi;
-@@ -5142,7 +5141,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
-       old_alignment = 0;
-       old_bfd = NULL;
-       new_sec = sec;
--      defvername = NULL;
- 
-       if (is_elf_hash_table (&htab->root))
- 	{
-@@ -5261,7 +5259,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
- 		 default version of the symbol.  */
- 	      if ((iver.vs_vers & VERSYM_HIDDEN) == 0
- 		  && isym->st_shndx != SHN_UNDEF)
--		*p++ = ELF_VER_CHR, defvername = name;
-+		*p++ = ELF_VER_CHR;
- 	      memcpy (p, verstr, verlen + 1);
- 
- 	      name = newname;
-@@ -5711,15 +5709,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
- 		}
- 	      else if (dynamic
- 		       && h->root.u.def.section->owner == abfd)
--		{
--		  /* Add this symbol to first hash if this shared
--		     object has the first definition.  */
--		  elf_link_add_to_first_hash (abfd, info, name, must_copy_name);
--		  /* And if it was the default symbol version definition,
--		     also add the short name.  */
--		  if (defvername)
--		    elf_link_add_to_first_hash (abfd, info, defvername, false);
--		}
-+		/* Add this symbol to first hash if this shared
-+		   object has the first definition.  */
-+		elf_link_add_to_first_hash (abfd, info, name, must_copy_name);
- 	    }
- 	}
-     }
-@@ -6281,28 +6273,12 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
- 
- 	  if (h->type == bfd_link_hash_undefined)
- 	    {
--	      if (is_elf_hash_table (info->hash))
--		{
--		  /* If the archive element has already been loaded then one
--		     of the symbols defined by that element might have been
--		     made undefined due to being in a discarded section.  */
--		  if (((struct elf_link_hash_entry *) h)->indx == -3)
--		    continue;
--
--		  /* In the pre-LTO-plugin pass we must not mistakenly
--		     include this archive member if an earlier BFD
--		     defined this symbol.  */
--		  struct elf_link_hash_table *htab = elf_hash_table (info);
--		  if (htab->first_hash)
--		    {
--		      struct elf_link_first_hash_entry *e
--			  = ((struct elf_link_first_hash_entry *)
--			     bfd_hash_lookup (htab->first_hash, symdef->name,
--					      false, false));
--		      if (e && e->abfd != abfd)
--			continue;
--		    }
--		}
-+	      /* If the archive element has already been loaded then one
-+		 of the symbols defined by that element might have been
-+		 made undefined due to being in a discarded section.  */
-+	      if (is_elf_hash_table (info->hash)
-+		  && ((struct elf_link_hash_entry *) h)->indx == -3)
-+		continue;
- 	    }
- 	  else if (h->type == bfd_link_hash_common)
- 	    {
-diff --git a/ld/testsuite/ld-plugin/lto-20.ver b/ld/testsuite/ld-plugin/lto-20.ver
-deleted file mode 100644
-index ac906ac4ad1..00000000000
---- a/ld/testsuite/ld-plugin/lto-20.ver
-+++ /dev/null
-@@ -1 +0,0 @@
--FOO { global: foo; };
-diff --git a/ld/testsuite/ld-plugin/lto-20a.c b/ld/testsuite/ld-plugin/lto-20a.c
-deleted file mode 100644
-index 3d6dac96752..00000000000
---- a/ld/testsuite/ld-plugin/lto-20a.c
-+++ /dev/null
-@@ -1,2 +0,0 @@
--extern int foo ();
--int main () { return foo (); }
-diff --git a/ld/testsuite/ld-plugin/lto-20b.c b/ld/testsuite/ld-plugin/lto-20b.c
-deleted file mode 100644
-index ba123cbe38b..00000000000
---- a/ld/testsuite/ld-plugin/lto-20b.c
-+++ /dev/null
-@@ -1,11 +0,0 @@
--extern int printf (const char *, ...);
--int foo ()
--{
--#ifdef SHARED
--    printf ("PASS\n");
--    return 0;
--#else
--    printf ("FAIL\n");
--    return 1;
--#endif
--}
-diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
-index 93491902674..556bbe9beea 100644
---- a/ld/testsuite/ld-plugin/lto.exp
-+++ b/ld/testsuite/ld-plugin/lto.exp
-@@ -477,12 +477,6 @@ set lto_link_elf_tests [list \
-   [list {liblto-19.so} \
-    {-shared tmpdir/lto-19b.o tmpdir/liblto-19.a} {-O2 -fPIC} \
-    {dummy.c} {} {liblto-19.so}] \
--  [list {liblto-20_static.a} \
--   {} {-fPIC} \
--   {lto-20b.c} {} {liblto-20_static.a}] \
--  [list {liblto-20.so} \
--   {-shared -Wl,--version-script=lto-20.ver} {-DSHARED -fPIC} \
--   {lto-20b.c} {} {liblto-20.so}] \
-   [list {pr26806.so} \
-    {-shared} {-fpic -O2 -flto} \
-    {pr26806.c} {{nm {-D} pr26806.d}} {pr26806.so}] \
-@@ -886,10 +880,6 @@ set lto_run_elf_shared_tests [list \
-    {-Wl,--as-needed,-R,tmpdir} {} \
-    {lto-19c.c} {lto-19.exe} {pass.out} {-flto -O2} {c} {} \
-    {tmpdir/liblto-19.so tmpdir/liblto-19.a}] \
--  [list {lto-20} \
--   {-Wl,--as-needed,-R,tmpdir} {} \
--   {lto-20a.c} {lto-20.exe} {pass.out} {-flto} {c} {} \
--   {tmpdir/liblto-20.so tmpdir/liblto-20_static.a -Wl,--no-as-needed}] \
-   [list {pr31482a} \
-    {-Wl,--no-as-needed,-R,tmpdir} {} \
-    {pr31482a.c} {pr31482a.exe} {pass.out} {-flto} {c} {} \
-
-base-commit: 2707d55e539ef323dd14a1293e762bf3d9739ee7
--- 
-2.49.0
-

diff --git a/9999/0006-ld-Skip-the-LTO-archive-member-only-for-the-earlier-.patch b/9999/0006-ld-Skip-the-LTO-archive-member-only-for-the-earlier-.patch
new file mode 100644
index 0000000..1eb52fc
--- /dev/null
+++ b/9999/0006-ld-Skip-the-LTO-archive-member-only-for-the-earlier-.patch
@@ -0,0 +1,186 @@
+https://inbox.sourceware.org/binutils/20250408201002.383836-1-hjl.tools@gmail.com/
+
+From b6ccbf6faecf5e2d43d776fab90f0a5d673a2817 Mon Sep 17 00:00:00 2001
+Message-ID: <b6ccbf6faecf5e2d43d776fab90f0a5d673a2817.1744165403.git.sam@gentoo.org>
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Tue, 8 Apr 2025 13:10:02 -0700
+Subject: [PATCH] ld: Skip the LTO archive member only for the earlier DSO
+
+commit 2707d55e539ef323dd14a1293e762bf3d9739ee7
+Author: Michael Matz <matz@suse.de>
+Date:   Mon Mar 31 15:57:08 2025 +0200
+
+skipped the LTO archive member even when the earlier item is also an
+archive.  Instead, skip the LTO archive member only if the earlier item
+is a shared library.
+
+bfd/
+
+	PR ld/32846
+	PR ld/32854
+	* elflink.c (elf_link_add_archive_symbols): Skip the LTO archive
+	member only if the earlier item is a shared library.
+
+ld/
+
+	PR ld/32846
+	PR ld/32854
+	* testsuite/ld-plugin/lto.exp: Run ld/32846 test.
+	* testsuite/ld-plugin/pr32846a.c: New file.
+	* testsuite/ld-plugin/pr32846b.c: Likewise.
+	* testsuite/ld-plugin/pr32846c.c: Likewise.
+	* testsuite/ld-plugin/pr32846d.c: Likewise.
+	* testsuite/ld-plugin/pr32846e.c: Likewise.
+
+Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
+---
+ bfd/elflink.c                     |  8 +++++---
+ ld/testsuite/ld-plugin/lto.exp    | 32 +++++++++++++++++++++++++++++++
+ ld/testsuite/ld-plugin/pr32846a.c |  6 ++++++
+ ld/testsuite/ld-plugin/pr32846b.c |  4 ++++
+ ld/testsuite/ld-plugin/pr32846c.c |  6 ++++++
+ ld/testsuite/ld-plugin/pr32846d.c | 12 ++++++++++++
+ ld/testsuite/ld-plugin/pr32846e.c |  4 ++++
+ 7 files changed, 69 insertions(+), 3 deletions(-)
+ create mode 100644 ld/testsuite/ld-plugin/pr32846a.c
+ create mode 100644 ld/testsuite/ld-plugin/pr32846b.c
+ create mode 100644 ld/testsuite/ld-plugin/pr32846c.c
+ create mode 100644 ld/testsuite/ld-plugin/pr32846d.c
+ create mode 100644 ld/testsuite/ld-plugin/pr32846e.c
+
+diff --git a/bfd/elflink.c b/bfd/elflink.c
+index a76e8e38da7..2ac12144990 100644
+--- a/bfd/elflink.c
++++ b/bfd/elflink.c
+@@ -6290,8 +6290,8 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
+ 		    continue;
+ 
+ 		  /* In the pre-LTO-plugin pass we must not mistakenly
+-		     include this archive member if an earlier BFD
+-		     defined this symbol.  */
++		     include this archive member if an earlier shared
++		     library defined this symbol.  */
+ 		  struct elf_link_hash_table *htab = elf_hash_table (info);
+ 		  if (htab->first_hash)
+ 		    {
+@@ -6299,7 +6299,9 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
+ 			  = ((struct elf_link_first_hash_entry *)
+ 			     bfd_hash_lookup (htab->first_hash, symdef->name,
+ 					      false, false));
+-		      if (e && e->abfd != abfd)
++		      if (e
++			  && (e->abfd->flags & DYNAMIC) != 0
++			  && e->abfd != abfd)
+ 			continue;
+ 		    }
+ 		}
+diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
+index 93491902674..726dd933329 100644
+--- a/ld/testsuite/ld-plugin/lto.exp
++++ b/ld/testsuite/ld-plugin/lto.exp
+@@ -1212,6 +1212,38 @@ if { [is_elf_format] } {
+ 
+ if { [is_elf_format] && [check_lto_shared_available] } {
+     run_ld_link_exec_tests $lto_run_elf_shared_tests
++    if { [check_lto_fat_available] } {
++	run_cc_link_tests [list \
++	    [list \
++	    	"Build libpr32846a.a" \
++	    	"$plug_opt" "-O2 -flto $lto_no_fat" \
++	    	{pr32846a.c pr32846b.c} {} "libpr32846a.a" \
++	    ] \
++	    [list \
++		"Build libpr32846b.a" \
++	    	"$plug_opt" "-O2 -flto $lto_no_fat" \
++		{pr32846a.c pr32846b.c pr32846c.c} {} "libpr32846b.a" \
++	    ] \
++	    [list \
++	    	"Build pr32846d.o" \
++	    	"$plug_opt" "-O2 -flto $lto_no_fat" \
++	    	{pr32846d.c} {} \
++	    ] \
++	    [list \
++	    	"Build pr32846e.o" \
++	    	"$plug_opt" "-O2 -flto $lto_no_fat" \
++	    	{pr32846e.c} {} \
++	    ] \
++	    [list \
++		"Build pr32846" \
++		"-shared -fPIC -O2 -flto $lto_no_fat -Wl,--no-undefined \
++		 tmpdir/pr32846d.o tmpdir/libpr32846a.a \
++		 tmpdir/libpr32846b.a tmpdir/pr32846e.o" \
++		"-O2 -fPIC -flto $lto_no_fat" \
++		{dummy.c} {} "pr32846" \
++	    ] \
++	] \
++    }
+ }
+ 
+ proc pr20103 {cflags libs} {
+diff --git a/ld/testsuite/ld-plugin/pr32846a.c b/ld/testsuite/ld-plugin/pr32846a.c
+new file mode 100644
+index 00000000000..8c161711bd9
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr32846a.c
+@@ -0,0 +1,6 @@
++extern void mkdir_p (void);
++void
++mkdir_parents (void)
++{
++  mkdir_p ();
++}
+diff --git a/ld/testsuite/ld-plugin/pr32846b.c b/ld/testsuite/ld-plugin/pr32846b.c
+new file mode 100644
+index 00000000000..9776a372d7a
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr32846b.c
+@@ -0,0 +1,4 @@
++void
++hash_new (void)
++{
++}
+diff --git a/ld/testsuite/ld-plugin/pr32846c.c b/ld/testsuite/ld-plugin/pr32846c.c
+new file mode 100644
+index 00000000000..f87cffb8865
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr32846c.c
+@@ -0,0 +1,6 @@
++extern void hash_new (void);
++void
++kmod_new (void)
++{
++  hash_new();
++}
+diff --git a/ld/testsuite/ld-plugin/pr32846d.c b/ld/testsuite/ld-plugin/pr32846d.c
+new file mode 100644
+index 00000000000..c6f41021adf
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr32846d.c
+@@ -0,0 +1,12 @@
++extern void kmod_new (void);
++extern void mkdir_parents (void);
++void
++do_lsmod (void)
++{
++  kmod_new ();
++}
++void
++do_static_nodes (void)
++{
++  mkdir_parents();
++}
+diff --git a/ld/testsuite/ld-plugin/pr32846e.c b/ld/testsuite/ld-plugin/pr32846e.c
+new file mode 100644
+index 00000000000..c4e5e56f4f6
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr32846e.c
+@@ -0,0 +1,4 @@
++void
++mkdir_p (void)
++{
++}
+
+base-commit: faaee6b411411f3c1f45768d7ac15559fd27b980
+-- 
+2.49.0
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-04-08  0:36 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-04-08  0:36 UTC (permalink / raw
  To: gentoo-commits

commit:     cc91de760c1833ebe917f073e4837c7664b3939a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Apr  8 00:36:31 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr  8 00:36:31 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=cc91de76

9999: revert recent LTO patch

Bug: https://sourceware.org/PR32846
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...t-lto-Fix-symlookup-in-archives-vs-shared.patch | 168 +++++++++++++++++++++
 1 file changed, 168 insertions(+)

diff --git a/9999/0006-Revert-lto-Fix-symlookup-in-archives-vs-shared.patch b/9999/0006-Revert-lto-Fix-symlookup-in-archives-vs-shared.patch
new file mode 100644
index 0000000..d8386fc
--- /dev/null
+++ b/9999/0006-Revert-lto-Fix-symlookup-in-archives-vs-shared.patch
@@ -0,0 +1,168 @@
+From ba77d9675b2af359875bc5ef785616c18285060b Mon Sep 17 00:00:00 2001
+Message-ID: <ba77d9675b2af359875bc5ef785616c18285060b.1744072567.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Tue, 8 Apr 2025 01:35:58 +0100
+Subject: [PATCH] Revert "[lto] Fix symlookup in archives vs shared"
+
+This reverts commit 2707d55e539ef323dd14a1293e762bf3d9739ee7.
+
+Bug: https://sourceware.org/PR32846
+---
+ bfd/elflink.c                     | 44 +++++++------------------------
+ ld/testsuite/ld-plugin/lto-20.ver |  1 -
+ ld/testsuite/ld-plugin/lto-20a.c  |  2 --
+ ld/testsuite/ld-plugin/lto-20b.c  | 11 --------
+ ld/testsuite/ld-plugin/lto.exp    | 10 -------
+ 5 files changed, 10 insertions(+), 58 deletions(-)
+ delete mode 100644 ld/testsuite/ld-plugin/lto-20.ver
+ delete mode 100644 ld/testsuite/ld-plugin/lto-20a.c
+ delete mode 100644 ld/testsuite/ld-plugin/lto-20b.c
+
+diff --git a/bfd/elflink.c b/bfd/elflink.c
+index a76e8e38da7..13993527e3e 100644
+--- a/bfd/elflink.c
++++ b/bfd/elflink.c
+@@ -4965,7 +4965,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
+       asection *sec, *new_sec;
+       flagword flags;
+       const char *name;
+-      const char *defvername;
+       bool must_copy_name = false;
+       struct elf_link_hash_entry *h;
+       struct elf_link_hash_entry *hi;
+@@ -5142,7 +5141,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
+       old_alignment = 0;
+       old_bfd = NULL;
+       new_sec = sec;
+-      defvername = NULL;
+ 
+       if (is_elf_hash_table (&htab->root))
+ 	{
+@@ -5261,7 +5259,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
+ 		 default version of the symbol.  */
+ 	      if ((iver.vs_vers & VERSYM_HIDDEN) == 0
+ 		  && isym->st_shndx != SHN_UNDEF)
+-		*p++ = ELF_VER_CHR, defvername = name;
++		*p++ = ELF_VER_CHR;
+ 	      memcpy (p, verstr, verlen + 1);
+ 
+ 	      name = newname;
+@@ -5711,15 +5709,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
+ 		}
+ 	      else if (dynamic
+ 		       && h->root.u.def.section->owner == abfd)
+-		{
+-		  /* Add this symbol to first hash if this shared
+-		     object has the first definition.  */
+-		  elf_link_add_to_first_hash (abfd, info, name, must_copy_name);
+-		  /* And if it was the default symbol version definition,
+-		     also add the short name.  */
+-		  if (defvername)
+-		    elf_link_add_to_first_hash (abfd, info, defvername, false);
+-		}
++		/* Add this symbol to first hash if this shared
++		   object has the first definition.  */
++		elf_link_add_to_first_hash (abfd, info, name, must_copy_name);
+ 	    }
+ 	}
+     }
+@@ -6281,28 +6273,12 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
+ 
+ 	  if (h->type == bfd_link_hash_undefined)
+ 	    {
+-	      if (is_elf_hash_table (info->hash))
+-		{
+-		  /* If the archive element has already been loaded then one
+-		     of the symbols defined by that element might have been
+-		     made undefined due to being in a discarded section.  */
+-		  if (((struct elf_link_hash_entry *) h)->indx == -3)
+-		    continue;
+-
+-		  /* In the pre-LTO-plugin pass we must not mistakenly
+-		     include this archive member if an earlier BFD
+-		     defined this symbol.  */
+-		  struct elf_link_hash_table *htab = elf_hash_table (info);
+-		  if (htab->first_hash)
+-		    {
+-		      struct elf_link_first_hash_entry *e
+-			  = ((struct elf_link_first_hash_entry *)
+-			     bfd_hash_lookup (htab->first_hash, symdef->name,
+-					      false, false));
+-		      if (e && e->abfd != abfd)
+-			continue;
+-		    }
+-		}
++	      /* If the archive element has already been loaded then one
++		 of the symbols defined by that element might have been
++		 made undefined due to being in a discarded section.  */
++	      if (is_elf_hash_table (info->hash)
++		  && ((struct elf_link_hash_entry *) h)->indx == -3)
++		continue;
+ 	    }
+ 	  else if (h->type == bfd_link_hash_common)
+ 	    {
+diff --git a/ld/testsuite/ld-plugin/lto-20.ver b/ld/testsuite/ld-plugin/lto-20.ver
+deleted file mode 100644
+index ac906ac4ad1..00000000000
+--- a/ld/testsuite/ld-plugin/lto-20.ver
++++ /dev/null
+@@ -1 +0,0 @@
+-FOO { global: foo; };
+diff --git a/ld/testsuite/ld-plugin/lto-20a.c b/ld/testsuite/ld-plugin/lto-20a.c
+deleted file mode 100644
+index 3d6dac96752..00000000000
+--- a/ld/testsuite/ld-plugin/lto-20a.c
++++ /dev/null
+@@ -1,2 +0,0 @@
+-extern int foo ();
+-int main () { return foo (); }
+diff --git a/ld/testsuite/ld-plugin/lto-20b.c b/ld/testsuite/ld-plugin/lto-20b.c
+deleted file mode 100644
+index ba123cbe38b..00000000000
+--- a/ld/testsuite/ld-plugin/lto-20b.c
++++ /dev/null
+@@ -1,11 +0,0 @@
+-extern int printf (const char *, ...);
+-int foo ()
+-{
+-#ifdef SHARED
+-    printf ("PASS\n");
+-    return 0;
+-#else
+-    printf ("FAIL\n");
+-    return 1;
+-#endif
+-}
+diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
+index 93491902674..556bbe9beea 100644
+--- a/ld/testsuite/ld-plugin/lto.exp
++++ b/ld/testsuite/ld-plugin/lto.exp
+@@ -477,12 +477,6 @@ set lto_link_elf_tests [list \
+   [list {liblto-19.so} \
+    {-shared tmpdir/lto-19b.o tmpdir/liblto-19.a} {-O2 -fPIC} \
+    {dummy.c} {} {liblto-19.so}] \
+-  [list {liblto-20_static.a} \
+-   {} {-fPIC} \
+-   {lto-20b.c} {} {liblto-20_static.a}] \
+-  [list {liblto-20.so} \
+-   {-shared -Wl,--version-script=lto-20.ver} {-DSHARED -fPIC} \
+-   {lto-20b.c} {} {liblto-20.so}] \
+   [list {pr26806.so} \
+    {-shared} {-fpic -O2 -flto} \
+    {pr26806.c} {{nm {-D} pr26806.d}} {pr26806.so}] \
+@@ -886,10 +880,6 @@ set lto_run_elf_shared_tests [list \
+    {-Wl,--as-needed,-R,tmpdir} {} \
+    {lto-19c.c} {lto-19.exe} {pass.out} {-flto -O2} {c} {} \
+    {tmpdir/liblto-19.so tmpdir/liblto-19.a}] \
+-  [list {lto-20} \
+-   {-Wl,--as-needed,-R,tmpdir} {} \
+-   {lto-20a.c} {lto-20.exe} {pass.out} {-flto} {c} {} \
+-   {tmpdir/liblto-20.so tmpdir/liblto-20_static.a -Wl,--no-as-needed}] \
+   [list {pr31482a} \
+    {-Wl,--no-as-needed,-R,tmpdir} {} \
+    {pr31482a.c} {pr31482a.exe} {pass.out} {-flto} {c} {} \
+
+base-commit: 2707d55e539ef323dd14a1293e762bf3d9739ee7
+-- 
+2.49.0
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-03-29 14:18 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-03-29 14:18 UTC (permalink / raw
  To: gentoo-commits

commit:     7b411d4b9fc34eea8574162203faf93f4277e391
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 29 14:18:17 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 29 14:18:28 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=7b411d4b

9999: drop -g hunks

Merged. This also drops the CFLAGS stuff for gprof but not going
to worry about that for now.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-Adjust-testsuites-for-flto-and-without-g.patch | 45 ----------------------
 1 file changed, 45 deletions(-)

diff --git a/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch b/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch
index 607e838..20a8c62 100644
--- a/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch
+++ b/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch
@@ -113,51 +113,6 @@ index a706efbba18..42a29927a5d 100644
  	untested $test
  	return
      }
-diff --git a/gprof/testsuite/Makefile.am b/gprof/testsuite/Makefile.am
-index c4d6c41fcf4..0c80b12e6e4 100644
---- a/gprof/testsuite/Makefile.am
-+++ b/gprof/testsuite/Makefile.am
-@@ -6,12 +6,12 @@ GPROF = ../gprof$(EXEEXT)
- 
- # NB: -O2 -fno-omit-frame-pointer is needed for expected call graph.  See
- # https://sourceware.org/bugzilla/show_bug.cgi?id=32768
--GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg
-+# -g is needed for line number info checked by tst-gmon-gprof-l.sh.  See
-+# https://sourceware.org/bugzilla/show_bug.cgi?id=32779
-+GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg -g
- 
--COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
--	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(GPROF_FLAGS)
--LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) $(GPROF_FLAGS) \
--	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-+COMPILE = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS)
-+LINK = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
- 
- # We will add to these later, for each individual test.  Note
- # that we add each test under check_SCRIPTS;
-diff --git a/gprof/testsuite/Makefile.in b/gprof/testsuite/Makefile.in
-index 008f6be879e..2ac5f241012 100644
---- a/gprof/testsuite/Makefile.in
-+++ b/gprof/testsuite/Makefile.in
-@@ -496,13 +496,11 @@ GPROF = ../gprof$(EXEEXT)
- 
- # NB: -O2 -fno-omit-frame-pointer is needed for expected call graph.  See
- # https://sourceware.org/bugzilla/show_bug.cgi?id=32768
--GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg
--COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
--	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(GPROF_FLAGS)
--
--LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) $(GPROF_FLAGS) \
--	$(AM_LDFLAGS) $(LDFLAGS) -o $@
--
-+# -g is needed for line number info checked by tst-gmon-gprof-l.sh.  See
-+# https://sourceware.org/bugzilla/show_bug.cgi?id=32779
-+GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg -g
-+COMPILE = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS)
-+LINK = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
- 
- # We will add to these later, for each individual test.  Note
- # that we add each test under check_SCRIPTS;
 diff --git a/ld/testsuite/ld-ctf/ctf.exp b/ld/testsuite/ld-ctf/ctf.exp
 index c314f2995af..08b47d2db18 100644
 --- a/ld/testsuite/ld-ctf/ctf.exp


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-03-12 20:21 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-03-12 20:21 UTC (permalink / raw
  To: gentoo-commits

commit:     c61c48e5527b9027fc85b529b8d61fdf5c19920a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 12 20:21:48 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 12 20:21:48 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=c61c48e5

9999: add testsuite patch from H.J.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-Adjust-testsuites-for-flto-and-without-g.patch | 260 +++++++++++++++++++++
 1 file changed, 260 insertions(+)

diff --git a/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch b/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch
new file mode 100644
index 0000000..607e838
--- /dev/null
+++ b/9999/0005-Adjust-testsuites-for-flto-and-without-g.patch
@@ -0,0 +1,260 @@
+From f22ea3e751a11ab8cfb5524468d97a998cca0325 Mon Sep 17 00:00:00 2001
+Message-ID: <f22ea3e751a11ab8cfb5524468d97a998cca0325.1741810888.git.sam@gentoo.org>
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 10 Mar 2025 17:07:16 -0700
+Subject: [PATCH] Adjust testsuites for -flto and without -g
+
+Adjust testsuites for binutils built with -flto and without -g:
+
+1. Pass -fno-lto to objcopy tests which don't work with LTO.
+2. Update gprof testsuite to avoid LTO and compile with -g for line
+number info checked by tst-gmon-gprof-l.sh.
+3. Append $NOLTO_CFLAGS in ctf.exp.
+4. For libctf, filter out -flto in CFLAGS for "make check" and also
+prune lto-wrapper warnings.
+
+binutils/
+
+	PR binutils/32773
+	* testsuite/binutils-all/objcopy.exp (no_lto_flags): New.
+	(strip_test): Pass $no_lto_flags to target_compile.
+	(strip_test_with_saving_a_symbol): Likewise.
+	(objcopy_test_without_global_symbol): Likewise.
+
+gprof/
+
+	PR binutils/32773
+	PR gprof/32779
+	* testsuite/Makefile.am (GPROF_FLAGS): Add -g.
+	(COMPILE): Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS)".
+	(LINK) Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS)
+	$(LDFLAGS) -o $@".
+	* testsuite/Makefile.in: Regenerated.
+
+ld/
+
+	PR binutils/32773
+	* testsuite/ld-ctf/ctf.exp (old_CFLAGS): New.
+	(CFLAGS_FOR_TARGET): Append $NOLTO_CFLAGS.
+
+libctf/
+
+	PR binutils/32773
+	* Makefile.am (check-DEJAGNU): Filter out -flto in CFLAGS.
+	* Makefile.in: Regenerated.
+	* testsuite/lib/ctf-lib.exp (prune_warnings_lto): New.
+	(run_lookup_test): Replace prune_warnings with
+	prune_warnings_lto.
+	(run_lookup_test): Likewise.
+
+Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
+---
+ binutils/testsuite/binutils-all/objcopy.exp | 14 +++++++++++---
+ gprof/testsuite/Makefile.am                 | 10 +++++-----
+ gprof/testsuite/Makefile.in                 | 12 +++++-------
+ ld/testsuite/ld-ctf/ctf.exp                 |  5 +++++
+ libctf/Makefile.am                          |  3 ++-
+ libctf/Makefile.in                          |  3 ++-
+ libctf/testsuite/lib/ctf-lib.exp            | 14 ++++++++++++--
+ 7 files changed, 42 insertions(+), 19 deletions(-)
+
+diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
+index a706efbba18..42a29927a5d 100644
+--- a/binutils/testsuite/binutils-all/objcopy.exp
++++ b/binutils/testsuite/binutils-all/objcopy.exp
+@@ -36,6 +36,11 @@ if ![is_remote host] {
+     set copyfile copy
+ }
+ 
++set no_lto_flags "additional_flags=-fno-lto"
++if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object $no_lto_flags] != "" } {
++    set no_lto_flags ""
++}
++
+ # Test that objcopy does not modify a file when copying it.
+ # "object" or "executable" values for type are supported.
+ 
+@@ -516,10 +521,11 @@ proc strip_test { } {
+     global srcdir
+     global subdir
+     global READELF
++    global no_lto_flags
+ 
+     set test "strip"
+ 
+-    if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
++    if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object "debug $no_lto_flags"] != "" } {
+ 	untested $test
+ 	return
+     }
+@@ -628,10 +634,11 @@ proc strip_test_with_saving_a_symbol { } {
+     global NMFLAGS
+     global srcdir
+     global subdir
++    global no_lto_flags
+ 
+     set test "strip with saving a symbol"
+ 
+-    if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
++    if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object "debug $no_lto_flags"] != "" } {
+ 	untested $test
+ 	return
+     }
+@@ -1381,10 +1388,11 @@ proc objcopy_test_without_global_symbol { } {
+     global OBJDUMPFLAGS
+     global srcdir
+     global subdir
++    global no_lto_flags
+ 
+     set test "strip without global symbol "
+ 
+-    if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object debug] != "" } {
++    if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object "debug $no_lto_flags"] != "" } {
+ 	untested $test
+ 	return
+     }
+diff --git a/gprof/testsuite/Makefile.am b/gprof/testsuite/Makefile.am
+index c4d6c41fcf4..0c80b12e6e4 100644
+--- a/gprof/testsuite/Makefile.am
++++ b/gprof/testsuite/Makefile.am
+@@ -6,12 +6,12 @@ GPROF = ../gprof$(EXEEXT)
+ 
+ # NB: -O2 -fno-omit-frame-pointer is needed for expected call graph.  See
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=32768
+-GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg
++# -g is needed for line number info checked by tst-gmon-gprof-l.sh.  See
++# https://sourceware.org/bugzilla/show_bug.cgi?id=32779
++GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg -g
+ 
+-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(GPROF_FLAGS)
+-LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) $(GPROF_FLAGS) \
+-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
++COMPILE = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS)
++LINK = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ 
+ # We will add to these later, for each individual test.  Note
+ # that we add each test under check_SCRIPTS;
+diff --git a/gprof/testsuite/Makefile.in b/gprof/testsuite/Makefile.in
+index 008f6be879e..2ac5f241012 100644
+--- a/gprof/testsuite/Makefile.in
++++ b/gprof/testsuite/Makefile.in
+@@ -496,13 +496,11 @@ GPROF = ../gprof$(EXEEXT)
+ 
+ # NB: -O2 -fno-omit-frame-pointer is needed for expected call graph.  See
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=32768
+-GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg
+-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(GPROF_FLAGS)
+-
+-LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) $(GPROF_FLAGS) \
+-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+-
++# -g is needed for line number info checked by tst-gmon-gprof-l.sh.  See
++# https://sourceware.org/bugzilla/show_bug.cgi?id=32779
++GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg -g
++COMPILE = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS)
++LINK = $(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ 
+ # We will add to these later, for each individual test.  Note
+ # that we add each test under check_SCRIPTS;
+diff --git a/ld/testsuite/ld-ctf/ctf.exp b/ld/testsuite/ld-ctf/ctf.exp
+index c314f2995af..08b47d2db18 100644
+--- a/ld/testsuite/ld-ctf/ctf.exp
++++ b/ld/testsuite/ld-ctf/ctf.exp
+@@ -33,6 +33,9 @@ if ![check_shared_lib_support] {
+     return 0
+ }
+ 
++set old_CFLAGS "$CFLAGS_FOR_TARGET"
++append CFLAGS_FOR_TARGET " $NOLTO_CFLAGS"
++
+ if {[info exists env(LC_ALL)]} {
+     set old_lc_all $env(LC_ALL)
+ }
+@@ -55,3 +58,5 @@ if {[info exists old_lc_all]} {
+ } else {
+     unset env(LC_ALL)
+ }
++
++set CFLAGS_FOR_TARGET "$old_CFLAGS"
+diff --git a/libctf/Makefile.am b/libctf/Makefile.am
+index 6e136220497..bf214d8a000 100644
+--- a/libctf/Makefile.am
++++ b/libctf/Makefile.am
+@@ -102,11 +102,12 @@ check-DEJAGNU: site.exp development.exp
+ 	else \
+ 	  TEST_CROSS=yes; \
+ 	fi; \
++	TEST_CFLAGS=`echo "$(CFLAGS)" | sed -e "s/-flto[^ \t]*//"`; \
+ 	runtest=$(RUNTEST); \
+ 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ 	  $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
+ 		CC="$(CC)" CC_FOR_TARGET="$(CC_FOR_TARGET)" TEST_CROSS="$${TEST_CROSS}" \
+-		CFLAGS="$(CFLAGS) -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
++		CFLAGS="$$TEST_CFLAGS -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
+ 		LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \
+ 	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ 	fi
+diff --git a/libctf/Makefile.in b/libctf/Makefile.in
+index 5d9587766dc..e5bb94c681b 100644
+--- a/libctf/Makefile.in
++++ b/libctf/Makefile.in
+@@ -1819,11 +1819,12 @@ check-DEJAGNU: site.exp development.exp
+ 	else \
+ 	  TEST_CROSS=yes; \
+ 	fi; \
++	TEST_CFLAGS=`echo "$(CFLAGS)" | sed -e "s/-flto[^ \t]*//"`; \
+ 	runtest=$(RUNTEST); \
+ 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ 	  $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
+ 		CC="$(CC)" CC_FOR_TARGET="$(CC_FOR_TARGET)" TEST_CROSS="$${TEST_CROSS}" \
+-		CFLAGS="$(CFLAGS) -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
++		CFLAGS="$$TEST_CFLAGS -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
+ 		LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \
+ 	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ 	fi
+diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp
+index 64d2a40ad9f..6d3b75e22a2 100644
+--- a/libctf/testsuite/lib/ctf-lib.exp
++++ b/libctf/testsuite/lib/ctf-lib.exp
+@@ -54,6 +54,16 @@ proc compile_link_one_host_cc { src output additional_args } {
+     return [run_native_host_cmd "./libtool --quiet --tag=CC --mode=link $CC $CFLAGS $src -o $output $additional_args" ]
+ }
+ 
++# Also prune lto-wrapper warnings, like
++# lto-wrapper: warning: using serial compilation of 16 LTRANS jobs
++# lto-wrapper: note: see the '-flto' option documentation for more information
++#
++proc prune_warnings_lto { msg } {
++    set msgx "lto-wrapper: (?:warning\:\[^\n\r\]+|note\:\[^\n\r\]+)"
++    regsub -all "$msgx\[\n\r\]*" $msg {} msg
++    return [prune_warnings $msg]
++}
++
+ # run_lookup_test FILE
+ #
+ # Compile with the host compiler and link a .c file into a "lookup" binary, then
+@@ -208,7 +218,7 @@ proc run_lookup_test { name } {
+     set testname $file4log
+ 
+     # Compile and link the lookup program.
+-    set comp_output [prune_warnings [compile_link_one_host_cc $opts(lookup) "tmpdir/lookup" "libctf.la $opts(lookup_link)"]]
++    set comp_output [prune_warnings_lto [compile_link_one_host_cc $opts(lookup) "tmpdir/lookup" "libctf.la $opts(lookup_link)"]]
+ 
+     if { $comp_output != ""} {
+ 	send_log "compilation of lookup program $opts(lookup) failed with <$comp_output>"
+@@ -244,7 +254,7 @@ proc run_lookup_test { name } {
+ 	    }
+ 	}
+ 
+-	set comp_output [prune_warnings [run_host_cmd "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET $lookup_flags [concat $src] -o $lookup_output"]]
++	set comp_output [prune_warnings_lto [run_host_cmd "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET $lookup_flags [concat $src] -o $lookup_output"]]
+ 
+ 	if { $comp_output != ""} {
+ 	    send_log "compilation of CTF program [concat $src] failed with <$comp_output>"
+
+base-commit: add96080cf9e460afe478cfad489d7f22ab10678
+-- 
+2.48.1
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-03-06 12:54 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-03-06 12:54 UTC (permalink / raw
  To: gentoo-commits

commit:     1bd87bad1171dd03613aac6fe3ff4764648d130a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Mar  6 12:54:08 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar  6 12:54:08 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=1bd87bad

9999: drop gprof revert

Merged upstream.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...f-only-process-line-numbers-for-intersect.patch | 179 ---------------------
 1 file changed, 179 deletions(-)

diff --git a/9999/0005-Revert-gprof-only-process-line-numbers-for-intersect.patch b/9999/0005-Revert-gprof-only-process-line-numbers-for-intersect.patch
deleted file mode 100644
index 210438d..0000000
--- a/9999/0005-Revert-gprof-only-process-line-numbers-for-intersect.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-From d7ccec5522b6c7f61c95c7db4d1d91ff17cd1a31 Mon Sep 17 00:00:00 2001
-Message-ID: <d7ccec5522b6c7f61c95c7db4d1d91ff17cd1a31.1741236819.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Thu, 6 Mar 2025 04:53:27 +0000
-Subject: [PATCH] Revert "gprof: only process line numbers for intersection of
- vmas and histograms"
-
-This reverts commit b8189cf9e40bd90502c9a2ce0df39dd54419bea4.
-
-Bug: https://sourceware.org/PR32764
----
- gprof/corefile.c | 96 +++++++++++++++++++++++-------------------------
- gprof/gprof.c    | 23 ++++++------
- 2 files changed, 56 insertions(+), 63 deletions(-)
-
-diff --git a/gprof/corefile.c b/gprof/corefile.c
-index a8970b3200d..bc26bd7883e 100644
---- a/gprof/corefile.c
-+++ b/gprof/corefile.c
-@@ -755,9 +755,8 @@ core_create_line_syms (void)
-   Sym prev, *sym;
-   const char *filename;
-   Sym_Table ltab;
-+  bfd_vma vma_high;
-   size_t ltab_reserved;
--  bfd_vma bfd_vma_low = core_text_sect->vma;
--  bfd_vma bfd_vma_high = bfd_vma_low + bfd_section_size (core_text_sect);
- 
-   /* Create symbols for functions as usual.  This is necessary in
-      cases where parts of a program were not compiled with -g.  For
-@@ -787,58 +786,53 @@ core_create_line_syms (void)
-      lot cleaner now.  */
-   memset (&prev, 0, sizeof (prev));
- 
--  for (size_t i = 0; i < num_histograms; ++i)
-+  vma_high = core_text_sect->vma + bfd_section_size (core_text_sect);
-+  for (vma = core_text_sect->vma; vma < vma_high; vma += insn_boundary)
-     {
--      bfd_vma hist_vma_high = histograms[i].highpc;
--      bfd_vma vma_low = MAX (histograms[i].lowpc, bfd_vma_low);
--      bfd_vma vma_high = MIN (bfd_vma_high, hist_vma_high);
--      for (vma = vma_low; vma < vma_high; vma += insn_boundary)
-+      if (ltab.len >= ltab_reserved)
- 	{
--	  if (ltab.len >= ltab_reserved)
--	    {
--	      /* Reserve more space for line symbols.  */
--	      ltab_reserved *= 2;
--	      ltab.base = xrealloc (ltab.base, ltab_reserved * sizeof (Sym));
--	      ltab.limit = ltab.base + ltab.len;
--	    }
--	  sym_init (ltab.limit);
--
--	  if (!get_src_info (vma, &filename, &ltab.limit->name, &ltab.limit->line_num)
--	      || (prev.name && prev.line_num == ltab.limit->line_num
--		  && strcmp (prev.name, ltab.limit->name) == 0
--		  && filename_cmp (prev.file->name, filename) == 0))
--	    continue;
--
--	  /* Make name pointer a malloc'ed string.  */
--	  ltab.limit->name = xstrdup (ltab.limit->name);
--	  ltab.limit->file = source_file_lookup_path (filename);
--
--	  ltab.limit->addr = vma;
--
--	  /* Set is_static based on the enclosing function, using either:
--	     1) the previous symbol, if it's from the same function, or
--	     2) a symtab lookup.  */
--	  if (prev.name && ltab.limit->file == prev.file
--	      && strcmp (ltab.limit->name, prev.name) == 0)
--	    {
--	      ltab.limit->is_static = prev.is_static;
--	    }
--	  else
--	    {
--	      sym = sym_lookup(&symtab, ltab.limit->addr);
--	      if (sym)
--		ltab.limit->is_static = sym->is_static;
--	    }
--
--	  prev = *ltab.limit;
--
--	  DBG (AOUTDEBUG, printf ("[core_create_line_syms] %lu %s 0x%lx\n",
--				  (unsigned long) (ltab.limit - ltab.base),
--				  ltab.limit->name,
--				  (unsigned long) ltab.limit->addr));
--	  ++ltab.limit;
--	  ++ltab.len;
-+	  /* Reserve more space for line symbols.  */
-+	  ltab_reserved *= 2;
-+	  ltab.base = (Sym *) xrealloc (ltab.base, ltab_reserved * sizeof (Sym));
-+	  ltab.limit = ltab.base + ltab.len;
- 	}
-+      sym_init (ltab.limit);
-+
-+      if (!get_src_info (vma, &filename, &ltab.limit->name, &ltab.limit->line_num)
-+	  || (prev.name && prev.line_num == ltab.limit->line_num
-+	      && strcmp (prev.name, ltab.limit->name) == 0
-+	      && filename_cmp (prev.file->name, filename) == 0))
-+	continue;
-+
-+      /* Make name pointer a malloc'ed string.  */
-+      ltab.limit->name = xstrdup (ltab.limit->name);
-+      ltab.limit->file = source_file_lookup_path (filename);
-+
-+      ltab.limit->addr = vma;
-+
-+      /* Set is_static based on the enclosing function, using either:
-+	 1) the previous symbol, if it's from the same function, or
-+	 2) a symtab lookup.  */
-+      if (ltab.limit->file == prev.file
-+	  && strcmp (ltab.limit->name, prev.name) == 0)
-+	{
-+	  ltab.limit->is_static = prev.is_static;
-+	}
-+      else
-+	{
-+	  sym = sym_lookup(&symtab, ltab.limit->addr);
-+          if (sym)
-+	    ltab.limit->is_static = sym->is_static;
-+	}
-+
-+      prev = *ltab.limit;
-+
-+      DBG (AOUTDEBUG, printf ("[core_create_line_syms] %lu %s 0x%lx\n",
-+			      (unsigned long) (ltab.limit - ltab.base),
-+			      ltab.limit->name,
-+			      (unsigned long) ltab.limit->addr));
-+      ++ltab.limit;
-+      ++ltab.len;
-     }
- 
-   /* Reserve space for function symbols and/or trim excess space.  */
-diff --git a/gprof/gprof.c b/gprof/gprof.c
-index d1cbf25fa28..9392575f747 100644
---- a/gprof/gprof.c
-+++ b/gprof/gprof.c
-@@ -527,6 +527,17 @@ This program is free software.  This program has absolutely no warranty.\n"));
-   if (ignore_direct_calls)
-     core_get_text_space (core_bfd);
- 
-+  /* Create symbols from core image.  */
-+  if (external_symbol_table)
-+    core_create_syms_from (external_symbol_table);
-+  else if (line_granularity)
-+    core_create_line_syms ();
-+  else
-+    core_create_function_syms ();
-+
-+  /* Translate sym specs into syms.  */
-+  sym_id_parse ();
-+
-   if (file_format == FF_PROF)
-     {
-       fprintf (stderr,
-@@ -546,18 +557,6 @@ This program is free software.  This program has absolutely no warranty.\n"));
-       while (optind++ < argc);
-     }
- 
--  /* Create symbols from core image.  */
--  if (external_symbol_table)
--    core_create_syms_from (external_symbol_table);
--  else if (line_granularity)
--    core_create_line_syms ();
--  else
--    core_create_function_syms ();
--
--  /* Translate sym specs into syms.  */
--  sym_id_parse ();
--
--
-   /* If user did not specify output style, try to guess something
-      reasonable.  */
-   if (output_style == 0)
-
-base-commit: 34f65d9dee431f840b554a9de6de314cc22849d7
--- 
-2.48.1
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-03-06  4:54 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-03-06  4:54 UTC (permalink / raw
  To: gentoo-commits

commit:     cede467b7d5956b862883d790f438efbaca7a8b7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Mar  6 04:54:09 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar  6 04:54:50 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=cede467b

9999: revert gprof patch breaking glibc gmon tests

Bug: https://sourceware.org/PR32764
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...f-only-process-line-numbers-for-intersect.patch | 179 +++++++++++++++++++++
 1 file changed, 179 insertions(+)

diff --git a/9999/0005-Revert-gprof-only-process-line-numbers-for-intersect.patch b/9999/0005-Revert-gprof-only-process-line-numbers-for-intersect.patch
new file mode 100644
index 0000000..210438d
--- /dev/null
+++ b/9999/0005-Revert-gprof-only-process-line-numbers-for-intersect.patch
@@ -0,0 +1,179 @@
+From d7ccec5522b6c7f61c95c7db4d1d91ff17cd1a31 Mon Sep 17 00:00:00 2001
+Message-ID: <d7ccec5522b6c7f61c95c7db4d1d91ff17cd1a31.1741236819.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Thu, 6 Mar 2025 04:53:27 +0000
+Subject: [PATCH] Revert "gprof: only process line numbers for intersection of
+ vmas and histograms"
+
+This reverts commit b8189cf9e40bd90502c9a2ce0df39dd54419bea4.
+
+Bug: https://sourceware.org/PR32764
+---
+ gprof/corefile.c | 96 +++++++++++++++++++++++-------------------------
+ gprof/gprof.c    | 23 ++++++------
+ 2 files changed, 56 insertions(+), 63 deletions(-)
+
+diff --git a/gprof/corefile.c b/gprof/corefile.c
+index a8970b3200d..bc26bd7883e 100644
+--- a/gprof/corefile.c
++++ b/gprof/corefile.c
+@@ -755,9 +755,8 @@ core_create_line_syms (void)
+   Sym prev, *sym;
+   const char *filename;
+   Sym_Table ltab;
++  bfd_vma vma_high;
+   size_t ltab_reserved;
+-  bfd_vma bfd_vma_low = core_text_sect->vma;
+-  bfd_vma bfd_vma_high = bfd_vma_low + bfd_section_size (core_text_sect);
+ 
+   /* Create symbols for functions as usual.  This is necessary in
+      cases where parts of a program were not compiled with -g.  For
+@@ -787,58 +786,53 @@ core_create_line_syms (void)
+      lot cleaner now.  */
+   memset (&prev, 0, sizeof (prev));
+ 
+-  for (size_t i = 0; i < num_histograms; ++i)
++  vma_high = core_text_sect->vma + bfd_section_size (core_text_sect);
++  for (vma = core_text_sect->vma; vma < vma_high; vma += insn_boundary)
+     {
+-      bfd_vma hist_vma_high = histograms[i].highpc;
+-      bfd_vma vma_low = MAX (histograms[i].lowpc, bfd_vma_low);
+-      bfd_vma vma_high = MIN (bfd_vma_high, hist_vma_high);
+-      for (vma = vma_low; vma < vma_high; vma += insn_boundary)
++      if (ltab.len >= ltab_reserved)
+ 	{
+-	  if (ltab.len >= ltab_reserved)
+-	    {
+-	      /* Reserve more space for line symbols.  */
+-	      ltab_reserved *= 2;
+-	      ltab.base = xrealloc (ltab.base, ltab_reserved * sizeof (Sym));
+-	      ltab.limit = ltab.base + ltab.len;
+-	    }
+-	  sym_init (ltab.limit);
+-
+-	  if (!get_src_info (vma, &filename, &ltab.limit->name, &ltab.limit->line_num)
+-	      || (prev.name && prev.line_num == ltab.limit->line_num
+-		  && strcmp (prev.name, ltab.limit->name) == 0
+-		  && filename_cmp (prev.file->name, filename) == 0))
+-	    continue;
+-
+-	  /* Make name pointer a malloc'ed string.  */
+-	  ltab.limit->name = xstrdup (ltab.limit->name);
+-	  ltab.limit->file = source_file_lookup_path (filename);
+-
+-	  ltab.limit->addr = vma;
+-
+-	  /* Set is_static based on the enclosing function, using either:
+-	     1) the previous symbol, if it's from the same function, or
+-	     2) a symtab lookup.  */
+-	  if (prev.name && ltab.limit->file == prev.file
+-	      && strcmp (ltab.limit->name, prev.name) == 0)
+-	    {
+-	      ltab.limit->is_static = prev.is_static;
+-	    }
+-	  else
+-	    {
+-	      sym = sym_lookup(&symtab, ltab.limit->addr);
+-	      if (sym)
+-		ltab.limit->is_static = sym->is_static;
+-	    }
+-
+-	  prev = *ltab.limit;
+-
+-	  DBG (AOUTDEBUG, printf ("[core_create_line_syms] %lu %s 0x%lx\n",
+-				  (unsigned long) (ltab.limit - ltab.base),
+-				  ltab.limit->name,
+-				  (unsigned long) ltab.limit->addr));
+-	  ++ltab.limit;
+-	  ++ltab.len;
++	  /* Reserve more space for line symbols.  */
++	  ltab_reserved *= 2;
++	  ltab.base = (Sym *) xrealloc (ltab.base, ltab_reserved * sizeof (Sym));
++	  ltab.limit = ltab.base + ltab.len;
+ 	}
++      sym_init (ltab.limit);
++
++      if (!get_src_info (vma, &filename, &ltab.limit->name, &ltab.limit->line_num)
++	  || (prev.name && prev.line_num == ltab.limit->line_num
++	      && strcmp (prev.name, ltab.limit->name) == 0
++	      && filename_cmp (prev.file->name, filename) == 0))
++	continue;
++
++      /* Make name pointer a malloc'ed string.  */
++      ltab.limit->name = xstrdup (ltab.limit->name);
++      ltab.limit->file = source_file_lookup_path (filename);
++
++      ltab.limit->addr = vma;
++
++      /* Set is_static based on the enclosing function, using either:
++	 1) the previous symbol, if it's from the same function, or
++	 2) a symtab lookup.  */
++      if (ltab.limit->file == prev.file
++	  && strcmp (ltab.limit->name, prev.name) == 0)
++	{
++	  ltab.limit->is_static = prev.is_static;
++	}
++      else
++	{
++	  sym = sym_lookup(&symtab, ltab.limit->addr);
++          if (sym)
++	    ltab.limit->is_static = sym->is_static;
++	}
++
++      prev = *ltab.limit;
++
++      DBG (AOUTDEBUG, printf ("[core_create_line_syms] %lu %s 0x%lx\n",
++			      (unsigned long) (ltab.limit - ltab.base),
++			      ltab.limit->name,
++			      (unsigned long) ltab.limit->addr));
++      ++ltab.limit;
++      ++ltab.len;
+     }
+ 
+   /* Reserve space for function symbols and/or trim excess space.  */
+diff --git a/gprof/gprof.c b/gprof/gprof.c
+index d1cbf25fa28..9392575f747 100644
+--- a/gprof/gprof.c
++++ b/gprof/gprof.c
+@@ -527,6 +527,17 @@ This program is free software.  This program has absolutely no warranty.\n"));
+   if (ignore_direct_calls)
+     core_get_text_space (core_bfd);
+ 
++  /* Create symbols from core image.  */
++  if (external_symbol_table)
++    core_create_syms_from (external_symbol_table);
++  else if (line_granularity)
++    core_create_line_syms ();
++  else
++    core_create_function_syms ();
++
++  /* Translate sym specs into syms.  */
++  sym_id_parse ();
++
+   if (file_format == FF_PROF)
+     {
+       fprintf (stderr,
+@@ -546,18 +557,6 @@ This program is free software.  This program has absolutely no warranty.\n"));
+       while (optind++ < argc);
+     }
+ 
+-  /* Create symbols from core image.  */
+-  if (external_symbol_table)
+-    core_create_syms_from (external_symbol_table);
+-  else if (line_granularity)
+-    core_create_line_syms ();
+-  else
+-    core_create_function_syms ();
+-
+-  /* Translate sym specs into syms.  */
+-  sym_id_parse ();
+-
+-
+   /* If user did not specify output style, try to guess something
+      reasonable.  */
+   if (output_style == 0)
+
+base-commit: 34f65d9dee431f840b554a9de6de314cc22849d7
+-- 
+2.48.1
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-02-03 18:02 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2025-02-03 18:02 UTC (permalink / raw
  To: gentoo-commits

commit:     2be385087cbca35633d0fb6777017ec8f07875cc
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  3 18:01:36 2025 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Feb  3 18:01:36 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=2be38508

Drop gold patch (XFAIL 15 tests)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...lar-libiberty-fix-as-in-7d53105d-for-lib.patch} |  0
 ...0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch | 77 ----------------------
 2 files changed, 77 deletions(-)

diff --git a/9999/0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch b/9999/0004-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
similarity index 100%
rename from 9999/0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
rename to 9999/0004-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch

diff --git a/9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
deleted file mode 100644
index 943d079..0000000
--- a/9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From 942b4489226184460d46eb9e7450eb63a1885621 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Sat, 31 Jul 2021 01:18:18 +0200
-Subject: [PATCH 4/5] Gentoo: XFAIL 15 broken ld.gold tests
-
-It seems like either the tests or ld.gold in general cannot handle
-compilers built with --enable-default-pie. No fix yet, so let's ignore
-these test failures for the moment. For details see the linked bugs.
-
-Bug: https://bugs.gentoo.org/684046
-Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22755
-Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27303
----
- gold/testsuite/Makefile.am |  6 ++++++
- gold/testsuite/Makefile.in | 16 ++++++++++++----
- 2 files changed, 18 insertions(+), 4 deletions(-)
-
-diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
-index 2f1348fd6e2..1206460f191 100644
---- a/gold/testsuite/Makefile.am
-+++ b/gold/testsuite/Makefile.am
-@@ -1,5 +1,11 @@
- # Process this file with automake to generate Makefile.in
- 
-+# Gentoo, https://bugs.gentoo.org/684046
-+XFAIL_TESTS = exception_separate_shared_12_test exception_separate_shared_21_test \
-+	weak_undef_test initpri3a justsyms_exec script_test_2 script_test_1 \
-+	justsyms binary_test script_test_3 tls_phdrs_script_test script_test_12i \
-+	dynamic_list_2 incremental_test_2 incremental_test_5
-+
- # As far as I can tell automake testing support assumes that the build
- # system and the host system are the same.  So these tests will not
- # work when building with a cross-compiler.
-diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
-index 9cf21df8d7d..df14333c558 100644
---- a/gold/testsuite/Makefile.in
-+++ b/gold/testsuite/Makefile.in
-@@ -15,10 +15,6 @@
- @SET_MAKE@
- 
- # Process this file with automake to generate Makefile.in
--
--# As far as I can tell automake testing support assumes that the build
--# system and the host system are the same.  So these tests will not
--# work when building with a cross-compiler.
- VPATH = @srcdir@
- am__is_gnu_make = { \
-   if test -z '$(MAKELEVEL)'; then \
-@@ -94,6 +90,14 @@ POST_UNINSTALL = :
- build_triplet = @build@
- host_triplet = @host@
- target_triplet = @target@
-+XFAIL_TESTS = exception_separate_shared_12_test$(EXEEXT) \
-+	exception_separate_shared_21_test$(EXEEXT) \
-+	weak_undef_test$(EXEEXT) initpri3a$(EXEEXT) \
-+	justsyms_exec$(EXEEXT) script_test_2$(EXEEXT) \
-+	script_test_1$(EXEEXT) justsyms$(EXEEXT) binary_test$(EXEEXT) \
-+	script_test_3$(EXEEXT) tls_phdrs_script_test$(EXEEXT) \
-+	script_test_12i$(EXEEXT) dynamic_list_2$(EXEEXT) \
-+	incremental_test_2$(EXEEXT) incremental_test_5$(EXEEXT)
- check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
- 	$(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
- 	$(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \
-@@ -2782,6 +2786,10 @@ top_srcdir = @top_srcdir@
- zlibdir = @zlibdir@
- zlibinc = @zlibinc@
- 
-+# As far as I can tell automake testing support assumes that the build
-+# system and the host system are the same.  So these tests will not
-+# work when building with a cross-compiler.
-+
- # Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
- AUTOMAKE_OPTIONS = foreign -Wno-portability
- 
--- 
-2.44.2
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-01-14  2:09 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-01-14  2:09 UTC (permalink / raw
  To: gentoo-commits

commit:     043dad090e6059d52cfc14f7224ad755cdde1dc2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 14 02:08:51 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 14 02:08:51 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=043dad09

9999: drop upstream LTO patches

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-LTO-and-none-LTO-output-support-for-ld-r.patch | 2928 --------------------
 ...ment-mixing-LTO-and-non-LTO-objects-for-r.patch |   42 -
 ...008-h8300-Handle-.gnu_object_only-section.patch |   37 -
 3 files changed, 3007 deletions(-)

diff --git a/9999/0006-ld-Add-LTO-and-none-LTO-output-support-for-ld-r.patch b/9999/0006-ld-Add-LTO-and-none-LTO-output-support-for-ld-r.patch
deleted file mode 100644
index b26d48f..0000000
--- a/9999/0006-ld-Add-LTO-and-none-LTO-output-support-for-ld-r.patch
+++ /dev/null
@@ -1,2928 +0,0 @@
-From 9f57274faacf1dbb6c2b56d29de150b5e79ecb3d Mon Sep 17 00:00:00 2001
-Message-ID: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Mon, 4 Nov 2013 09:17:45 -0800
-Subject: [PATCH 6/8] ld: Add LTO and none-LTO output support for ld -r
-
-Link with mixed IR/non-IR objects
-
-* 2 kinds of object files
-  o non-IR object file has
-    * non-IR sections
-  o IR object file has
-    * IR sections
-    * non-IR sections
-    * The output of "ld -r" with mixed IR/non-IR objects should work with:
-        o Compilers/linkers with IR support.
-	o Compilers/linkers without IR support.
-* Add the mixed object file which has
-  o IR sections
-  o non-IR sections:
-    * Object codes from IR sections.
-    * Object codes from non-IR object files.
-  o Object-only section:
-    * With section name ".gnu_object_only" and SHT_GNU_OBJECT_ONLY type
-    on ELF:
-    https://gitlab.com/x86-psABIs/Linux-ABI
-    #define SHT_GNU_OBJECT_ONLY 0x6ffffff8	/* Object only */
-    * Contain non-IR object file.
-    * Input is discarded after link.
-* Linker action:
-  o Classify each input object file:
-    * If there is a ".gnu_object_only" section, it is a mixed object file.
-    * If there is a IR section, it is an IR object file.
-    * Otherwise, it is a non-IR object file.
-  o Relocatable non-IR link:
-    * Prepare for an object-only output.
-    * Prepare for a regular output.
-    * For each mixed object file:
-      * Add IR and non-IR sections to the regular output.
-      * For object-only section:
-	* Extract object only file.
-	* Add it to the object-only output.
-	* Discard object-only section.
-    * For each IR object file:
-      * Add IR and non-IR sections to the regular output.
-    * For each non-IR object file:
-      * Add non-IR sections to the regular output.
-      * Add non-IR sections to the object-only output.
-    * Final output:
-      * If there are IR objects, non-IR objects and the object-only
-      output isn't empty:
-	* Put the object-only output into the object-only section.
-	* Add the object-only section to the regular output.
-	* Remove the object-only output.
-  o Normal link and relocatable IR link:
-    * Prepare for output.
-    * IR link:
-      * For each mixed object file:
-	* Compile and add IR sections to the output.
-	* Discard non-IR sections.
-	* Object-only section:
-	  * Extract object only file.
-	  * Add it to the output.
-	  * Discard object-only section.
-      * For each IR object file:
-        * Compile and add IR sections to the output.
-	* Discard non-IR sections.
-      * For each non-IR object file:
-	* Add non-IR sections to the output.
-    * Non-IR link:
-      * For each mixed object file:
-	* Add non-IR sections to the output.
-	* Discard IR sections and object-only section.
-      * For each IR object file:
-	* Add non-IR sections to the output.
-	* Discard IR sections.
-      * For each non-IR object file:
-	* Add non-IR sections to the output.
-
-This is useful for Linux kernel build with LTO.
-
-bfd/
-
-	PR ld/12291
-	PR ld/12430
-	PR ld/13298
-	* bfd.c (bfd_lto_object_type): Add lto_mixed_object.
-	(bfd): Add object_only_section.
-	(bfd_group_signature): New.
-	* elf.c (special_sections_g): Add .gnu_object_only.
-	* format.c: Include "plugin-api.h" and "plugin.h" if
-	BFD_SUPPORTS_PLUGINS is defined.
-	(bfd_set_lto_type): Set type to lto_mixed_object for
-	GNU_OBJECT_ONLY_SECTION_NAME section.
-	(bfd_check_format_matches): Don't check the plugin target twice
-	if the plugin target is explicitly specified.
-	* opncls.c (bfd_extract_object_only_section): New.
-	* plugin.c (bfd_plugin_fake_text_section): New.
-	(bfd_plugin_fake_data_section): Likewise.
-	(bfd_plugin_fake_bss_section): Likewise.
-	(bfd_plugin_fake_common_section): Likewise.
-	(bfd_plugin_get_symbols_in_object_only): Likewise.
-	* plugin.c (add_symbols): Call
-	bfd_plugin_get_symbols_in_object_only and count
-	plugin_data->object_only_nsyms.
-	(bfd_plugin_get_symtab_upper_bound): Count
-	plugin_data->object_only_nsyms.
-	bfd_plugin_get_symbols_in_object_only and add symbols from
-	object only section.
-	(bfd_plugin_canonicalize_symtab): Remove fake_section,
-	fake_data_section, fake_bss_section and fake_common_section.
-	Set udata.p to NULL.  Use bfd_plugin_fake_text_section,
-	bfd_plugin_fake_data_section, bfd_plugin_fake_bss_section and
-	bfd_plugin_fake_common_section.
-	Set udata.p to NULL.
-	* plugin.h (plugin_data_struct): Add object_only_nsyms and
-	object_only_syms.
-	* section.c (GNU_OBJECT_ONLY_SECTION_NAME): New.
-	* bfd-in2.h: Regenerated.
-
-binutils/
-
-	PR ld/12291
-	PR ld/12430
-	PR ld/13298
-	* objcopy.c (group_signature): Removed.
-	(is_strip_section): Replace group_signature with
-	bfd_group_signature.
-	(setup_section): Likewise.
-	* readelf.c (get_os_specific_section_type_name): Handle
-	SHT_GNU_OBJECT_ONLY.
-
-gas/
-
-	PR ld/12291
-	PR ld/12430
-	PR ld/13298
-	* testsuite/gas/elf/section9.s: Add the .gnu_object_only test.
-	* testsuite/gas/elf/section9.d: Updated.
-
-include/
-
-	PR ld/12291
-	PR ld/12430
-	PR ld/13298
-	* elf/common.h (SHT_GNU_OBJECT_ONLY): New.
-
-ld/
-
-	PR ld/12291
-	PR ld/12430
-	PR ld/13298
-	* ld.h (ld_config_type): Add emit_gnu_object_only and
-	emitting_gnu_object_only.
-	* ldelf.c (orphan_init_done): Make it file scope.
-	(ldelf_place_orphan): Rename hold to orig_hold.  Initialize hold
-	from orig_hold at run-time.
-	(ldelf_finish): New.
-	* ldelf.h (ldelf_finish): New.
-	* ldexp.c (ldexp_init): Take a bfd_boolean argument to supprt
-	object-only output.
-	(ldexp_finish): Likewise.
-	* ldexp.h (ldexp_init): Take a bfd_boolean argument.
-	(ldexp_finish): Likewise.
-	* ldfile.c (ldfile_try_open_bfd): Call
-	cmdline_check_object_only_section.
-	* ldlang.c: Include "ldwrite.h" and elf-bfd.h.
-	* ldlang.c (cmdline_object_only_file_list): New.
-	(cmdline_object_only_archive_list): Likewise.
-	(cmdline_temp_object_only_list): Likewise.
-	(cmdline_lists_init): Likewise.
-	(cmdline_list_new): Likewise.
-	(cmdline_list_append): Likewise.
-	(print_cmdline_list): Likewise.
-	(cmdline_on_object_only_archive_list_p): Likewise.
-	(cmdline_object_only_list_append): Likewise.
-	(cmdline_get_object_only_input_files): Likewise.
-	(cmdline_arg): Likewise.
-	(setup_section): Likewise.
-	(copy_section): Likewise.
-	(cmdline_fopen_temp): Likewise.
-	(cmdline_add_object_only_section): Likewise.
-	(cmdline_emit_object_only_section): Likewise.
-	(cmdline_extract_object_only_section): Likewise.
-	(cmdline_check_object_only_section): Likewise.
-	(cmdline_remove_object_only_files): Likewise.
-	(lang_init): Take a bfd_boolean argument to supprt object-only
-	output.  Call cmdline_lists_init.
-	(load_symbols): Call cmdline_on_object_only_archive_list_p
-	to check if an archive member should be loaded.
-	(lang_process): Handle object-only link.
-	* ldlang.h (lang_init): Take a bfd_boolean argument.
-	(cmdline_enum_type): New.
-	(cmdline_header_type): Likewise.
-	(cmdline_file_type): Likewise.
-	(cmdline_bfd_type): Likewise.
-	(cmdline_union_type): Likewise.
-	(cmdline_list_type): Likewise.
-	(cmdline_emit_object_only_section): Likewise.
-	(cmdline_check_object_only_section): Likewise.
-	(cmdline_remove_object_only_files): Likewise.
-	* ldmain.c (main): Call xatexit with
-	cmdline_remove_object_only_files.  Pass FALSE to lang_init,
-	ldexp_init and ldexp_finish.  Use ld_parse_linker_script.
-	Set link_info.output_bfd to NULL after close.  Call
-	cmdline_emit_object_only_section if needed.
-	(add_archive_element): Call cmdline_check_object_only_section.
-	(ld_parse_linker_script): New.
-	* ldmain.h (ld_parse_linker_script): New.
-	* plugin.c (plugin_maybe_claim): Call
-	cmdline_check_object_only_section on claimed IR files.
-	* scripttempl/elf.sc: Also discard .gnu_object_only sections.
-	* scripttempl/elf64hppa.sc: Likewise.
-	* scripttempl/elfxtensa.sc: Likewise.
-	* scripttempl/mep.sc: Likewise.
-	* scripttempl/pe.sc: Likewise.
-	* scripttempl/pep.sc: Likewise.
-	* emultempl/aarch64elf.em (gld${EMULATION_NAME}_finish): Replace
-	finish_default with ldelf_finish.
-	* emultempl/alphaelf.em (alpha_finish): Likewise.
-	* emultempl/avrelf.em (avr_finish): Likewise.
-	* emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise.
-	* emultempl/ppc32elf.em (ppc_finish): Likewise.
-	* emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Likewise.
-	* emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Likewise.
-	* testsuite/ld-plugin/lto-10.out: New file.
-	* testsuite/ld-plugin/lto-10a.c: Likewise.
-	* testsuite/ld-plugin/lto-10b.c: Likewise.
-	* testsuite/ld-plugin/lto-10r.d: Likewise.
-	* testsuite/ld-plugin/lto-4.out: Likewise.
-	* testsuite/ld-plugin/lto-4a.c: Likewise.
-	* testsuite/ld-plugin/lto-4b.c: Likewise.
-	* testsuite/ld-plugin/lto-4c.c: Likewise.
-	* testsuite/ld-plugin/lto-4r-a.d: Likewise.
-	* testsuite/ld-plugin/lto-4r-b.d: Likewise.
-	* testsuite/ld-plugin/lto-4r-c.d: Likewise.
-	* testsuite/ld-plugin/lto-4r-d.d: Likewise.
-	* testsuite/ld-plugin/lto.exp (lto_link_tests): Prepare for
-	"LTO 4[acd]", "lto-4r-[abcd]" and "LTO 10" tests.
-	(lto_run_tests): Add "LTO 4[acd]" and "LTO 10" tests.
-	Build liblto-4.a.  Run "lto-4r-[abcd]" tests.
-	Run lto-10r and create tmpdir/lto-10.o.
-	Add test for nm on mixed LTO/non-LTO object.
-
-Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
----
- bfd/bfd-in2.h                     |   16 +-
- bfd/bfd.c                         |   46 +-
- bfd/elf.c                         |    1 +
- bfd/format.c                      |   37 +-
- bfd/opncls.c                      |   66 ++
- bfd/plugin.c                      |  193 +++++-
- bfd/plugin.h                      |    2 +
- bfd/section.c                     |    3 +
- binutils/objcopy.c                |   32 +-
- binutils/readelf.c                |    1 +
- gas/testsuite/gas/elf/section9.d  |    1 +
- gas/testsuite/gas/elf/section9.s  |    2 +
- include/elf/common.h              |    1 +
- ld/emultempl/aarch64elf.em        |    2 +-
- ld/emultempl/alphaelf.em          |    2 +-
- ld/emultempl/armelf.em            |    2 +-
- ld/emultempl/avrelf.em            |    2 +-
- ld/emultempl/elf.em               |    1 +
- ld/emultempl/ppc32elf.em          |    2 +-
- ld/emultempl/ppc64elf.em          |    2 +-
- ld/emultempl/spuelf.em            |    2 +-
- ld/ld.h                           |    6 +
- ld/ldelf.c                        |   26 +-
- ld/ldelf.h                        |    1 +
- ld/ldexp.c                        |   16 +-
- ld/ldexp.h                        |    4 +-
- ld/ldfile.c                       |    2 +
- ld/ldlang.c                       | 1027 ++++++++++++++++++++++++++++-
- ld/ldlang.h                       |   44 +-
- ld/ldmain.c                       |   80 ++-
- ld/ldmain.h                       |    2 +
- ld/plugin.c                       |    3 +
- ld/scripttempl/elf.sc             |    2 +-
- ld/scripttempl/elf64hppa.sc       |    2 +-
- ld/scripttempl/elfxtensa.sc       |    2 +-
- ld/scripttempl/mep.sc             |    2 +-
- ld/scripttempl/pe.sc              |    1 +
- ld/scripttempl/pep.sc             |    1 +
- ld/testsuite/ld-plugin/lto-10.out |    1 +
- ld/testsuite/ld-plugin/lto-10a.c  |    6 +
- ld/testsuite/ld-plugin/lto-10b.c  |    7 +
- ld/testsuite/ld-plugin/lto-10r.d  |    9 +
- ld/testsuite/ld-plugin/lto-4.out  |    2 +
- ld/testsuite/ld-plugin/lto-4a.c   |    7 +
- ld/testsuite/ld-plugin/lto-4b.c   |    9 +
- ld/testsuite/ld-plugin/lto-4c.c   |    6 +
- ld/testsuite/ld-plugin/lto-4r-a.d |    7 +
- ld/testsuite/ld-plugin/lto-4r-b.d |    7 +
- ld/testsuite/ld-plugin/lto-4r-c.d |    7 +
- ld/testsuite/ld-plugin/lto-4r-d.d |    7 +
- ld/testsuite/ld-plugin/lto.exp    |   66 ++
- 51 files changed, 1653 insertions(+), 125 deletions(-)
- create mode 100644 ld/testsuite/ld-plugin/lto-10.out
- create mode 100644 ld/testsuite/ld-plugin/lto-10a.c
- create mode 100644 ld/testsuite/ld-plugin/lto-10b.c
- create mode 100644 ld/testsuite/ld-plugin/lto-10r.d
- create mode 100644 ld/testsuite/ld-plugin/lto-4.out
- create mode 100644 ld/testsuite/ld-plugin/lto-4a.c
- create mode 100644 ld/testsuite/ld-plugin/lto-4b.c
- create mode 100644 ld/testsuite/ld-plugin/lto-4c.c
- create mode 100644 ld/testsuite/ld-plugin/lto-4r-a.d
- create mode 100644 ld/testsuite/ld-plugin/lto-4r-b.d
- create mode 100644 ld/testsuite/ld-plugin/lto-4r-c.d
- create mode 100644 ld/testsuite/ld-plugin/lto-4r-d.d
-
-diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
-index 3a5a6dd8a5f..1b82b6bcc99 100644
---- a/bfd/bfd-in2.h
-+++ b/bfd/bfd-in2.h
-@@ -925,6 +925,9 @@ extern asection _bfd_std_section[4];
- #define BFD_COM_SECTION_NAME "*COM*"
- #define BFD_IND_SECTION_NAME "*IND*"
- 
-+/* GNU object-only section name.  */
-+#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
-+
- /* Pointer to the common section.  */
- #define bfd_com_section_ptr (&_bfd_std_section[0])
- /* Pointer to the undefined section.  */
-@@ -1962,7 +1965,8 @@ enum bfd_lto_object_type
-     lto_non_object,            /* Not an LTO object.  */
-     lto_non_ir_object,         /* An object without LTO IR.  */
-     lto_slim_ir_object,        /* A slim LTO IR object.  */
--    lto_fat_ir_object          /* A fat LTO IR object.  */
-+    lto_fat_ir_object,         /* A fat LTO IR object.  */
-+    lto_mixed_object           /* A mixed LTO IR object.  */
-   };
- 
- struct bfd_mmapped_entry
-@@ -2185,7 +2189,7 @@ struct bfd
-   unsigned int read_only : 1;
- 
-   /* LTO object type.  */
--  ENUM_BITFIELD (bfd_lto_object_type) lto_type : 2;
-+  ENUM_BITFIELD (bfd_lto_object_type) lto_type : 3;
- 
-   /* Set if this BFD is currently being processed by
-      bfd_check_format_matches.  This is checked by the cache to
-@@ -2217,6 +2221,9 @@ struct bfd
-   /* The last section on the section list.  */
-   struct bfd_section *section_last;
- 
-+  /* The object-only section on the section list.  */
-+  struct bfd_section *object_only_section;
-+
-   /* The number of sections.  */
-   unsigned int section_count;
- 
-@@ -2790,6 +2797,8 @@ bfd_vma bfd_emul_get_commonpagesize (const char *);
- 
- char *bfd_demangle (bfd *, const char *, int);
- 
-+asymbol *bfd_group_signature (asection *group, asymbol **isympp);
-+
- /* Extracted from bfdio.c.  */
- bfd_size_type bfd_read (void *, bfd_size_type, bfd *)
- ATTRIBUTE_WARN_UNUSED_RESULT;
-@@ -3073,6 +3082,9 @@ char *bfd_follow_build_id_debuglink (bfd *abfd, const char *dir);
- 
- const char *bfd_set_filename (bfd *abfd, const char *filename);
- 
-+const char *bfd_extract_object_only_section
-+   (bfd *abfd);
-+
- /* Extracted from reloc.c.  */
- typedef enum bfd_reloc_status
- {
-diff --git a/bfd/bfd.c b/bfd/bfd.c
-index 194f24179fd..a8d1314b83f 100644
---- a/bfd/bfd.c
-+++ b/bfd/bfd.c
-@@ -80,7 +80,8 @@ EXTERNAL
- .    lto_non_object,		{* Not an LTO object.  *}
- .    lto_non_ir_object,		{* An object without LTO IR.  *}
- .    lto_slim_ir_object,	{* A slim LTO IR object.  *}
--.    lto_fat_ir_object		{* A fat LTO IR object.  *}
-+.    lto_fat_ir_object,		{* A fat LTO IR object.  *}
-+.    lto_mixed_object		{* A mixed LTO IR object.  *}
- .  };
- .
- .struct bfd_mmapped_entry
-@@ -306,7 +307,7 @@ CODE_FRAGMENT
- .  unsigned int read_only : 1;
- .
- .  {* LTO object type.  *}
--.  ENUM_BITFIELD (bfd_lto_object_type) lto_type : 2;
-+.  ENUM_BITFIELD (bfd_lto_object_type) lto_type : 3;
- .
- .  {* Set if this BFD is currently being processed by
- .     bfd_check_format_matches.  This is checked by the cache to
-@@ -338,6 +339,9 @@ CODE_FRAGMENT
- .  {* The last section on the section list.  *}
- .  struct bfd_section *section_last;
- .
-+.  {* The object-only section on the section list.  *}
-+.  struct bfd_section *object_only_section;
-+.
- .  {* The number of sections.  *}
- .  unsigned int section_count;
- .
-@@ -3034,3 +3038,41 @@ _bfd_get_link_info (bfd *abfd)
- 
-   return elf_link_info (abfd);
- }
-+
-+/*
-+FUNCTION
-+	bfd_group_signature
-+
-+SYNOPSIS
-+	asymbol *bfd_group_signature (asection *group, asymbol **isympp);
-+
-+DESCRIPTION
-+	Return a pointer to the symbol used as a signature for GROUP.
-+*/
-+
-+asymbol *
-+bfd_group_signature (asection *group, asymbol **isympp)
-+{
-+  bfd *abfd = group->owner;
-+  Elf_Internal_Shdr *ghdr;
-+
-+  /* PR 20089: An earlier error may have prevented us from loading the
-+     symbol table.  */
-+  if (isympp == NULL)
-+    return NULL;
-+
-+  if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
-+    return NULL;
-+
-+  ghdr = &elf_section_data (group)->this_hdr;
-+  if (ghdr->sh_link == elf_onesymtab (abfd))
-+    {
-+      const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-+      Elf_Internal_Shdr *symhdr = &elf_symtab_hdr (abfd);
-+
-+      if (ghdr->sh_info > 0
-+	  && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
-+	return isympp[ghdr->sh_info - 1];
-+    }
-+  return NULL;
-+}
-diff --git a/bfd/elf.c b/bfd/elf.c
-index 218d58df8be..30bbdc662af 100644
---- a/bfd/elf.c
-+++ b/bfd/elf.c
-@@ -3014,6 +3014,7 @@ static const struct bfd_elf_special_section special_sections_g[] =
-   { STRING_COMMA_LEN (".gnu.linkonce.p"), -2, SHT_PROGBITS,    SHF_ALLOC + SHF_WRITE },
-   { STRING_COMMA_LEN (".gnu.lto_"),	  -1, SHT_PROGBITS,    SHF_EXCLUDE },
-   { STRING_COMMA_LEN (".got"),		   0, SHT_PROGBITS,    SHF_ALLOC + SHF_WRITE },
-+  { STRING_COMMA_LEN (".gnu_object_only"), 0, SHT_GNU_OBJECT_ONLY, SHF_EXCLUDE },
-   { STRING_COMMA_LEN (".gnu.version"),	   0, SHT_GNU_versym,  0 },
-   { STRING_COMMA_LEN (".gnu.version_d"),   0, SHT_GNU_verdef,  0 },
-   { STRING_COMMA_LEN (".gnu.version_r"),   0, SHT_GNU_verneed, 0 },
-diff --git a/bfd/format.c b/bfd/format.c
-index 125815935f6..7769ad095f6 100644
---- a/bfd/format.c
-+++ b/bfd/format.c
-@@ -46,6 +46,10 @@ SUBSECTION
- #include "sysdep.h"
- #include "bfd.h"
- #include "libbfd.h"
-+#if BFD_SUPPORTS_PLUGINS
-+#include "plugin-api.h"
-+#include "plugin.h"
-+#endif
- 
- /* IMPORT from targets.c.  */
- extern const size_t _bfd_target_vector_entries;
-@@ -349,23 +353,32 @@ bfd_set_lto_type (bfd *abfd ATTRIBUTE_UNUSED)
- #if BFD_SUPPORTS_PLUGINS
-   if (abfd->format == bfd_object
-       && abfd->lto_type == lto_non_object
--      && (abfd->flags & (DYNAMIC | EXEC_P)) == 0)
-+      && (abfd->flags
-+	  & (DYNAMIC
-+	     | (bfd_get_flavour (abfd) == bfd_target_elf_flavour
-+		? EXEC_P : 0))) == 0)
-     {
-       asection *sec;
-       enum bfd_lto_object_type type = lto_non_ir_object;
--      struct lto_section lsection;
-+      struct lto_section lsection = { 0, 0, 0, 0 };
-       /* GCC uses .gnu.lto_.lto.<some_hash> as a LTO bytecode information
- 	 section.  */
-       for (sec = abfd->sections; sec != NULL; sec = sec->next)
--	if (startswith (sec->name, ".gnu.lto_.lto.")
--	    && bfd_get_section_contents (abfd, sec, &lsection, 0,
--					 sizeof (struct lto_section)))
-+	if (strcmp (sec->name, GNU_OBJECT_ONLY_SECTION_NAME) == 0)
-+	  {
-+	    type = lto_mixed_object;
-+	    abfd->object_only_section = sec;
-+	    break;
-+	  }
-+	else if (lsection.major_version == 0
-+		 && startswith (sec->name, ".gnu.lto_.lto.")
-+		 && bfd_get_section_contents (abfd, sec, &lsection, 0,
-+					      sizeof (struct lto_section)))
- 	  {
- 	    if (lsection.slim_object)
- 	      type = lto_slim_ir_object;
- 	    else
- 	      type = lto_fat_ir_object;
--	    break;
- 	  }
- 
-       abfd->lto_type = type;
-@@ -397,9 +410,6 @@ bool
- bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
- {
-   extern const bfd_target binary_vec;
--#if BFD_SUPPORTS_PLUGINS
--  extern const bfd_target plugin_vec;
--#endif
-   const bfd_target * const *target;
-   const bfd_target **matching_vector = NULL;
-   const bfd_target *save_targ, *right_targ, *ar_right_targ, *match_targ;
-@@ -507,11 +517,18 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
- 	 check the default target twice.  */
-       if (*target == &binary_vec
- #if BFD_SUPPORTS_PLUGINS
--	  || (match_count != 0 && *target == &plugin_vec)
-+	  || (match_count != 0 && bfd_plugin_target_p (*target))
- #endif
- 	  || (!abfd->target_defaulted && *target == save_targ))
- 	continue;
- 
-+#if BFD_SUPPORTS_PLUGINS
-+      /* If the plugin target is explicitly specified when a BFD file
-+	 is opened, don't check it twice.  */
-+      if (bfd_plugin_specified_p () && bfd_plugin_target_p (*target))
-+	continue;
-+#endif
-+
-       /* If we already tried a match, the bfd is modified and may
- 	 have sections attached, which will confuse the next
- 	 _bfd_check_format call.  */
-diff --git a/bfd/opncls.c b/bfd/opncls.c
-index 93adbf117f0..ca7dbf23aa6 100644
---- a/bfd/opncls.c
-+++ b/bfd/opncls.c
-@@ -2054,3 +2054,69 @@ bfd_set_filename (bfd *abfd, const char *filename)
- 
-   return n;
- }
-+
-+/*
-+FUNCTION
-+	bfd_extract_object_only_section
-+
-+SYNOPSIS
-+	const char *bfd_extract_object_only_section
-+	  (bfd *abfd);
-+
-+DESCRIPTION
-+
-+	Takes a @var{ABFD} and extract the .gnu_object_only section into
-+	a temporary file.
-+
-+RETURNS
-+	The name of the temporary file is returned if all is ok.
-+	Otherwise <<NULL>> is returned and bfd_error is set.
-+*/
-+
-+const char *
-+bfd_extract_object_only_section (bfd *abfd)
-+{
-+  asection *sec = abfd->object_only_section;
-+  const char *name;
-+  FILE *file;
-+  bfd_byte *memhunk = NULL;
-+  size_t off, size;
-+  bfd_error_type err;
-+
-+  /* Get a temporary object-only file.  */
-+  name = make_temp_file (".obj-only.o");
-+
-+  /* Open the object-only file.  */
-+  file = _bfd_real_fopen (name, FOPEN_WB);
-+  if (!bfd_get_full_section_contents (abfd, sec, &memhunk))
-+    {
-+      err = bfd_get_error ();
-+
-+loser:
-+      free (memhunk);
-+      fclose (file);
-+      unlink (name);
-+      bfd_set_error (err);
-+      return NULL;
-+    }
-+
-+  off = 0;
-+  size = sec->size;
-+  while (off != size)
-+    {
-+      size_t written, nwrite = size - off;
-+
-+      written = fwrite (memhunk + off, 1, nwrite, file);
-+      if (written < nwrite && ferror (file))
-+	{
-+	  err = bfd_error_system_call;
-+	  goto loser;
-+	}
-+
-+      off += written;
-+    }
-+
-+  free (memhunk);
-+  fclose (file);
-+  return name;
-+}
-diff --git a/bfd/plugin.c b/bfd/plugin.c
-index 67454adffb9..d57ae593e78 100644
---- a/bfd/plugin.c
-+++ b/bfd/plugin.c
-@@ -160,6 +160,158 @@ register_claim_file (ld_plugin_claim_file_handler handler)
-   return LDPS_OK;
- }
- 
-+static asection bfd_plugin_fake_text_section
-+  = BFD_FAKE_SECTION (bfd_plugin_fake_text_section, NULL, "plug", 0,
-+		      SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS);
-+static asection bfd_plugin_fake_data_section
-+  = BFD_FAKE_SECTION (bfd_plugin_fake_data_section, NULL, "plug", 0,
-+		      SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS);
-+static asection bfd_plugin_fake_bss_section
-+  = BFD_FAKE_SECTION (bfd_plugin_fake_bss_section, NULL, "plug", 0,
-+		      SEC_ALLOC);
-+static asection bfd_plugin_fake_common_section
-+  = BFD_FAKE_SECTION (bfd_plugin_fake_common_section, NULL, NULL,
-+		      0, SEC_IS_COMMON);
-+
-+/* Get symbols from object only section.  */
-+
-+static void
-+bfd_plugin_get_symbols_in_object_only (bfd *abfd)
-+{
-+  struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
-+  const char *object_only_file;
-+  bfd *nbfd;
-+  long storage;
-+  long object_only_nsyms, added_nsyms, i;
-+  asymbol **object_only_syms, **added_syms;
-+
-+  plugin_data->object_only_syms = NULL;
-+  plugin_data->object_only_nsyms = 0;
-+
-+  if (abfd->sections == NULL && abfd->my_archive == NULL)
-+    {
-+      nbfd = bfd_openr (abfd->filename, NULL);
-+      if (nbfd == NULL)
-+	{
-+	  (*_bfd_error_handler)
-+	    (_("%s: failed to open to extract object only section: %s"),
-+	     abfd->filename, bfd_errmsg (bfd_get_error ()));
-+	  return;
-+	}
-+      else if (!bfd_check_format (nbfd, bfd_object))
-+	{
-+	  /* There is no object only section if it isn't a bfd_object
-+	     file.  */
-+	  bfd_close (nbfd);
-+	  return;
-+	}
-+    }
-+  else
-+    {
-+      if (!bfd_check_format (abfd, bfd_object))
-+	{
-+	  (*_bfd_error_handler)
-+	    (_("%pB: invalid file to extract object only section: %s"),
-+	     abfd, bfd_errmsg (bfd_get_error ()));
-+	  return;
-+	}
-+      nbfd = abfd;
-+    }
-+
-+  if (nbfd->lto_type == lto_mixed_object
-+      && (nbfd->flags & HAS_SYMS) != 0)
-+    {
-+      object_only_file = bfd_extract_object_only_section (nbfd);
-+      if (object_only_file == NULL)
-+	(*_bfd_error_handler)
-+	  (_("%pB: failed to extract object only section: %s"),
-+	   abfd, bfd_errmsg (bfd_get_error ()));
-+    }
-+  else
-+    object_only_file = NULL;
-+
-+  /* Close the new bfd we just opened.  */
-+  if (nbfd != abfd)
-+    bfd_close (nbfd);
-+
-+  /* Return if there is no object only section or there is no
-+     symbol in object only section.  */
-+  if (!object_only_file)
-+    return;
-+
-+  /* Open the file containing object only section.  */
-+  nbfd = bfd_openr (object_only_file, NULL);
-+  if (!bfd_check_format (nbfd, bfd_object))
-+    {
-+      (*_bfd_error_handler)
-+	(_("%pB: failed to open object only section: %s"),
-+	 abfd, bfd_errmsg (bfd_get_error ()));
-+      goto quit;
-+    }
-+
-+  storage = bfd_get_symtab_upper_bound (nbfd);
-+  if (storage <= 0)
-+    {
-+      if (storage < 0)
-+	(*_bfd_error_handler)
-+	  (_("%pB: failed to get symbol table in object only section: %s"),
-+	   abfd, bfd_errmsg (bfd_get_error ()));
-+
-+      goto quit;
-+    }
-+
-+  object_only_syms = (asymbol **) bfd_malloc (storage);
-+  object_only_nsyms = bfd_canonicalize_symtab (nbfd, object_only_syms);
-+
-+  /* FIXME: We waste some spaces if not all symbols are copied.  */
-+  added_syms = (asymbol **) bfd_alloc (abfd, storage);
-+  added_nsyms = 0;
-+
-+  /* Copy only global symbols from object only section.  */
-+  for (i = 0; i < object_only_nsyms; i++)
-+    {
-+      asection *sec = object_only_syms[i]->section;
-+      flagword flags = object_only_syms[i]->flags;
-+      asymbol *s;
-+
-+      if (bfd_is_com_section (sec))
-+	sec = &bfd_plugin_fake_common_section;
-+      else if (bfd_is_und_section (sec))
-+	;
-+      else if ((flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0)
-+	{
-+	  if ((sec->flags & SEC_CODE) != 0)
-+	    sec = &bfd_plugin_fake_text_section;
-+	  else if ((sec->flags & SEC_LOAD) != 0)
-+	    sec = &bfd_plugin_fake_data_section;
-+	  else
-+	    sec = &bfd_plugin_fake_bss_section;
-+	}
-+      else
-+	continue;
-+
-+      s = bfd_alloc (abfd, sizeof (asymbol));
-+      BFD_ASSERT (s);
-+      added_syms[added_nsyms++] = s;
-+
-+      s->section = sec;
-+      s->the_bfd = abfd;
-+      s->name = xstrdup (object_only_syms[i]->name);
-+      s->value = 0;
-+      s->flags = flags;
-+      s->udata.p = NULL;
-+    }
-+
-+  plugin_data->object_only_syms = added_syms;
-+  plugin_data->object_only_nsyms = added_nsyms;
-+
-+  free (object_only_syms);
-+
-+quit:
-+  /* Close and remove the object only section file.  */
-+  bfd_close (nbfd);
-+  unlink (object_only_file);
-+}
- 
- /* Register a claim-file handler, version 2. */
- 
-@@ -185,10 +337,13 @@ add_symbols (void * handle,
-   plugin_data->nsyms = nsyms;
-   plugin_data->syms = syms;
- 
--  if (nsyms != 0)
-+  abfd->tdata.plugin_data = plugin_data;
-+
-+  bfd_plugin_get_symbols_in_object_only (abfd);
-+
-+  if ((nsyms + plugin_data->object_only_nsyms) != 0)
-     abfd->flags |= HAS_SYMS;
- 
--  abfd->tdata.plugin_data = plugin_data;
-   return LDPS_OK;
- }
- 
-@@ -678,7 +833,8 @@ static long
- bfd_plugin_get_symtab_upper_bound (bfd *abfd)
- {
-   struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
--  long nsyms = plugin_data->nsyms;
-+  /* Add symbols from object only section.  */
-+  long nsyms = plugin_data->nsyms + plugin_data->object_only_nsyms;
- 
-   BFD_ASSERT (nsyms >= 0);
- 
-@@ -712,18 +868,7 @@ bfd_plugin_canonicalize_symtab (bfd *abfd,
-   struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
-   long nsyms = plugin_data->nsyms;
-   const struct ld_plugin_symbol *syms = plugin_data->syms;
--  static asection fake_text_section
--    = BFD_FAKE_SECTION (fake_text_section, NULL, "plug", 0,
--			SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS);
--  static asection fake_data_section
--    = BFD_FAKE_SECTION (fake_data_section, NULL, "plug", 0,
--			SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS);
--  static asection fake_bss_section
--    = BFD_FAKE_SECTION (fake_bss_section, NULL, "plug", 0,
--			SEC_ALLOC);
--  static asection fake_common_section
--    = BFD_FAKE_SECTION (fake_common_section, NULL, "plug", 0, SEC_IS_COMMON);
--  int i;
-+  int i, j;
- 
-   for (i = 0; i < nsyms; i++)
-     {
-@@ -736,10 +881,11 @@ bfd_plugin_canonicalize_symtab (bfd *abfd,
-       s->name = syms[i].name;
-       s->value = 0;
-       s->flags = convert_flags (&syms[i]);
-+      s->udata.p = NULL;
-       switch (syms[i].def)
- 	{
- 	case LDPK_COMMON:
--	  s->section = &fake_common_section;
-+	  s->section = &bfd_plugin_fake_common_section;
- 	  break;
- 	case LDPK_UNDEF:
- 	case LDPK_WEAKUNDEF:
-@@ -755,25 +901,28 @@ bfd_plugin_canonicalize_symtab (bfd *abfd,
- 	      case LDST_UNKNOWN:
- 		/* What is the best fake section for LDST_UNKNOWN?  */
- 	      case LDST_FUNCTION:
--		s->section = &fake_text_section;
-+		s->section = &bfd_plugin_fake_text_section;
- 		break;
- 	      case LDST_VARIABLE:
- 		if (syms[i].section_kind == LDSSK_BSS)
--		  s->section = &fake_bss_section;
-+		  s->section = &bfd_plugin_fake_bss_section;
- 		else
--		  s->section = &fake_data_section;
-+		  s->section = &bfd_plugin_fake_data_section;
- 		break;
- 	      }
- 	  else
--	    s->section = &fake_text_section;
-+	    s->section = &bfd_plugin_fake_text_section;
- 	  break;
- 	default:
- 	  BFD_ASSERT (0);
- 	}
--
--      s->udata.p = (void *) &syms[i];
-     }
- 
-+  /* Copy symbols from object only section.  */
-+  nsyms += plugin_data->object_only_nsyms;
-+  for (j = 0; j < plugin_data->object_only_nsyms; j++, i++)
-+    alocation[i] = plugin_data->object_only_syms[j];
-+
-   return nsyms;
- }
- 
-diff --git a/bfd/plugin.h b/bfd/plugin.h
-index 510689c96ba..f61e6168e2b 100644
---- a/bfd/plugin.h
-+++ b/bfd/plugin.h
-@@ -34,6 +34,8 @@ typedef struct plugin_data_struct
- {
-   int nsyms;
-   const struct ld_plugin_symbol *syms;
-+  int object_only_nsyms;
-+  asymbol **object_only_syms;
- }
- plugin_data_struct;
- 
-diff --git a/bfd/section.c b/bfd/section.c
-index 8456c73e8d0..e7674c9dc1a 100644
---- a/bfd/section.c
-+++ b/bfd/section.c
-@@ -661,6 +661,9 @@ EXTERNAL
- .#define BFD_COM_SECTION_NAME "*COM*"
- .#define BFD_IND_SECTION_NAME "*IND*"
- .
-+.{* GNU object-only section name.  *}
-+.#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
-+.
- .{* Pointer to the common section.  *}
- .#define bfd_com_section_ptr (&_bfd_std_section[0])
- .{* Pointer to the undefined section.  *}
-diff --git a/binutils/objcopy.c b/binutils/objcopy.c
-index f64417697cb..e2e6bd7ee83 100644
---- a/binutils/objcopy.c
-+++ b/binutils/objcopy.c
-@@ -1266,34 +1266,6 @@ is_specified_symbol (const char *name, htab_t htab)
-   return htab_find (htab, name) != NULL;
- }
- 
--/* Return a pointer to the symbol used as a signature for GROUP.  */
--
--static asymbol *
--group_signature (asection *group)
--{
--  bfd *abfd = group->owner;
--  Elf_Internal_Shdr *ghdr;
--
--  /* PR 20089: An earlier error may have prevented us from loading the symbol table.  */
--  if (isympp == NULL)
--    return NULL;
--
--  if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
--    return NULL;
--
--  ghdr = &elf_section_data (group)->this_hdr;
--  if (ghdr->sh_link == elf_onesymtab (abfd))
--    {
--      const struct elf_backend_data *bed = get_elf_backend_data (abfd);
--      Elf_Internal_Shdr *symhdr = &elf_symtab_hdr (abfd);
--
--      if (ghdr->sh_info > 0
--	  && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
--	return isympp[ghdr->sh_info - 1];
--    }
--  return NULL;
--}
--
- /* Return TRUE if the section is a DWO section.  */
- 
- static bool
-@@ -1438,7 +1410,7 @@ is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
-       const char *gname;
-       asection *elt, *first;
- 
--      gsym = group_signature (sec);
-+      gsym = bfd_group_signature (sec, isympp);
-       /* Strip groups without a valid signature.  */
-       if (gsym == NULL)
- 	return true;
-@@ -4398,7 +4370,7 @@ setup_section (bfd *ibfd, sec_ptr isection, bfd *obfd)
- 
-   if ((isection->flags & SEC_GROUP) != 0)
-     {
--      asymbol *gsym = group_signature (isection);
-+      asymbol *gsym = bfd_group_signature (isection, isympp);
- 
-       if (gsym != NULL)
- 	{
-diff --git a/binutils/readelf.c b/binutils/readelf.c
-index 4f8f879cf91..949395483bb 100644
---- a/binutils/readelf.c
-+++ b/binutils/readelf.c
-@@ -5941,6 +5941,7 @@ get_os_specific_section_type_name (Filedata * filedata, unsigned int sh_type)
-     case SHT_GNU_ATTRIBUTES:          return "GNU_ATTRIBUTES";
-     case SHT_GNU_HASH:                return "GNU_HASH";
-     case SHT_GNU_LIBLIST:             return "GNU_LIBLIST";
-+    case SHT_GNU_OBJECT_ONLY:	      return "GNU_OBJECT_ONLY";
- 
-     case SHT_SUNW_move:               return "SUNW_MOVE";
-     case SHT_SUNW_COMDAT:             return "SUNW_COMDAT";
-diff --git a/gas/testsuite/gas/elf/section9.d b/gas/testsuite/gas/elf/section9.d
-index 63152fe4b4d..d7e97c014ac 100644
---- a/gas/testsuite/gas/elf/section9.d
-+++ b/gas/testsuite/gas/elf/section9.d
-@@ -4,4 +4,5 @@
- #...
- [ 	]*\[.*\][ 	]+\.gnu\.lto_main[ 	]+PROGBITS.*[ 	]+E[   ]+.*
- [ 	]*\[.*\][ 	]+\.gnu\.lto_\.pureconst[ 	]+PROGBITS.*[ 	]+E[   ]+.*
-+[ 	]*\[.*\][ 	]+\.gnu_object_only[ 	]+GNU_OBJECT_ONLY.*[ 	]+E[   ]+.*
- #pass
-diff --git a/gas/testsuite/gas/elf/section9.s b/gas/testsuite/gas/elf/section9.s
-index 6b8b1074ca3..abcdea10aad 100644
---- a/gas/testsuite/gas/elf/section9.s
-+++ b/gas/testsuite/gas/elf/section9.s
-@@ -2,3 +2,5 @@
- 	.byte 0,0,0,0
- 	.section .gnu.lto_.pureconst,"",%progbits
- 	.byte 0,0,0,0
-+	.section .gnu_object_only
-+	.byte 0,0,0,0
-diff --git a/include/elf/common.h b/include/elf/common.h
-index 6077db7a8b7..b0b54d87ab4 100644
---- a/include/elf/common.h
-+++ b/include/elf/common.h
-@@ -572,6 +572,7 @@
- #define SHT_GNU_HASH	             0x6ffffff6	/* GNU style symbol hash table */
- #define SHT_GNU_LIBLIST	             0x6ffffff7	/* List of prelink dependencies */
- #define SHT_CHECKSUM	             0x6ffffff8	/* Checksum for DSO content.  */
-+#define SHT_GNU_OBJECT_ONLY	     0x6ffffff9	/* Object only */
- 
- #define SHT_SUNW_move	             0x6ffffffa
- #define SHT_SUNW_COMDAT              0x6ffffffb
-diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
-index faa0d3ecd79..ae79961ada1 100644
---- a/ld/emultempl/aarch64elf.em
-+++ b/ld/emultempl/aarch64elf.em
-@@ -309,7 +309,7 @@ gld${EMULATION_NAME}_finish (void)
- 	}
-     }
- 
--  finish_default ();
-+  ldelf_finish ();
- }
- 
- /* This is a convenient point to tell BFD about target specific flags.
-diff --git a/ld/emultempl/alphaelf.em b/ld/emultempl/alphaelf.em
-index 6ecacb76a10..5ae2587a653 100644
---- a/ld/emultempl/alphaelf.em
-+++ b/ld/emultempl/alphaelf.em
-@@ -104,7 +104,7 @@ alpha_finish (void)
-   if (limit_32bit)
-     elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT;
- 
--  finish_default ();
-+  ldelf_finish ();
- }
- EOF
- 
-diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
-index dc2cd9f1139..02a97e7c1ff 100644
---- a/ld/emultempl/armelf.em
-+++ b/ld/emultempl/armelf.em
-@@ -456,7 +456,7 @@ gld${EMULATION_NAME}_finish (void)
- 	}
-     }
- 
--  finish_default ();
-+  ldelf_finish ();
- 
-   if (params.thumb_entry_symbol)
-     {
-diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em
-index 7696a9050d9..0945702bfb6 100644
---- a/ld/emultempl/avrelf.em
-+++ b/ld/emultempl/avrelf.em
-@@ -227,7 +227,7 @@ avr_finish (void)
- 	elf_elfheader (abfd)->e_flags &= ~EF_AVR_LINKRELAX_PREPARED;
-     }
- 
--  finish_default ();
-+  ldelf_finish ();
- }
- EOF
- 
-diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
-index 4d431995d2e..0bad25d3a46 100644
---- a/ld/emultempl/elf.em
-+++ b/ld/emultempl/elf.em
-@@ -1173,6 +1173,7 @@ LDEMUL_BEFORE_PLACE_ORPHANS=${LDEMUL_BEFORE_PLACE_ORPHANS-ldelf_before_place_orp
- LDEMUL_AFTER_ALLOCATION=${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation}
- LDEMUL_SET_OUTPUT_ARCH=${LDEMUL_SET_OUTPUT_ARCH-ldelf_set_output_arch}
- LDEMUL_BEFORE_ALLOCATION=${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation}
-+LDEMUL_FINISH=${LDEMUL_FINISH-ldelf_finish}
- LDEMUL_OPEN_DYNAMIC_ARCHIVE=${LDEMUL_OPEN_DYNAMIC_ARCHIVE-ldelf_open_dynamic_archive}
- LDEMUL_PLACE_ORPHAN=${LDEMUL_PLACE_ORPHAN-ldelf_place_orphan}
- LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
-diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
-index acd673a7b84..529a5920920 100644
---- a/ld/emultempl/ppc32elf.em
-+++ b/ld/emultempl/ppc32elf.em
-@@ -238,7 +238,7 @@ ppc_finish (void)
-     lang_for_each_statement (no_zero_padding);
-   if (!ppc_finish_symbols (&link_info))
-     einfo (_("%X%P: ppc_finish_symbols problem %E\n"));
--  finish_default ();
-+  ldelf_finish ();
- }
- 
- EOF
-diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
-index f9ace66a5b2..1e6ae7af738 100644
---- a/ld/emultempl/ppc64elf.em
-+++ b/ld/emultempl/ppc64elf.em
-@@ -616,7 +616,7 @@ gld${EMULATION_NAME}_finish (void)
-   fflush (stderr);
-   free (msg);
- 
--  finish_default ();
-+  ldelf_finish ();
- }
- 
- 
-diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
-index dd8d259a31f..76776ba2555 100644
---- a/ld/emultempl/spuelf.em
-+++ b/ld/emultempl/spuelf.em
-@@ -432,7 +432,7 @@ gld${EMULATION_NAME}_finish (void)
- 	einfo (_("%P: --auto-overlay ignored with zero local store range\n"));
-     }
- 
--  finish_default ();
-+  ldelf_finish ();
- }
- 
- static char *
-diff --git a/ld/ld.h b/ld/ld.h
-index 48d34bc6acd..254f0a097bb 100644
---- a/ld/ld.h
-+++ b/ld/ld.h
-@@ -306,6 +306,12 @@ typedef struct
-   /* If set, store plugin intermediate files permanently.  */
-   bool plugin_save_temps;
- 
-+  /* If set, if the .gnu_object_only section should be created.  */
-+  bool emit_gnu_object_only;
-+
-+  /* If set, if the .gnu_object_only section is being created.  */
-+  bool emitting_gnu_object_only;
-+
-   /* If set, print discarded sections in map file output.  */
-   bool print_map_discarded;
- 
-diff --git a/ld/ldelf.c b/ld/ldelf.c
-index 4cbfc19c161..a66d1d21394 100644
---- a/ld/ldelf.c
-+++ b/ld/ldelf.c
-@@ -63,6 +63,7 @@ static lang_input_statement_type *global_found;
- static struct stat global_stat;
- static struct bfd_link_needed_list *global_vercheck_needed;
- static bool global_vercheck_failed;
-+static bool orphan_init_done;
- 
- void
- ldelf_after_parse (void)
-@@ -2101,7 +2102,7 @@ elf_orphan_compatible (asection *in, asection *out)
- lang_output_section_statement_type *
- ldelf_place_orphan (asection *s, const char *secname, int constraint)
- {
--  static struct orphan_save hold[] =
-+  static struct orphan_save orig_hold[] =
-     {
-       { ".text",
- 	SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE,
-@@ -2131,6 +2132,7 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
- 	SEC_HAS_CONTENTS,
- 	0, 0, 0, 0 },
-     };
-+  static struct orphan_save hold[ARRAY_SIZE (orig_hold)];
-   enum orphan_save_index
-     {
-       orphan_text = 0,
-@@ -2143,7 +2145,6 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
-       orphan_sdata,
-       orphan_nonalloc
-     };
--  static int orphan_init_done = 0;
-   struct orphan_save *place;
-   lang_output_section_statement_type *after;
-   lang_output_section_statement_type *os;
-@@ -2272,16 +2273,23 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
- 
-   if (!orphan_init_done)
-     {
--      struct orphan_save *ho;
-+      struct orphan_save *ho, *horig;
- 
-       for (ho = hold; ho < hold + sizeof (hold) / sizeof (hold[0]); ++ho)
-+      for (ho = hold, horig = orig_hold;
-+	   ho < hold + ARRAY_SIZE (hold);
-+	   ++ho, ++horig)
-+	{
-+	  *ho = *horig;
-+	  if (ho->name != NULL)
- 	if (ho->name != NULL)
- 	  {
- 	    ho->os = lang_output_section_find (ho->name);
- 	    if (ho->os != NULL && ho->os->flags == 0)
- 	      ho->os->flags = ho->flags;
- 	  }
--      orphan_init_done = 1;
-+	}
-+      orphan_init_done = true;
-     }
- 
-   /* If this is a final link, then always put .gnu.warning.SYMBOL
-@@ -2428,3 +2436,13 @@ ldelf_set_output_arch (void)
-   if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour)
-     elf_link_info (link_info.output_bfd) = &link_info;
- }
-+
-+void
-+ldelf_finish (void)
-+{
-+  /* Support the object-only output.  */
-+  if (config.emit_gnu_object_only)
-+    orphan_init_done = false;
-+
-+  finish_default ();
-+}
-diff --git a/ld/ldelf.h b/ld/ldelf.h
-index 96fb1e5b6a8..a6498cf2758 100644
---- a/ld/ldelf.h
-+++ b/ld/ldelf.h
-@@ -21,6 +21,7 @@
- extern const char *ldelf_emit_note_gnu_build_id;
- extern const char *ldelf_emit_note_fdo_package_metadata;
- 
-+extern void ldelf_finish (void);
- extern void ldelf_after_parse (void);
- extern bool ldelf_load_symbols (lang_input_statement_type *);
- extern void ldelf_before_plugin_all_symbols_read (int, int, int, int,
-diff --git a/ld/ldexp.c b/ld/ldexp.c
-index f0b8d7cb748..035cef60448 100644
---- a/ld/ldexp.c
-+++ b/ld/ldexp.c
-@@ -1699,14 +1699,15 @@ align_n (bfd_vma value, bfd_vma align)
- }
- 
- void
--ldexp_init (void)
-+ldexp_init (bool object_only)
- {
-   /* The value "13" is ad-hoc, somewhat related to the expected number of
-      assignments in a linker script.  */
--  if (!bfd_hash_table_init_n (&definedness_table,
--			      definedness_newfunc,
--			      sizeof (struct definedness_hash_entry),
--			      13))
-+  if (!object_only
-+      && !bfd_hash_table_init_n (&definedness_table,
-+				 definedness_newfunc,
-+				 sizeof (struct definedness_hash_entry),
-+				 13))
-     einfo (_("%F%P: can not create hash table: %E\n"));
- }
- 
-@@ -1763,7 +1764,8 @@ ldexp_is_final_sym_absolute (const struct bfd_link_hash_entry *h)
- }
- 
- void
--ldexp_finish (void)
-+ldexp_finish (bool object_only)
- {
--  bfd_hash_table_free (&definedness_table);
-+  if (!object_only)
-+    bfd_hash_table_free (&definedness_table);
- }
-diff --git a/ld/ldexp.h b/ld/ldexp.h
-index f7d2cba4f4c..16953caf7cd 100644
---- a/ld/ldexp.h
-+++ b/ld/ldexp.h
-@@ -250,9 +250,9 @@ fill_type *exp_get_fill
-   (etree_type *, fill_type *, char *);
- bfd_vma exp_get_abs_int
-   (etree_type *, int, char *);
--void ldexp_init (void);
-+void ldexp_init (bool);
- void ldexp_finalize_syms (void);
- bool ldexp_is_final_sym_absolute (const struct bfd_link_hash_entry *);
--void ldexp_finish (void);
-+void ldexp_finish (bool);
- 
- #endif
-diff --git a/ld/ldfile.c b/ld/ldfile.c
-index 9bf5014ad95..530a5fef5e3 100644
---- a/ld/ldfile.c
-+++ b/ld/ldfile.c
-@@ -532,7 +532,9 @@ ldfile_try_open_bfd (const char *attempt,
-       && !no_more_claiming
-       && bfd_check_format (entry->the_bfd, bfd_object))
-     plugin_maybe_claim (entry);
-+  else
- #endif /* BFD_SUPPORTS_PLUGINS */
-+    cmdline_check_object_only_section (entry->the_bfd, false);
- 
-   /* It opened OK, the format checked out, and the plugins have had
-      their chance to claim it, so this is success.  */
-diff --git a/ld/ldlang.c b/ld/ldlang.c
-index 4c8d4e7a7fc..e1e491732a9 100644
---- a/ld/ldlang.c
-+++ b/ld/ldlang.c
-@@ -37,6 +37,7 @@
- #include "ldctor.h"
- #include "ldfile.h"
- #include "ldemul.h"
-+#include "ldwrite.h"
- #include "fnmatch.h"
- #include "demangle.h"
- #include "hashtab.h"
-@@ -47,6 +48,9 @@
- #include "plugin.h"
- #endif
- 
-+/* FIXME: Put it here to avoid NAME conflict from ldgram.h.  */
-+#include "elf-bfd.h"
-+
- #ifndef offsetof
- #define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
- #endif
-@@ -76,6 +80,9 @@ static lang_statement_list_type **stat_save_ptr = &stat_save[0];
- static struct unique_sections *unique_section_list;
- static struct asneeded_minfo *asneeded_list_head;
- static unsigned int opb_shift = 0;
-+static cmdline_list_type cmdline_object_only_file_list;
-+static cmdline_list_type cmdline_object_only_archive_list;
-+static cmdline_list_type cmdline_temp_object_only_list;
- 
- /* Forward declarations.  */
- static void exp_init_os (etree_type *);
-@@ -99,6 +106,10 @@ static void lang_do_version_exports_section (void);
- static void lang_finalize_version_expr_head
-   (struct bfd_elf_version_expr_head *);
- static void lang_do_memory_regions (bool);
-+static void cmdline_lists_init (void);
-+static void cmdline_get_object_only_input_files (void);
-+static void print_cmdline_list (cmdline_union_type *);
-+static bool cmdline_on_object_only_archive_list_p (bfd *);
- 
- /* Exported variables.  */
- const char *output_target;
-@@ -1353,15 +1364,20 @@ output_section_statement_table_free (void)
- /* Build enough state so that the parser can build its tree.  */
- 
- void
--lang_init (void)
-+lang_init (bool object_only)
- {
--  obstack_begin (&stat_obstack, 1000);
--  obstack_init (&pt_obstack);
-+  if (!object_only)
-+    {
-+      obstack_begin (&stat_obstack, 1000);
-+      obstack_init (&pt_obstack);
-+    }
- 
-   stat_ptr = &statement_list;
- 
-   output_section_statement_table_init ();
- 
-+  cmdline_lists_init ();
-+
-   lang_list_init (stat_ptr);
- 
-   lang_list_init (&input_file_chain);
-@@ -3142,6 +3158,12 @@ load_symbols (lang_input_statement_type *entry,
- 		  loaded = false;
- 		}
- 
-+	      if (config.emitting_gnu_object_only)
-+		{
-+		  if (!cmdline_on_object_only_archive_list_p (member))
-+		    continue;
-+		}
-+
- 	      subsbfd = member;
- 	      if (!(*link_info.callbacks
- 		    ->add_archive_element) (&link_info, member,
-@@ -8343,7 +8365,42 @@ lang_process (void)
- 	    }
- 	}
-     }
-+  else
- #endif /* BFD_SUPPORTS_PLUGINS */
-+    if (bfd_link_relocatable (&link_info))
-+    {
-+      /* Check if .gnu_object_only section should be created.  */
-+      bfd *p;
-+      int object_type;
-+
-+      object_type = 0;
-+      for (p = link_info.input_bfds; p != (bfd *) NULL; p = p->link.next)
-+	{
-+	  enum bfd_lto_object_type lto_type = bfd_get_lto_type (p);
-+	  /* NB: Treat fat IR object as IR object here.  */
-+	  if (lto_type == lto_fat_ir_object)
-+	    lto_type = lto_slim_ir_object;
-+	  object_type |= 1 << lto_type;
-+	  if ((object_type & (1 << lto_mixed_object)) != 0
-+	      || ((object_type
-+		   & (1 << lto_non_ir_object
-+		      | 1 << lto_slim_ir_object))
-+		  == (1 << lto_non_ir_object | 1 << lto_slim_ir_object)))
-+	    {
-+	      config.emit_gnu_object_only = true;
-+	      break;
-+	    }
-+	}
-+
-+      if (verbose
-+	  && (cmdline_object_only_file_list.head
-+	      || cmdline_object_only_archive_list.head))
-+	{
-+	  info_msg (_("Object-only input files:\n "));
-+	  print_cmdline_list (cmdline_object_only_file_list.head);
-+	  print_cmdline_list (cmdline_object_only_archive_list.head);
-+	}
-+    }
- 
-   struct bfd_sym_chain **sym = &link_info.gc_sym_list;
-   while (*sym)
-@@ -10022,3 +10079,967 @@ lang_print_memory_usage (void)
-       printf ("\n");
-     }
- }
-+
-+static void
-+cmdline_lists_init (void)
-+{
-+  cmdline_object_only_file_list.tail
-+    = &cmdline_object_only_file_list.head;
-+  cmdline_object_only_archive_list.tail
-+    = &cmdline_object_only_archive_list.head;
-+  cmdline_temp_object_only_list.tail
-+    = &cmdline_temp_object_only_list.head;
-+}
-+
-+/* Allocate an item with TYPE and DATA.  */
-+
-+static cmdline_union_type *
-+cmdline_list_new (cmdline_enum_type type, void *data)
-+{
-+  cmdline_union_type *new_opt;
-+
-+  new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
-+  new_opt->header.type = type;
-+  switch (type)
-+    {
-+    default:
-+      break;
-+    case cmdline_is_file_enum:
-+      new_opt->file.filename = (const char *) data;
-+      break;
-+    case cmdline_is_bfd_enum:
-+      new_opt->abfd.abfd = (bfd *) data;
-+      break;
-+    }
-+  return new_opt;
-+}
-+
-+/* Append an item with TYPE and DATA to LIST.  */
-+
-+static void
-+cmdline_list_append (cmdline_list_type *list, cmdline_enum_type type,
-+		     void *data)
-+{
-+  cmdline_union_type *new_opt = cmdline_list_new (type, data);
-+  new_opt->header.next = NULL;
-+  *list->tail = new_opt;
-+  list->tail = &new_opt->header.next;
-+}
-+
-+static void
-+print_cmdline_list (cmdline_union_type *c)
-+{
-+  for (; c != NULL; c = c->header.next)
-+    switch (c->header.type)
-+      {
-+      default:
-+	abort ();
-+      case cmdline_is_file_enum:
-+	info_msg (" %s", c->file.filename);
-+	break;
-+      case cmdline_is_bfd_enum:
-+	info_msg (" [%B]", c->abfd.abfd);
-+	break;
-+      }
-+
-+  info_msg ("\n");
-+}
-+
-+/* Return TRUE if ABFD is on cmdline_object_only_archive_list.  */
-+
-+static bool
-+cmdline_on_object_only_archive_list_p (bfd *abfd)
-+{
-+  cmdline_union_type *c, *next;
-+  bfd *archive, *obfd, *oarchive;
-+  ufile_ptr origin = abfd->origin;
-+
-+  archive = abfd->my_archive;
-+  for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
-+    {
-+      if (c->header.type != cmdline_is_bfd_enum)
-+	abort ();
-+
-+      next = c->header.next;
-+      obfd = c->abfd.abfd;
-+      oarchive = obfd->my_archive;
-+
-+      /* The list is grouped by archive file name and sorted by member
-+	 origin.  */
-+      if (strcmp (archive->filename, oarchive->filename) != 0)
-+	continue;
-+
-+      if (origin == obfd->origin)
-+	return true;
-+      else if (origin < obfd->origin)
-+	return false;
-+    }
-+
-+  return false;
-+}
-+
-+/* Append an item with TYPE and DATA to cmdline_object_only_file_list
-+   or cmdline_object_only_archive_list if needed.  */
-+
-+static void
-+cmdline_object_only_list_append (cmdline_enum_type type, void *data)
-+{
-+  cmdline_union_type *c;
-+  cmdline_union_type *new_opt, *next, **prev;
-+  bfd *abfd, *archive;
-+  bfd *obfd, *oarchive;
-+  bfd *nbfd, *narchive;
-+  ufile_ptr origin, norigin;
-+
-+  /* Put it on cmdline_object_only_file_list if it isn't an archive
-+     member.  */
-+  switch (type)
-+    {
-+    default:
-+      abort ();
-+    case cmdline_is_bfd_enum:
-+      abfd = (bfd *) data;
-+      archive = abfd->my_archive;
-+      if (archive)
-+	break;
-+      /* Fallthru */
-+    case cmdline_is_file_enum:
-+      cmdline_list_append (&cmdline_object_only_file_list, type, data);
-+      return;
-+    }
-+
-+  /* Put archive member on cmdline_object_only_archive_list and sort
-+     the list by archive name and archive member origin.  */
-+  new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
-+  new_opt->header.type = cmdline_is_bfd_enum;
-+  new_opt->header.next = NULL;
-+  new_opt->abfd.abfd = (bfd *) data;
-+
-+  c = cmdline_object_only_archive_list.head;
-+  if (c == NULL)
-+    {
-+      cmdline_object_only_archive_list.head = new_opt;
-+      cmdline_object_only_archive_list.tail = &new_opt->header.next;
-+      return;
-+    }
-+
-+  prev = NULL;
-+  origin = abfd->origin;
-+  for (; c != NULL; c = next)
-+    {
-+      if (c->header.type != cmdline_is_bfd_enum)
-+	abort ();
-+
-+      next = c->header.next;
-+
-+      obfd = c->abfd.abfd;
-+      oarchive = obfd->my_archive;
-+
-+      if (strcmp (archive->filename, oarchive->filename) == 0)
-+	{
-+	  bool after;
-+
-+	  if (origin < obfd->origin)
-+	    {
-+	      /* Insert it before the current.  */
-+	      new_opt->header.next = c;
-+	      if (prev)
-+		*prev = new_opt;
-+	      else
-+		cmdline_object_only_archive_list.head = new_opt;
-+	      return;
-+	    }
-+
-+	  after = true;
-+
-+	  /* Check origin.  */
-+	  while (next)
-+	    {
-+	      if (next->header.type != cmdline_is_bfd_enum)
-+		abort ();
-+
-+	      nbfd = next->abfd.abfd;
-+	      norigin = nbfd->origin;
-+	      if (origin > norigin)
-+		{
-+		  /* Insert it after NEXT.  */
-+		  break;
-+		}
-+
-+	      narchive = nbfd->my_archive;
-+	      if (strcmp (archive->filename, narchive->filename) != 0)
-+		{
-+		  /* Insert it befor NEXT.  */
-+		  after = false;
-+		  break;
-+		}
-+
-+	      c = next;
-+	      next = next->header.next;
-+	    }
-+
-+	  if (after && next)
-+	    {
-+	      c = next;
-+	      next = next->header.next;
-+	    }
-+
-+	  if (*cmdline_object_only_archive_list.tail == c->header.next)
-+	    cmdline_object_only_archive_list.tail
-+	      = &new_opt->header.next;
-+
-+	  prev = &c->header.next;
-+	  new_opt->header.next = next;
-+	  *prev = new_opt;
-+	  return;
-+	}
-+
-+      prev = &c->header.next;
-+    }
-+
-+  *cmdline_object_only_archive_list.tail = new_opt;
-+  cmdline_object_only_archive_list.tail = &new_opt->header.next;
-+}
-+
-+/* Get object-only input files.  */
-+
-+static void
-+cmdline_get_object_only_input_files (void)
-+{
-+  cmdline_union_type *c, *next;
-+  bfd *abfd, *archive;
-+  bfd *nbfd, *narchive;
-+
-+  /* Add files first.  */
-+  for (c = cmdline_object_only_file_list.head;
-+       c != NULL; c = c->header.next)
-+    switch (c->header.type)
-+      {
-+      default:
-+	abort ();
-+      case cmdline_is_file_enum:
-+	lang_add_input_file (c->file.filename,
-+			     lang_input_file_is_file_enum, NULL);
-+	break;
-+      case cmdline_is_bfd_enum:
-+	abfd = c->abfd.abfd;
-+	if (abfd->my_archive)
-+	  abort ();
-+	lang_add_input_file (abfd->filename,
-+			     lang_input_file_is_file_enum, NULL);
-+	break;
-+      }
-+
-+  /* Add archive members next.  */
-+  for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
-+    {
-+      if (c->header.type != cmdline_is_bfd_enum)
-+	abort ();
-+
-+      next = c->header.next;
-+
-+      abfd = c->abfd.abfd;
-+      archive = abfd->my_archive;
-+
-+      /* Add the first archive of the archive member group.  */
-+      lang_add_input_file (archive->filename,
-+			   lang_input_file_is_file_enum, NULL);
-+
-+      /* Skip the rest members in the archive member group.  */
-+      do
-+	{
-+	  if (!next)
-+	    break;
-+
-+	  if (next->header.type != cmdline_is_bfd_enum)
-+	    abort ();
-+
-+	  next = next->header.next;
-+	  if (!next)
-+	    break;
-+	  nbfd = next->abfd.abfd;
-+	  narchive = nbfd->my_archive;
-+	}
-+      while (strcmp (archive->filename, narchive->filename) == 0);
-+    }
-+}
-+
-+struct cmdline_arg
-+{
-+  bfd *obfd;
-+  asymbol **isympp;
-+  int status;
-+};
-+
-+/* Create a section in OBFD with the same
-+   name and attributes as ISECTION in IBFD.  */
-+
-+static void
-+setup_section (bfd *ibfd, sec_ptr isection, void *p)
-+{
-+  struct cmdline_arg *arg = (struct cmdline_arg *) p;
-+  bfd *obfd = arg->obfd;
-+  asymbol **isympp = arg->isympp;
-+  const char *name = isection->name;
-+  sec_ptr osection;
-+  const char *err;
-+
-+  /* Skip the object-only section.  */
-+  if (ibfd->object_only_section == isection)
-+    return;
-+
-+  /* If we have already failed earlier on, do not keep on generating
-+     complaints now.  */
-+  if (arg->status)
-+    return;
-+
-+  osection = bfd_make_section_anyway_with_flags (obfd, name,
-+						 isection->flags);
-+
-+  if (osection == NULL)
-+    {
-+      err = _("failed to create output section");
-+      goto loser;
-+    }
-+
-+  osection->size = isection->size;
-+  osection->vma = isection->vma;
-+  osection->lma = isection->lma;
-+  osection->alignment_power = isection->alignment_power;
-+
-+  /* Copy merge entity size.  */
-+  osection->entsize = isection->entsize;
-+
-+  /* This used to be mangle_section; we do here to avoid using
-+     bfd_get_section_by_name since some formats allow multiple
-+     sections with the same name.  */
-+  isection->output_section = osection;
-+  isection->output_offset = 0;
-+
-+  if ((isection->flags & SEC_GROUP) != 0)
-+    {
-+      asymbol *gsym = bfd_group_signature (isection, isympp);
-+
-+      if (gsym != NULL)
-+	{
-+	  gsym->flags |= BSF_KEEP;
-+	  if (ibfd->xvec->flavour == bfd_target_elf_flavour)
-+	    elf_group_id (isection) = gsym;
-+	}
-+    }
-+
-+  /* Allow the BFD backend to copy any private data it understands
-+     from the input section to the output section.  */
-+  if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
-+    {
-+      err = _("failed to copy private data");
-+      goto loser;
-+    }
-+
-+  /* All went well.  */
-+  return;
-+
-+loser:
-+  arg->status = 1;
-+  einfo (_("%P%F: setup_section: %s: %s\n"), err, name);
-+}
-+
-+/* Copy the data of input section ISECTION of IBFD
-+   to an output section with the same name in OBFD.
-+   If stripping then don't copy any relocation info.  */
-+
-+static void
-+copy_section (bfd *ibfd, sec_ptr isection, void *p)
-+{
-+  struct cmdline_arg *arg = (struct cmdline_arg *) p;
-+  bfd *obfd = arg->obfd;
-+  asymbol **isympp = arg->isympp;
-+  arelent **relpp;
-+  long relcount;
-+  sec_ptr osection;
-+  bfd_size_type size;
-+  long relsize;
-+  flagword flags;
-+  const char *err;
-+
-+  /* Skip the object-only section.  */
-+  if (ibfd->object_only_section == isection)
-+    return;
-+
-+  /* If we have already failed earlier on, do not keep on generating
-+     complaints now.  */
-+  if (arg->status)
-+    return;
-+
-+  flags = bfd_section_flags (isection);
-+  if ((flags & SEC_GROUP) != 0)
-+    return;
-+
-+  osection = isection->output_section;
-+  size = bfd_section_size (isection);
-+
-+  if (size == 0 || osection == 0)
-+    return;
-+
-+  relsize = bfd_get_reloc_upper_bound (ibfd, isection);
-+
-+  if (relsize < 0)
-+    {
-+      /* Do not complain if the target does not support relocations.  */
-+      if (relsize == -1
-+	  && bfd_get_error () == bfd_error_invalid_operation)
-+	relsize = 0;
-+      else
-+	{
-+	  err = bfd_errmsg (bfd_get_error ());
-+	  goto loser;
-+	}
-+    }
-+
-+  if (relsize == 0)
-+    bfd_set_reloc (obfd, osection, NULL, 0);
-+  else
-+    {
-+      relpp = (arelent **) xmalloc (relsize);
-+      relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
-+      if (relcount < 0)
-+	{
-+	  err = _("relocation count is negative");
-+	  goto loser;
-+	}
-+
-+      bfd_set_reloc (obfd, osection,
-+		     relcount == 0 ? NULL : relpp, relcount);
-+      if (relcount == 0)
-+	free (relpp);
-+    }
-+
-+  if (bfd_section_flags (isection) & SEC_HAS_CONTENTS)
-+    {
-+      bfd_byte *memhunk = NULL;
-+
-+      if (!bfd_get_full_section_contents (ibfd, isection, &memhunk))
-+	{
-+	  err = bfd_errmsg (bfd_get_error ());
-+	  goto loser;
-+	}
-+
-+      if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
-+	{
-+	  err = bfd_errmsg (bfd_get_error ());
-+	  goto loser;
-+	}
-+      free (memhunk);
-+    }
-+
-+  /* All went well.  */
-+  return;
-+
-+loser:
-+  einfo (_("%P%F: copy_section: %s: %s\n"), err, isection->name);
-+}
-+/* Open the temporary bfd created in the same directory as PATH.  */
-+
-+static bfd *
-+cmdline_fopen_temp (const char *path, const char *target,
-+		    const char *mode)
-+{
-+#define template "ldXXXXXX"
-+  const char *slash = strrchr (path, '/');
-+  char *tmpname;
-+  size_t len;
-+  int fd;
-+
-+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
-+  {
-+    /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
-+    char *bslash = strrchr (path, '\\');
-+
-+    if (slash == NULL || (bslash != NULL && bslash > slash))
-+      slash = bslash;
-+    if (slash == NULL && path[0] != '\0' && path[1] == ':')
-+      slash = path + 1;
-+  }
-+#endif
-+
-+  if (slash != (char *) NULL)
-+    {
-+      len = slash - path;
-+      tmpname = (char *) xmalloc (len + sizeof (template) + 2);
-+      memcpy (tmpname, path, len);
-+
-+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
-+      /* If tmpname is "X:", appending a slash will make it a root
-+	 directory on drive X, which is NOT the same as the current
-+	 directory on drive X.  */
-+      if (len == 2 && tmpname[1] == ':')
-+	tmpname[len++] = '.';
-+#endif
-+      tmpname[len++] = '/';
-+    }
-+  else
-+    {
-+      tmpname = (char *) xmalloc (sizeof (template));
-+      len = 0;
-+    }
-+
-+  memcpy (tmpname + len, template, sizeof (template));
-+#undef template
-+
-+#ifdef HAVE_MKSTEMP
-+  fd = mkstemp (tmpname);
-+#else
-+  tmpname = mktemp (tmpname);
-+  if (tmpname == NULL)
-+    return NULL;
-+  fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600);
-+#endif
-+  if (fd == -1)
-+    return NULL;
-+  return bfd_fopen (tmpname, target, mode, fd);
-+}
-+
-+/* Add the object-only section.  */
-+
-+static void
-+cmdline_add_object_only_section (bfd_byte *contents, size_t size)
-+{
-+  bfd_vma start;
-+  flagword flags;
-+  enum bfd_architecture iarch;
-+  unsigned int imach;
-+  long symcount;
-+  long symsize;
-+  asymbol **isympp = NULL;
-+  asymbol **osympp = NULL;
-+  bfd *obfd = NULL, *ibfd;
-+  const char *err;
-+  struct arg
-+    {
-+      bfd *obfd;
-+      asymbol **isympp;
-+      int status;
-+    } arg;
-+  char **matching;
-+  char *ofilename = NULL;
-+  asection *sec;
-+
-+  ibfd = bfd_openr (output_filename, output_target);
-+  if (!ibfd)
-+    {
-+      err = bfd_errmsg (bfd_get_error ());
-+      goto loser;
-+    }
-+
-+  if (!bfd_check_format_matches (ibfd, bfd_object, &matching))
-+    {
-+      err = bfd_errmsg (bfd_get_error ());
-+      goto loser;
-+    }
-+
-+  obfd = cmdline_fopen_temp (output_filename, output_target, FOPEN_WB);
-+  if (!obfd)
-+    {
-+      err = bfd_errmsg (bfd_get_error ());
-+      goto loser;
-+    }
-+  /* To be used after bfd_close ().  */
-+  ofilename = xstrdup (bfd_get_filename (obfd));
-+
-+  if (!bfd_set_format (obfd, bfd_object))
-+    {
-+      err = bfd_errmsg (bfd_get_error ());
-+      goto loser;
-+    }
-+
-+  /* Copy the start address, flags and architecture of input file to
-+     output file.  */
-+  flags = bfd_get_file_flags (ibfd);
-+  start = bfd_get_start_address (ibfd);
-+  iarch = bfd_get_arch (ibfd);
-+  imach = bfd_get_mach (ibfd);
-+  if (!bfd_set_start_address (obfd, start)
-+      || !bfd_set_file_flags (obfd, flags)
-+      || !bfd_set_arch_mach (obfd, iarch, imach))
-+    {
-+      err = bfd_errmsg (bfd_get_error ());
-+      goto loser;
-+    }
-+
-+  symsize = bfd_get_symtab_upper_bound (ibfd);
-+  if (symsize < 0)
-+    {
-+      err = bfd_errmsg (bfd_get_error ());
-+      goto loser;
-+    }
-+
-+  isympp = (asymbol **) xmalloc (symsize);
-+  symcount = bfd_canonicalize_symtab (ibfd, isympp);
-+  if (symcount < 0)
-+    {
-+      err = bfd_errmsg (bfd_get_error ());
-+      goto loser;
-+    }
-+
-+  arg.obfd = obfd;
-+  arg.isympp = isympp;
-+  arg.status = 0;
-+
-+  /* BFD mandates that all output sections be created and sizes set before
-+     any output is done.  Thus, we traverse all sections multiple times.  */
-+  bfd_map_over_sections (ibfd, setup_section, &arg);
-+
-+  if (arg.status)
-+    {
-+      err = _("error setting up sections");
-+      goto loser;
-+    }
-+
-+  /* Allow the BFD backend to copy any private data it understands
-+     from the input section to the output section.  */
-+  if (! bfd_copy_private_header_data (ibfd, obfd))
-+    {
-+      err = _("error copying private header data");
-+      goto loser;
-+    }
-+
-+  /* Create the object-only section.  */
-+  sec = bfd_make_section_with_flags (obfd,
-+				     GNU_OBJECT_ONLY_SECTION_NAME,
-+				     (SEC_HAS_CONTENTS
-+				      | SEC_READONLY
-+				      | SEC_DATA
-+				      | SEC_LINKER_CREATED));
-+  if (sec == NULL)
-+    {
-+      err = _("can't create object-only section");
-+      goto loser;
-+    }
-+
-+  if (! bfd_set_section_size (sec, size))
-+    {
-+      err = _("can't set object-only section size");
-+      goto loser;
-+    }
-+
-+  if (ibfd->object_only_section)
-+    {
-+      /* Filter out the object-only section symbol.  */
-+      long src_count = 0, dst_count = 0;
-+      asymbol **from, **to;
-+
-+      osympp = (asymbol **) xmalloc (symcount * sizeof (asymbol *));
-+      from = isympp;
-+      to = osympp;
-+      for (; src_count < symcount; src_count++)
-+	{
-+	  asymbol *sym = from[src_count];
-+	  if (bfd_asymbol_section (sym) != ibfd->object_only_section)
-+	    to[dst_count++] = sym;
-+	}
-+      to[dst_count] = NULL;
-+      symcount = dst_count;
-+      bfd_set_symtab (obfd, osympp, symcount);
-+    }
-+  else
-+    bfd_set_symtab (obfd, isympp, symcount);
-+
-+  /* This has to happen after the symbol table has been set.  */
-+  bfd_map_over_sections (ibfd, copy_section, &arg);
-+
-+  if (arg.status)
-+    {
-+      err = _("error copying sections");
-+      goto loser;
-+    }
-+
-+  /* Copy the object-only section to the output.  */
-+  if (! bfd_set_section_contents (obfd, sec, contents, 0, size))
-+    {
-+      err = _("error adding object-only section");
-+      goto loser;
-+    }
-+
-+  /* Allow the BFD backend to copy any private data it understands
-+     from the input BFD to the output BFD.  This is done last to
-+     permit the routine to look at the filtered symbol table, which is
-+     important for the ECOFF code at least.  */
-+  if (! bfd_copy_private_bfd_data (ibfd, obfd))
-+    {
-+      err = _("error copying private BFD data");
-+      goto loser;
-+    }
-+
-+  if (!bfd_close (obfd))
-+    {
-+      unlink (ofilename);
-+      einfo (_("%P%F: failed to finish output with object-only section\n"));
-+    }
-+
-+  /* Must be freed after bfd_close ().  */
-+  free (isympp);
-+  if (osympp)
-+    free (osympp);
-+
-+  if (rename (ofilename, output_filename))
-+    {
-+      unlink (ofilename);
-+      einfo (_("%P%F: failed to rename output with object-only section\n"));
-+    }
-+
-+  free (ofilename);
-+  return;
-+
-+loser:
-+  if (isympp)
-+    free (isympp);
-+  if (osympp)
-+    free (osympp);
-+  if (obfd)
-+    bfd_close (obfd);
-+  if (ofilename)
-+    unlink (ofilename);
-+  einfo (_("%P%F: failed to add object-only section: %s\n"), err);
-+}
-+
-+/* Emit the final output with object-only section.  */
-+
-+void
-+cmdline_emit_object_only_section (void)
-+{
-+  const char *saved_output_filename = output_filename;
-+  int fd;
-+  size_t size, off;
-+  bfd_byte *contents;
-+  struct stat st;
-+
-+  /* Get a temporary object-only file.  */
-+  output_filename = make_temp_file (".obj-only.o");
-+
-+  had_output_filename = false;
-+  link_info.input_bfds = NULL;
-+  link_info.input_bfds_tail = &link_info.input_bfds;
-+
-+  lang_init (true);
-+  ldexp_init (true);
-+
-+  ld_parse_linker_script ();
-+
-+  /* Set up the object-only output. */
-+  lang_final ();
-+
-+  /* Open the object-only file for output.  */
-+  lang_for_each_statement (ldlang_open_output);
-+
-+  ldemul_create_output_section_statements ();
-+
-+  if (!bfd_section_already_linked_table_init ())
-+    einfo (_("%P%F: Failed to create hash table\n"));
-+
-+  /* Call cmdline_on_object_only_archive_list_p to check which member
-+     should be loaded.  */
-+  input_flags.whole_archive = true;
-+
-+  /* Set it to avoid adding more to cmdline lists.  */
-+  config.emitting_gnu_object_only = true;
-+
-+  /* Get object-only input files.  */
-+  cmdline_get_object_only_input_files ();
-+
-+  /* Open object-only input files.  */
-+  open_input_bfds (statement_list.head, NULL, OPEN_BFD_NORMAL);
-+
-+  ldemul_after_open ();
-+
-+  bfd_section_already_linked_table_free ();
-+
-+  /* Make sure that we're not mixing architectures.  We call this
-+     after all the input files have been opened, but before we do any
-+     other processing, so that any operations merge_private_bfd_data
-+     does on the output file will be known during the rest of the
-+     link.  */
-+  lang_check ();
-+
-+  /* Size up the common data.  */
-+  lang_common ();
-+
-+  /* Update wild statements.  */
-+  update_wild_statements (statement_list.head);
-+
-+  /* Run through the contours of the script and attach input sections
-+     to the correct output sections.  */
-+  map_input_to_output_sections (statement_list.head, NULL, NULL);
-+
-+  /* Find any sections not attached explicitly and handle them.  */
-+  lang_place_orphans ();
-+
-+  /* Do anything special before sizing sections.  This is where ELF
-+     and other back-ends size dynamic sections.  */
-+  ldemul_before_allocation ();
-+
-+  /* Size up the sections.  */
-+  lang_size_sections (NULL, ! RELAXATION_ENABLED);
-+
-+  /* See if anything special should be done now we know how big
-+     everything is.  This is where relaxation is done.  */
-+  ldemul_after_allocation ();
-+
-+  ldemul_finish ();
-+
-+  /* Make sure that the section addresses make sense.  */
-+  if (command_line.check_section_addresses)
-+    lang_check_section_addresses ();
-+
-+  lang_end ();
-+
-+  ldwrite ();
-+
-+  ldexp_finish (true);
-+  lang_finish ();
-+
-+  if (! bfd_close (link_info.output_bfd))
-+    einfo (_("%P%F:%s: final close failed on object-only output: %E\n"),
-+	   output_filename);
-+
-+  link_info.output_bfd = NULL;
-+
-+  /* Read in the object-only file.  */
-+  fd = open (output_filename, O_RDONLY | O_BINARY);
-+  if (fd < 0)
-+    {
-+      bfd_set_error (bfd_error_system_call);
-+      einfo (_("%P%F:%s: cannot open object-only output: %E\n"),
-+	     output_filename);
-+    }
-+
-+  /* Get the object-only file size.  */
-+  if (fstat (fd, &st) != 0)
-+    {
-+      bfd_set_error (bfd_error_system_call);
-+      einfo (_("%P%F:%s: cannot stat object-only output: %E\n"),
-+	     output_filename);
-+    }
-+
-+  size = st.st_size;
-+  off = 0;
-+  contents = (bfd_byte *) xmalloc (size);
-+  while (off != size)
-+    {
-+      ssize_t got;
-+
-+      got = read (fd, contents + off, size - off);
-+      if (got < 0)
-+	{
-+	  bfd_set_error (bfd_error_system_call);
-+	  einfo (_("%P%F:%s: read failed on object-only output: %E\n"),
-+		 output_filename);
-+	}
-+
-+      off += got;
-+    }
-+
-+  close (fd);
-+
-+  /* Remove the temporary object-only file.  */
-+  unlink (output_filename);
-+
-+  output_filename = saved_output_filename;
-+
-+  cmdline_add_object_only_section (contents, size);
-+
-+  free (contents);
-+}
-+
-+/* Extract the object-only section.  */
-+
-+static const char *
-+cmdline_extract_object_only_section (bfd *abfd)
-+{
-+  const char *name = bfd_extract_object_only_section (abfd);
-+
-+  if (name == NULL)
-+    einfo (_("%P%F: cannot extract object-only section from %B: %E\n"),
-+	   abfd);
-+
-+  /* It should be removed after it is done.  */
-+  cmdline_list_append (&cmdline_temp_object_only_list,
-+		       cmdline_is_file_enum, (void *) name);
-+
-+  return name;
-+}
-+
-+/* Check and handle the object-only section.   */
-+
-+void
-+cmdline_check_object_only_section (bfd *abfd, bool lto)
-+{
-+  const char *filename;
-+
-+  if (config.emitting_gnu_object_only || abfd->format != bfd_object)
-+    return;
-+
-+  if (lto)
-+    {
-+      /* For LTO link, we only need to extract object-only section
-+	 from the mixed object, add it to input, and put it on LTO
-+	 claimed output.  */
-+      switch (bfd_get_lto_type (abfd))
-+	{
-+	default:
-+	  abort ();
-+	case lto_mixed_object:
-+	  filename = cmdline_extract_object_only_section (abfd);
-+	  lang_add_input_file (filename,
-+			       lang_input_file_is_file_enum, NULL);
-+	  break;
-+	case lto_non_ir_object:
-+	case lto_slim_ir_object:
-+	case lto_fat_ir_object:
-+	  break;
-+	}
-+    }
-+  else if (bfd_link_relocatable (&link_info))
-+    {
-+      /* For non-LTO relocatable link, we need to append non-IR object
-+	 file and the object file in object-only section to the object
-+	 only list.  */
-+      switch (bfd_get_lto_type (abfd))
-+	{
-+	default:
-+	  abort ();
-+	case lto_mixed_object:
-+	  filename = cmdline_extract_object_only_section (abfd);
-+	  cmdline_object_only_list_append (cmdline_is_file_enum,
-+					  (void *) filename);
-+	  break;
-+	case lto_non_ir_object:
-+	  cmdline_object_only_list_append (cmdline_is_bfd_enum, abfd);
-+	  break;
-+	case lto_slim_ir_object:
-+	case lto_fat_ir_object:
-+	  break;
-+	}
-+    }
-+}
-+
-+/* Remove temporary object-only files.  */
-+
-+void
-+cmdline_remove_object_only_files (void)
-+{
-+  cmdline_union_type *c;
-+
-+  if (config.plugin_save_temps)
-+    return;
-+
-+  c = cmdline_temp_object_only_list.head;
-+  for (; c != NULL; c = c->header.next)
-+    switch (c->header.type)
-+      {
-+      default:
-+	abort ();
-+      case cmdline_is_file_enum:
-+	unlink (c->file.filename);
-+	break;
-+      }
-+}
-diff --git a/ld/ldlang.h b/ld/ldlang.h
-index e32c5acaaca..91779a584b4 100644
---- a/ld/ldlang.h
-+++ b/ld/ldlang.h
-@@ -552,7 +552,7 @@ extern struct asneeded_minfo **asneeded_list_tail;
- extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *);
- 
- extern void lang_init
--  (void);
-+  (bool);
- extern void lang_finish
-   (void);
- extern lang_memory_region_type * lang_memory_region_lookup
-@@ -746,4 +746,46 @@ print_one_symbol (struct bfd_link_hash_entry *, void *);
- 
- extern void lang_add_version_string
-   (void);
-+
-+typedef enum
-+{
-+  cmdline_is_file_enum,
-+  cmdline_is_bfd_enum
-+} cmdline_enum_type;
-+
-+typedef struct cmdline_header_struct
-+{
-+  union cmdline_union *next;
-+  cmdline_enum_type type;
-+} cmdline_header_type;
-+
-+typedef struct cmdline_file_struct
-+{
-+  cmdline_header_type header;
-+  const char *filename;
-+} cmdline_file_type;
-+
-+typedef struct cmdline_bfd_struct
-+{
-+  cmdline_header_type header;
-+  bfd *abfd;
-+} cmdline_bfd_type;
-+
-+typedef union cmdline_union
-+{
-+  cmdline_header_type header;
-+  cmdline_file_type file;
-+  cmdline_bfd_type abfd;
-+} cmdline_union_type;
-+
-+typedef struct cmdline_list
-+{
-+  cmdline_union_type *head;
-+  cmdline_union_type **tail;
-+} cmdline_list_type;
-+
-+extern void cmdline_emit_object_only_section (void);
-+extern void cmdline_check_object_only_section (bfd *, bool);
-+extern void cmdline_remove_object_only_files (void);
-+
- #endif
-diff --git a/ld/ldmain.c b/ld/ldmain.c
-index 64c4cce8371..dcef7bb9278 100644
---- a/ld/ldmain.c
-+++ b/ld/ldmain.c
-@@ -302,6 +302,9 @@ main (int argc, char **argv)
- 
-   xatexit (ld_cleanup);
- 
-+  /* Remove temporary object-only files.  */
-+  xatexit (cmdline_remove_object_only_files);
-+
-   /* Set up the sysroot directory.  */
-   ld_sysroot = get_sysroot (argc, argv);
-   if (*ld_sysroot)
-@@ -391,8 +394,8 @@ main (int argc, char **argv)
-   emulation = get_emulation (argc, argv);
-   ldemul_choose_mode (emulation);
-   default_target = ldemul_choose_target (argc, argv);
--  lang_init ();
--  ldexp_init ();
-+  lang_init (false);
-+  ldexp_init (false);
-   ldemul_before_parse ();
-   lang_has_input_file = false;
-   parse_args (argc, argv);
-@@ -407,34 +410,7 @@ main (int argc, char **argv)
- 
-   ldemul_set_symbols ();
- 
--  /* If we have not already opened and parsed a linker script,
--     try the default script from command line first.  */
--  if (saved_script_handle == NULL
--      && command_line.default_script != NULL)
--    {
--      ldfile_open_script_file (command_line.default_script);
--      parser_input = input_script;
--      yyparse ();
--    }
--
--  /* If we have not already opened and parsed a linker script
--     read the emulation's appropriate default script.  */
--  if (saved_script_handle == NULL)
--    {
--      int isfile;
--      char *s = ldemul_get_script (&isfile);
--
--      if (isfile)
--	ldfile_open_default_command_file (s);
--      else
--	{
--	  lex_string = s;
--	  lex_redirect (s, _("built in linker script"), 1);
--	}
--      parser_input = input_script;
--      yyparse ();
--      lex_string = NULL;
--    }
-+  ld_parse_linker_script ();
- 
-   if (verbose)
-     {
-@@ -572,7 +548,7 @@ main (int argc, char **argv)
-     fprintf (stderr, "lookup = %p val %lx\n", h, h ? h->u.def.value : 1);
-   }
- #endif
--  ldexp_finish ();
-+  ldexp_finish (false);
-   lang_finish ();
- 
-   if (config.dependency_file != NULL)
-@@ -597,6 +573,8 @@ main (int argc, char **argv)
-       if (!bfd_close (obfd))
- 	einfo (_("%F%P: %s: final close failed: %E\n"), output_filename);
- 
-+      link_info.output_bfd = NULL;
-+
-       /* If the --force-exe-suffix is enabled, and we're making an
- 	 executable file and it doesn't end in .exe, copy it to one
- 	 which does.  */
-@@ -644,6 +622,9 @@ main (int argc, char **argv)
- 	}
-     }
- 
-+  if (config.emit_gnu_object_only)
-+    cmdline_emit_object_only_section ();
-+
-   if (config.stats)
-     {
-       long run_time = get_run_time () - start_time;
-@@ -951,7 +932,9 @@ add_archive_element (struct bfd_link_info *info,
- 	  *subsbfd = input->the_bfd;
- 	}
-     }
-+  else
- #endif /* BFD_SUPPORTS_PLUGINS */
-+    cmdline_check_object_only_section (input->the_bfd, false);
- 
-   if (link_info.input_bfds_tail == &input->the_bfd->link.next
-       || input->the_bfd->link.next != NULL)
-@@ -1694,3 +1677,38 @@ notice (struct bfd_link_info *info,
- 
-   return true;
- }
-+
-+/* Parse the linker script.   */
-+
-+void
-+ld_parse_linker_script (void)
-+{
-+  /* If we have not already opened and parsed a linker script,
-+     try the default script from command line first.  */
-+  if (saved_script_handle == NULL
-+      && command_line.default_script != NULL)
-+    {
-+      ldfile_open_script_file (command_line.default_script);
-+      parser_input = input_script;
-+      yyparse ();
-+    }
-+
-+  /* If we have not already opened and parsed a linker script
-+     read the emulation's appropriate default script.  */
-+  if (saved_script_handle == NULL)
-+    {
-+      int isfile;
-+      char *s = ldemul_get_script (&isfile);
-+
-+      if (isfile)
-+	ldfile_open_default_command_file (s);
-+      else
-+	{
-+	  lex_string = s;
-+	  lex_redirect (s, _("built in linker script"), 1);
-+	}
-+      parser_input = input_script;
-+      yyparse ();
-+      lex_string = NULL;
-+    }
-+}
-diff --git a/ld/ldmain.h b/ld/ldmain.h
-index 0baa3c305c3..34770762f1c 100644
---- a/ld/ldmain.h
-+++ b/ld/ldmain.h
-@@ -63,4 +63,6 @@ extern void add_ignoresym (struct bfd_link_info *, const char *);
- extern void add_keepsyms_file (const char *);
- extern void track_dependency_files (const char *);
- 
-+extern void ld_parse_linker_script (void);
-+
- #endif
-diff --git a/ld/plugin.c b/ld/plugin.c
-index ecced25bd9b..ea0c6fcdd67 100644
---- a/ld/plugin.c
-+++ b/ld/plugin.c
-@@ -1341,6 +1341,9 @@ plugin_maybe_claim (lang_input_statement_type *entry)
-     {
-       bfd *abfd = entry->the_bfd->plugin_dummy_bfd;
- 
-+      /* Check object only section.  */
-+      cmdline_check_object_only_section (entry->the_bfd, true);
-+
-       /* Discard the real file's BFD and substitute the dummy one.  */
- 
-       /* We can't call bfd_close on archives.  BFD archive handling
-diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
-index ccecc1088b8..deb69dde543 100644
---- a/ld/scripttempl/elf.sc
-+++ b/ld/scripttempl/elf.sc
-@@ -244,7 +244,7 @@ RELA_IPLT=".rela.iplt    ${RELOCATING-0} :
- DYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
- RODATA=".${RODATA_NAME}       ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
- DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
- if test -z "${NO_SMALL_DATA}"; then
-   SBSS=".${SBSS_NAME}         ${RELOCATING-0} :
-   {
-diff --git a/ld/scripttempl/elf64hppa.sc b/ld/scripttempl/elf64hppa.sc
-index c468453d79d..b6701bf1d26 100644
---- a/ld/scripttempl/elf64hppa.sc
-+++ b/ld/scripttempl/elf64hppa.sc
-@@ -132,7 +132,7 @@ fi
- DYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
- RODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
- DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink)  *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
- if test -z "${NO_SMALL_DATA}"; then
-   SBSS=".sbss         ${RELOCATING-0} :
-   {
-diff --git a/ld/scripttempl/elfxtensa.sc b/ld/scripttempl/elfxtensa.sc
-index fcda83c4dc9..2f62c2dbc54 100644
---- a/ld/scripttempl/elfxtensa.sc
-+++ b/ld/scripttempl/elfxtensa.sc
-@@ -145,7 +145,7 @@ fi
- DYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
- RODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
- DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink)  *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
- INIT_LIT=".init.literal 0 : { *(.init.literal)	}"
- INIT=".init         0 : { KEEP (*(SORT_NONE(.init))) }"
- FINI_LIT=".fini.literal 0 : { *(.fini.literal)	}"
-diff --git a/ld/scripttempl/mep.sc b/ld/scripttempl/mep.sc
-index 7f0f46ae8e9..8fdf3117a40 100644
---- a/ld/scripttempl/mep.sc
-+++ b/ld/scripttempl/mep.sc
-@@ -119,7 +119,7 @@ fi
- DYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
- RODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
- DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
--DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink)  *(.gnu.lto_*) }"
-+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
- if test -z "${NO_SMALL_DATA}"; then
-   SBSS=".sbss         ${RELOCATING-0} :
-   {
-diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc
-index 6ca5f040a36..96a47515444 100644
---- a/ld/scripttempl/pe.sc
-+++ b/ld/scripttempl/pe.sc
-@@ -230,6 +230,7 @@ SECTIONS
-     ${RELOCATING+ *(.drectve)}
-     ${RELOCATING+ *(.note.GNU-stack)}
-     ${RELOCATING+ *(.gnu.lto_*)}
-+    ${RELOCATING+ *(.gnu_object_only)}
-   }
- 
-   .idata ${RELOCATING+BLOCK(__section_alignment__)} :
-diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc
-index d9ba2be49d9..e2c6c2cedd2 100644
---- a/ld/scripttempl/pep.sc
-+++ b/ld/scripttempl/pep.sc
-@@ -237,6 +237,7 @@ SECTIONS
-     ${RELOCATING+ *(.drectve)}
-     ${RELOCATING+ *(.note.GNU-stack)}
-     ${RELOCATING+ *(.gnu.lto_*)}
-+    ${RELOCATING+ *(.gnu_object_only)}
-   }
- 
-   .idata ${RELOCATING+BLOCK(__section_alignment__)} :
-diff --git a/ld/testsuite/ld-plugin/lto-10.out b/ld/testsuite/ld-plugin/lto-10.out
-new file mode 100644
-index 00000000000..ce013625030
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-10.out
-@@ -0,0 +1 @@
-+hello
-diff --git a/ld/testsuite/ld-plugin/lto-10a.c b/ld/testsuite/ld-plugin/lto-10a.c
-new file mode 100644
-index 00000000000..93d57b520cb
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-10a.c
-@@ -0,0 +1,6 @@
-+extern int foo(void);
-+
-+int main(void)
-+{
-+  return foo();
-+}
-diff --git a/ld/testsuite/ld-plugin/lto-10b.c b/ld/testsuite/ld-plugin/lto-10b.c
-new file mode 100644
-index 00000000000..507055be341
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-10b.c
-@@ -0,0 +1,7 @@
-+#include <stdio.h>
-+
-+int foo(void)
-+{
-+  printf ("hello\n");
-+  return 0;
-+}
-diff --git a/ld/testsuite/ld-plugin/lto-10r.d b/ld/testsuite/ld-plugin/lto-10r.d
-new file mode 100644
-index 00000000000..3502056153d
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-10r.d
-@@ -0,0 +1,9 @@
-+#ld: -r tmpdir/lto-10a.o tmpdir/lto-10b.o
-+#source: dummy.s
-+#objdump: -h
-+
-+#...
-+ *[0-9]+ +\.gnu\.lto_\.[0-9a-zA-Z_\.]+ +[0-9a-f]+ +[0-9a-f]+  +[0-9a-f]+ +[0-9a-f]+ .*
-+#...
-+ *[0-9]+ +\.gnu_object_only +[0-9a-f]+ +0+ +0+ +0+[1-9a-f][0-9a-f]+ +.*
-+#pass
-diff --git a/ld/testsuite/ld-plugin/lto-4.out b/ld/testsuite/ld-plugin/lto-4.out
-new file mode 100644
-index 00000000000..8d8cc9240c8
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-4.out
-@@ -0,0 +1,2 @@
-+hello bar
-+hello foo
-diff --git a/ld/testsuite/ld-plugin/lto-4a.c b/ld/testsuite/ld-plugin/lto-4a.c
-new file mode 100644
-index 00000000000..2d07cf585da
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-4a.c
-@@ -0,0 +1,7 @@
-+extern void foo(void);
-+
-+int main(void)
-+{
-+  foo();
-+  return 0;
-+}
-diff --git a/ld/testsuite/ld-plugin/lto-4b.c b/ld/testsuite/ld-plugin/lto-4b.c
-new file mode 100644
-index 00000000000..bb4a68bb986
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-4b.c
-@@ -0,0 +1,9 @@
-+#include <stdio.h>
-+
-+extern void bar (void);
-+
-+void foo(void)
-+{
-+  bar ();
-+  printf ("hello foo\n");
-+}
-diff --git a/ld/testsuite/ld-plugin/lto-4c.c b/ld/testsuite/ld-plugin/lto-4c.c
-new file mode 100644
-index 00000000000..317e6fcdacd
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-4c.c
-@@ -0,0 +1,6 @@
-+#include <stdio.h>
-+
-+void bar (void)
-+{
-+  printf ("hello bar\n");
-+}
-diff --git a/ld/testsuite/ld-plugin/lto-4r-a.d b/ld/testsuite/ld-plugin/lto-4r-a.d
-new file mode 100644
-index 00000000000..c618cffb028
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-4r-a.d
-@@ -0,0 +1,7 @@
-+#ld: -r tmpdir/lto-4a.o tmpdir/lto-4b.o tmpdir/lto-4c.o
-+#source: dummy.s
-+#objdump: -h
-+
-+#...
-+.* .gnu_object_only.*
-+#pass
-diff --git a/ld/testsuite/ld-plugin/lto-4r-b.d b/ld/testsuite/ld-plugin/lto-4r-b.d
-new file mode 100644
-index 00000000000..07d71cb5328
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-4r-b.d
-@@ -0,0 +1,7 @@
-+#ld: -r tmpdir/lto-4a.o tmpdir/lto-4b.o
-+#source: dummy.s
-+#objdump: -h
-+
-+#...
-+.* .gnu_object_only.*
-+#pass
-diff --git a/ld/testsuite/ld-plugin/lto-4r-c.d b/ld/testsuite/ld-plugin/lto-4r-c.d
-new file mode 100644
-index 00000000000..4e691ea01ac
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-4r-c.d
-@@ -0,0 +1,7 @@
-+#ld: -r tmpdir/lto-4r-b.o tmpdir/lto-4c.o --no-warn-execstack --no-error-execstack
-+#source: dummy.s
-+#objdump: -h
-+
-+#...
-+.* .gnu_object_only.*
-+#pass
-diff --git a/ld/testsuite/ld-plugin/lto-4r-d.d b/ld/testsuite/ld-plugin/lto-4r-d.d
-new file mode 100644
-index 00000000000..d4c58526cc5
---- /dev/null
-+++ b/ld/testsuite/ld-plugin/lto-4r-d.d
-@@ -0,0 +1,7 @@
-+#ld: -r --whole-archive tmpdir/liblto-4.a
-+#source: dummy.s
-+#objdump: -h
-+
-+#...
-+.* .gnu_object_only.*
-+#pass
-diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
-index e36480aee78..e454b485ed9 100644
---- a/ld/testsuite/ld-plugin/lto.exp
-+++ b/ld/testsuite/ld-plugin/lto.exp
-@@ -72,6 +72,15 @@ set lto_link_tests [list \
-   [list "Build liblto-3.a" \
-    "" "-flto $lto_fat" \
-    {lto-3b.c} {} "liblto-3.a"] \
-+  [list "Compile 4a" \
-+   "" "-flto $lto_fat" \
-+   {lto-4a.c} {} ""] \
-+  [list "Compile 4b" \
-+   "" "-O2" \
-+   {lto-4b.c} {} ""] \
-+  [list "Compile 4c" \
-+   "" "-O2" \
-+   {lto-4c.c} {} ""] \
-   [list "Compile 5a" \
-    "" "-flto $lto_fat" \
-    {lto-5a.c} {} ""] \
-@@ -84,6 +93,12 @@ set lto_link_tests [list \
-   [list "Compile 9" \
-    "" "-O2 -finline -flto" \
-    {lto-9.cc} {} "" "c++"] \
-+  [list "Compile 10a" \
-+   "" "-O2" \
-+   {lto-10a.c} {} ""] \
-+  [list "Compile 10b" \
-+   "" "-O2 -flto $lto_fat" \
-+   {lto-10b.c} {} ""] \
-   [list "Compile 11a" \
-    "" "-O -flto" \
-    {lto-11a.c} {} ""] \
-@@ -711,9 +726,29 @@ set lto_run_tests [list \
-   [list "LTO 3c" \
-    "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o -Wl,--whole-archive tmpdir/liblto-3.a -Wl,--no-whole-archive tmpdir/liblto-3.a" "" \
-    {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"] \
-+  [list "LTO 4a" \
-+   "-O2 -flto -fuse-linker-plugin \
-+    -Wl,--no-warn-execstack,--no-error-execstack \
-+    tmpdir/lto-4r-a.o" "" \
-+   {dummy.c} "lto-4a.exe" "lto-4.out" "" "c"] \
-+  [list "LTO 4c" \
-+   "-O2 -flto -fuse-linker-plugin \
-+    -Wl,--no-warn-execstack,--no-error-execstack \
-+    tmpdir/lto-4r-c.o" "" \
-+   {dummy.c} "lto-4c.exe" "lto-4.out" "" "c"] \
-+  [list "LTO 4d" \
-+   "-O2 -flto -fuse-linker-plugin \
-+    -Wl,--no-warn-execstack,--no-error-execstack \
-+    tmpdir/lto-4r-d.o" "" \
-+   {dummy.c} "lto-4d.exe" "lto-4.out" "" "c"] \
-   [list "LTO 5" \
-    "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
-    {dummy.c} "lto-5.exe" "lto-5.out" "" "c"] \
-+  [list "LTO 10" \
-+   "-O2 -flto -fuse-linker-plugin \
-+    -Wl,--no-warn-execstack,--no-error-execstack \
-+    tmpdir/lto-10.o" "" \
-+   {dummy.c} "lto-10.exe" "lto-10.out" "" "c"] \
-   [list "LTO 11" \
-    "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" \
-    {dummy.c} "lto-11.exe" "lto-11.out" "" "c"] \
-@@ -979,6 +1014,15 @@ if [string match "" $exec_output] then {
-     fail "PR ld/28138 (build only)"
- }
- 
-+set testname "Build liblto-4.a"
-+remote_file host delete "tmpdir/liblto-4.a"
-+set catch_output [run_host_cmd "$ar" "rc tmpdir/liblto-4.a tmpdir/lto-4a.o tmpdir/lto-4b.o tmpdir/lto-4c.o"]
-+if {![string match "" $catch_output]} {
-+    unresolved $testname
-+    restore_notify
-+    return
-+}
-+
- set testname "Build liblto-11.a"
- remote_file host delete "tmpdir/liblto-11.a"
- set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
-@@ -1091,8 +1135,30 @@ if { [at_least_gcc_version 4 7] } {
- # Run "ld -r" to generate inputs for complex LTO tests.
- run_dump_test "lto-3r"
- remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o"
-+run_dump_test "lto-4r-a"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-a.o"
-+run_dump_test "lto-4r-b"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-b.o"
-+run_dump_test "lto-4r-c"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-c.o"
-+run_dump_test "lto-4r-d"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-d.o"
- run_dump_test "lto-5r"
- remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
-+run_dump_test "lto-10r"
-+remote_exec host "mv" "tmpdir/dump tmpdir/lto-10.o"
-+set testname "nm mixed object"
-+set lto_plugin [string trim [run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so"]]
-+if { [ regexp "liblto_plugin.so" $lto_plugin ] } {
-+    set exec_output [run_host_cmd "$NM" "--plugin $lto_plugin tmpdir/lto-10.o"]
-+    if { [ regexp "T main" $exec_output ] } {
-+	pass $testname
-+    } {
-+	fail $testname
-+    }
-+} {
-+    fail $testname
-+ }
- 
- run_cc_link_tests $lto_link_symbol_tests
- 
--- 
-2.48.0
-

diff --git a/9999/0007-ld-Document-mixing-LTO-and-non-LTO-objects-for-r.patch b/9999/0007-ld-Document-mixing-LTO-and-non-LTO-objects-for-r.patch
deleted file mode 100644
index 9c17dc9..0000000
--- a/9999/0007-ld-Document-mixing-LTO-and-non-LTO-objects-for-r.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 2c86c77dc5795a7f1e8f915c138c27893d8141d4 Mon Sep 17 00:00:00 2001
-Message-ID: <2c86c77dc5795a7f1e8f915c138c27893d8141d4.1736748624.git.sam@gentoo.org>
-In-Reply-To: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
-References: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Sat, 11 Jan 2025 07:23:27 +0800
-Subject: [PATCH 7/8] ld: Document mixing LTO and non-LTO objects for -r
-
-	* ld.texi: Document mixing LTO and non-LTO relocatable files for
-	"ld -r".
-
-Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
----
- ld/ld.texi | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/ld/ld.texi b/ld/ld.texi
-index da714a20855..d1787453f57 100644
---- a/ld/ld.texi
-+++ b/ld/ld.texi
-@@ -1126,6 +1126,18 @@ relocations.  Different output formats can have further restrictions; for
- example some @code{a.out}-based formats do not support partial linking
- with input files in other formats at all.
- 
-+On ELF platforms, when the relocatable output contains both contents
-+which require link-time optimization (LTO) and contents which don't
-+require LTO, a .gnu_object_only section will be created to contain a
-+relocatable object file, as if @samp{-r} is applied to all relocatable
-+inputs which don't require LTO.  When processing a relocatable input
-+with a .gnu_object_only section, the linker will extract the
-+.gnu_object_only section as a separate input.
-+
-+Note that since @samp{-r} groups some sections from different input files
-+together, there may be negative impacts on code size and locality in
-+final executable or shared library.
-+
- This option does the same thing as @samp{-i}.
- 
- @kindex -R @var{file}
--- 
-2.48.0
-

diff --git a/9999/0008-h8300-Handle-.gnu_object_only-section.patch b/9999/0008-h8300-Handle-.gnu_object_only-section.patch
deleted file mode 100644
index 1336250..0000000
--- a/9999/0008-h8300-Handle-.gnu_object_only-section.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From c5f942b863c660280535dac32586e64d45308550 Mon Sep 17 00:00:00 2001
-Message-ID: <c5f942b863c660280535dac32586e64d45308550.1736748624.git.sam@gentoo.org>
-In-Reply-To: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
-References: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Tue, 27 Oct 2020 06:39:59 -0700
-Subject: [PATCH 8/8] h8300: Handle .gnu_object_only section
-
-	PR ld/12291
-	PR ld/12430
-	PR ld/13298
-	* config/tc-h8300.c (h8300_elf_section): Handle .gnu_object_only
-	section.
----
- gas/config/tc-h8300.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
-index f8e54064166..105461da92b 100644
---- a/gas/config/tc-h8300.c
-+++ b/gas/config/tc-h8300.c
-@@ -146,8 +146,10 @@ pint (int arg ATTRIBUTE_UNUSED)
- static void
- h8300_elf_section (int push)
- {
--  static const char * known_data_sections [] = { ".rodata", ".tdata", ".tbss" };
--  static const char * known_data_prefixes [] = { ".debug", ".zdebug", ".gnu.warning" };
-+  static const char * known_data_sections []
-+    = { ".rodata", ".tdata", ".tbss", ".gnu_object_only" };
-+  static const char * known_data_prefixes []
-+    = { ".debug", ".zdebug", ".gnu.warning" };
-   char * saved_ilp = input_line_pointer;
-   const char * name;
- 
--- 
-2.48.0
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-01-13  6:11 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-01-13  6:11 UTC (permalink / raw
  To: gentoo-commits

commit:     f46bcb376cd5e2a21d6fb9cbf98bcf02c666927c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 13 06:10:39 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 13 06:11:29 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=f46bcb37

9999: add H.J.'s LTO patches

This is needed for -ffat-lto-objects to work well. We are hoping
this will land in 2.44. Add it in binutils-patches for now to give it
some early testing for live.

Link: https://inbox.sourceware.org/binutils/20250112220244.597636-1-hjl.tools <AT> gmail.com/
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-LTO-and-none-LTO-output-support-for-ld-r.patch | 2928 ++++++++++++++++++++
 ...ment-mixing-LTO-and-non-LTO-objects-for-r.patch |   42 +
 ...008-h8300-Handle-.gnu_object_only-section.patch |   37 +
 3 files changed, 3007 insertions(+)

diff --git a/9999/0006-ld-Add-LTO-and-none-LTO-output-support-for-ld-r.patch b/9999/0006-ld-Add-LTO-and-none-LTO-output-support-for-ld-r.patch
new file mode 100644
index 0000000..b26d48f
--- /dev/null
+++ b/9999/0006-ld-Add-LTO-and-none-LTO-output-support-for-ld-r.patch
@@ -0,0 +1,2928 @@
+From 9f57274faacf1dbb6c2b56d29de150b5e79ecb3d Mon Sep 17 00:00:00 2001
+Message-ID: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 4 Nov 2013 09:17:45 -0800
+Subject: [PATCH 6/8] ld: Add LTO and none-LTO output support for ld -r
+
+Link with mixed IR/non-IR objects
+
+* 2 kinds of object files
+  o non-IR object file has
+    * non-IR sections
+  o IR object file has
+    * IR sections
+    * non-IR sections
+    * The output of "ld -r" with mixed IR/non-IR objects should work with:
+        o Compilers/linkers with IR support.
+	o Compilers/linkers without IR support.
+* Add the mixed object file which has
+  o IR sections
+  o non-IR sections:
+    * Object codes from IR sections.
+    * Object codes from non-IR object files.
+  o Object-only section:
+    * With section name ".gnu_object_only" and SHT_GNU_OBJECT_ONLY type
+    on ELF:
+    https://gitlab.com/x86-psABIs/Linux-ABI
+    #define SHT_GNU_OBJECT_ONLY 0x6ffffff8	/* Object only */
+    * Contain non-IR object file.
+    * Input is discarded after link.
+* Linker action:
+  o Classify each input object file:
+    * If there is a ".gnu_object_only" section, it is a mixed object file.
+    * If there is a IR section, it is an IR object file.
+    * Otherwise, it is a non-IR object file.
+  o Relocatable non-IR link:
+    * Prepare for an object-only output.
+    * Prepare for a regular output.
+    * For each mixed object file:
+      * Add IR and non-IR sections to the regular output.
+      * For object-only section:
+	* Extract object only file.
+	* Add it to the object-only output.
+	* Discard object-only section.
+    * For each IR object file:
+      * Add IR and non-IR sections to the regular output.
+    * For each non-IR object file:
+      * Add non-IR sections to the regular output.
+      * Add non-IR sections to the object-only output.
+    * Final output:
+      * If there are IR objects, non-IR objects and the object-only
+      output isn't empty:
+	* Put the object-only output into the object-only section.
+	* Add the object-only section to the regular output.
+	* Remove the object-only output.
+  o Normal link and relocatable IR link:
+    * Prepare for output.
+    * IR link:
+      * For each mixed object file:
+	* Compile and add IR sections to the output.
+	* Discard non-IR sections.
+	* Object-only section:
+	  * Extract object only file.
+	  * Add it to the output.
+	  * Discard object-only section.
+      * For each IR object file:
+        * Compile and add IR sections to the output.
+	* Discard non-IR sections.
+      * For each non-IR object file:
+	* Add non-IR sections to the output.
+    * Non-IR link:
+      * For each mixed object file:
+	* Add non-IR sections to the output.
+	* Discard IR sections and object-only section.
+      * For each IR object file:
+	* Add non-IR sections to the output.
+	* Discard IR sections.
+      * For each non-IR object file:
+	* Add non-IR sections to the output.
+
+This is useful for Linux kernel build with LTO.
+
+bfd/
+
+	PR ld/12291
+	PR ld/12430
+	PR ld/13298
+	* bfd.c (bfd_lto_object_type): Add lto_mixed_object.
+	(bfd): Add object_only_section.
+	(bfd_group_signature): New.
+	* elf.c (special_sections_g): Add .gnu_object_only.
+	* format.c: Include "plugin-api.h" and "plugin.h" if
+	BFD_SUPPORTS_PLUGINS is defined.
+	(bfd_set_lto_type): Set type to lto_mixed_object for
+	GNU_OBJECT_ONLY_SECTION_NAME section.
+	(bfd_check_format_matches): Don't check the plugin target twice
+	if the plugin target is explicitly specified.
+	* opncls.c (bfd_extract_object_only_section): New.
+	* plugin.c (bfd_plugin_fake_text_section): New.
+	(bfd_plugin_fake_data_section): Likewise.
+	(bfd_plugin_fake_bss_section): Likewise.
+	(bfd_plugin_fake_common_section): Likewise.
+	(bfd_plugin_get_symbols_in_object_only): Likewise.
+	* plugin.c (add_symbols): Call
+	bfd_plugin_get_symbols_in_object_only and count
+	plugin_data->object_only_nsyms.
+	(bfd_plugin_get_symtab_upper_bound): Count
+	plugin_data->object_only_nsyms.
+	bfd_plugin_get_symbols_in_object_only and add symbols from
+	object only section.
+	(bfd_plugin_canonicalize_symtab): Remove fake_section,
+	fake_data_section, fake_bss_section and fake_common_section.
+	Set udata.p to NULL.  Use bfd_plugin_fake_text_section,
+	bfd_plugin_fake_data_section, bfd_plugin_fake_bss_section and
+	bfd_plugin_fake_common_section.
+	Set udata.p to NULL.
+	* plugin.h (plugin_data_struct): Add object_only_nsyms and
+	object_only_syms.
+	* section.c (GNU_OBJECT_ONLY_SECTION_NAME): New.
+	* bfd-in2.h: Regenerated.
+
+binutils/
+
+	PR ld/12291
+	PR ld/12430
+	PR ld/13298
+	* objcopy.c (group_signature): Removed.
+	(is_strip_section): Replace group_signature with
+	bfd_group_signature.
+	(setup_section): Likewise.
+	* readelf.c (get_os_specific_section_type_name): Handle
+	SHT_GNU_OBJECT_ONLY.
+
+gas/
+
+	PR ld/12291
+	PR ld/12430
+	PR ld/13298
+	* testsuite/gas/elf/section9.s: Add the .gnu_object_only test.
+	* testsuite/gas/elf/section9.d: Updated.
+
+include/
+
+	PR ld/12291
+	PR ld/12430
+	PR ld/13298
+	* elf/common.h (SHT_GNU_OBJECT_ONLY): New.
+
+ld/
+
+	PR ld/12291
+	PR ld/12430
+	PR ld/13298
+	* ld.h (ld_config_type): Add emit_gnu_object_only and
+	emitting_gnu_object_only.
+	* ldelf.c (orphan_init_done): Make it file scope.
+	(ldelf_place_orphan): Rename hold to orig_hold.  Initialize hold
+	from orig_hold at run-time.
+	(ldelf_finish): New.
+	* ldelf.h (ldelf_finish): New.
+	* ldexp.c (ldexp_init): Take a bfd_boolean argument to supprt
+	object-only output.
+	(ldexp_finish): Likewise.
+	* ldexp.h (ldexp_init): Take a bfd_boolean argument.
+	(ldexp_finish): Likewise.
+	* ldfile.c (ldfile_try_open_bfd): Call
+	cmdline_check_object_only_section.
+	* ldlang.c: Include "ldwrite.h" and elf-bfd.h.
+	* ldlang.c (cmdline_object_only_file_list): New.
+	(cmdline_object_only_archive_list): Likewise.
+	(cmdline_temp_object_only_list): Likewise.
+	(cmdline_lists_init): Likewise.
+	(cmdline_list_new): Likewise.
+	(cmdline_list_append): Likewise.
+	(print_cmdline_list): Likewise.
+	(cmdline_on_object_only_archive_list_p): Likewise.
+	(cmdline_object_only_list_append): Likewise.
+	(cmdline_get_object_only_input_files): Likewise.
+	(cmdline_arg): Likewise.
+	(setup_section): Likewise.
+	(copy_section): Likewise.
+	(cmdline_fopen_temp): Likewise.
+	(cmdline_add_object_only_section): Likewise.
+	(cmdline_emit_object_only_section): Likewise.
+	(cmdline_extract_object_only_section): Likewise.
+	(cmdline_check_object_only_section): Likewise.
+	(cmdline_remove_object_only_files): Likewise.
+	(lang_init): Take a bfd_boolean argument to supprt object-only
+	output.  Call cmdline_lists_init.
+	(load_symbols): Call cmdline_on_object_only_archive_list_p
+	to check if an archive member should be loaded.
+	(lang_process): Handle object-only link.
+	* ldlang.h (lang_init): Take a bfd_boolean argument.
+	(cmdline_enum_type): New.
+	(cmdline_header_type): Likewise.
+	(cmdline_file_type): Likewise.
+	(cmdline_bfd_type): Likewise.
+	(cmdline_union_type): Likewise.
+	(cmdline_list_type): Likewise.
+	(cmdline_emit_object_only_section): Likewise.
+	(cmdline_check_object_only_section): Likewise.
+	(cmdline_remove_object_only_files): Likewise.
+	* ldmain.c (main): Call xatexit with
+	cmdline_remove_object_only_files.  Pass FALSE to lang_init,
+	ldexp_init and ldexp_finish.  Use ld_parse_linker_script.
+	Set link_info.output_bfd to NULL after close.  Call
+	cmdline_emit_object_only_section if needed.
+	(add_archive_element): Call cmdline_check_object_only_section.
+	(ld_parse_linker_script): New.
+	* ldmain.h (ld_parse_linker_script): New.
+	* plugin.c (plugin_maybe_claim): Call
+	cmdline_check_object_only_section on claimed IR files.
+	* scripttempl/elf.sc: Also discard .gnu_object_only sections.
+	* scripttempl/elf64hppa.sc: Likewise.
+	* scripttempl/elfxtensa.sc: Likewise.
+	* scripttempl/mep.sc: Likewise.
+	* scripttempl/pe.sc: Likewise.
+	* scripttempl/pep.sc: Likewise.
+	* emultempl/aarch64elf.em (gld${EMULATION_NAME}_finish): Replace
+	finish_default with ldelf_finish.
+	* emultempl/alphaelf.em (alpha_finish): Likewise.
+	* emultempl/avrelf.em (avr_finish): Likewise.
+	* emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise.
+	* emultempl/ppc32elf.em (ppc_finish): Likewise.
+	* emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Likewise.
+	* emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Likewise.
+	* testsuite/ld-plugin/lto-10.out: New file.
+	* testsuite/ld-plugin/lto-10a.c: Likewise.
+	* testsuite/ld-plugin/lto-10b.c: Likewise.
+	* testsuite/ld-plugin/lto-10r.d: Likewise.
+	* testsuite/ld-plugin/lto-4.out: Likewise.
+	* testsuite/ld-plugin/lto-4a.c: Likewise.
+	* testsuite/ld-plugin/lto-4b.c: Likewise.
+	* testsuite/ld-plugin/lto-4c.c: Likewise.
+	* testsuite/ld-plugin/lto-4r-a.d: Likewise.
+	* testsuite/ld-plugin/lto-4r-b.d: Likewise.
+	* testsuite/ld-plugin/lto-4r-c.d: Likewise.
+	* testsuite/ld-plugin/lto-4r-d.d: Likewise.
+	* testsuite/ld-plugin/lto.exp (lto_link_tests): Prepare for
+	"LTO 4[acd]", "lto-4r-[abcd]" and "LTO 10" tests.
+	(lto_run_tests): Add "LTO 4[acd]" and "LTO 10" tests.
+	Build liblto-4.a.  Run "lto-4r-[abcd]" tests.
+	Run lto-10r and create tmpdir/lto-10.o.
+	Add test for nm on mixed LTO/non-LTO object.
+
+Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
+---
+ bfd/bfd-in2.h                     |   16 +-
+ bfd/bfd.c                         |   46 +-
+ bfd/elf.c                         |    1 +
+ bfd/format.c                      |   37 +-
+ bfd/opncls.c                      |   66 ++
+ bfd/plugin.c                      |  193 +++++-
+ bfd/plugin.h                      |    2 +
+ bfd/section.c                     |    3 +
+ binutils/objcopy.c                |   32 +-
+ binutils/readelf.c                |    1 +
+ gas/testsuite/gas/elf/section9.d  |    1 +
+ gas/testsuite/gas/elf/section9.s  |    2 +
+ include/elf/common.h              |    1 +
+ ld/emultempl/aarch64elf.em        |    2 +-
+ ld/emultempl/alphaelf.em          |    2 +-
+ ld/emultempl/armelf.em            |    2 +-
+ ld/emultempl/avrelf.em            |    2 +-
+ ld/emultempl/elf.em               |    1 +
+ ld/emultempl/ppc32elf.em          |    2 +-
+ ld/emultempl/ppc64elf.em          |    2 +-
+ ld/emultempl/spuelf.em            |    2 +-
+ ld/ld.h                           |    6 +
+ ld/ldelf.c                        |   26 +-
+ ld/ldelf.h                        |    1 +
+ ld/ldexp.c                        |   16 +-
+ ld/ldexp.h                        |    4 +-
+ ld/ldfile.c                       |    2 +
+ ld/ldlang.c                       | 1027 ++++++++++++++++++++++++++++-
+ ld/ldlang.h                       |   44 +-
+ ld/ldmain.c                       |   80 ++-
+ ld/ldmain.h                       |    2 +
+ ld/plugin.c                       |    3 +
+ ld/scripttempl/elf.sc             |    2 +-
+ ld/scripttempl/elf64hppa.sc       |    2 +-
+ ld/scripttempl/elfxtensa.sc       |    2 +-
+ ld/scripttempl/mep.sc             |    2 +-
+ ld/scripttempl/pe.sc              |    1 +
+ ld/scripttempl/pep.sc             |    1 +
+ ld/testsuite/ld-plugin/lto-10.out |    1 +
+ ld/testsuite/ld-plugin/lto-10a.c  |    6 +
+ ld/testsuite/ld-plugin/lto-10b.c  |    7 +
+ ld/testsuite/ld-plugin/lto-10r.d  |    9 +
+ ld/testsuite/ld-plugin/lto-4.out  |    2 +
+ ld/testsuite/ld-plugin/lto-4a.c   |    7 +
+ ld/testsuite/ld-plugin/lto-4b.c   |    9 +
+ ld/testsuite/ld-plugin/lto-4c.c   |    6 +
+ ld/testsuite/ld-plugin/lto-4r-a.d |    7 +
+ ld/testsuite/ld-plugin/lto-4r-b.d |    7 +
+ ld/testsuite/ld-plugin/lto-4r-c.d |    7 +
+ ld/testsuite/ld-plugin/lto-4r-d.d |    7 +
+ ld/testsuite/ld-plugin/lto.exp    |   66 ++
+ 51 files changed, 1653 insertions(+), 125 deletions(-)
+ create mode 100644 ld/testsuite/ld-plugin/lto-10.out
+ create mode 100644 ld/testsuite/ld-plugin/lto-10a.c
+ create mode 100644 ld/testsuite/ld-plugin/lto-10b.c
+ create mode 100644 ld/testsuite/ld-plugin/lto-10r.d
+ create mode 100644 ld/testsuite/ld-plugin/lto-4.out
+ create mode 100644 ld/testsuite/ld-plugin/lto-4a.c
+ create mode 100644 ld/testsuite/ld-plugin/lto-4b.c
+ create mode 100644 ld/testsuite/ld-plugin/lto-4c.c
+ create mode 100644 ld/testsuite/ld-plugin/lto-4r-a.d
+ create mode 100644 ld/testsuite/ld-plugin/lto-4r-b.d
+ create mode 100644 ld/testsuite/ld-plugin/lto-4r-c.d
+ create mode 100644 ld/testsuite/ld-plugin/lto-4r-d.d
+
+diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
+index 3a5a6dd8a5f..1b82b6bcc99 100644
+--- a/bfd/bfd-in2.h
++++ b/bfd/bfd-in2.h
+@@ -925,6 +925,9 @@ extern asection _bfd_std_section[4];
+ #define BFD_COM_SECTION_NAME "*COM*"
+ #define BFD_IND_SECTION_NAME "*IND*"
+ 
++/* GNU object-only section name.  */
++#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
++
+ /* Pointer to the common section.  */
+ #define bfd_com_section_ptr (&_bfd_std_section[0])
+ /* Pointer to the undefined section.  */
+@@ -1962,7 +1965,8 @@ enum bfd_lto_object_type
+     lto_non_object,            /* Not an LTO object.  */
+     lto_non_ir_object,         /* An object without LTO IR.  */
+     lto_slim_ir_object,        /* A slim LTO IR object.  */
+-    lto_fat_ir_object          /* A fat LTO IR object.  */
++    lto_fat_ir_object,         /* A fat LTO IR object.  */
++    lto_mixed_object           /* A mixed LTO IR object.  */
+   };
+ 
+ struct bfd_mmapped_entry
+@@ -2185,7 +2189,7 @@ struct bfd
+   unsigned int read_only : 1;
+ 
+   /* LTO object type.  */
+-  ENUM_BITFIELD (bfd_lto_object_type) lto_type : 2;
++  ENUM_BITFIELD (bfd_lto_object_type) lto_type : 3;
+ 
+   /* Set if this BFD is currently being processed by
+      bfd_check_format_matches.  This is checked by the cache to
+@@ -2217,6 +2221,9 @@ struct bfd
+   /* The last section on the section list.  */
+   struct bfd_section *section_last;
+ 
++  /* The object-only section on the section list.  */
++  struct bfd_section *object_only_section;
++
+   /* The number of sections.  */
+   unsigned int section_count;
+ 
+@@ -2790,6 +2797,8 @@ bfd_vma bfd_emul_get_commonpagesize (const char *);
+ 
+ char *bfd_demangle (bfd *, const char *, int);
+ 
++asymbol *bfd_group_signature (asection *group, asymbol **isympp);
++
+ /* Extracted from bfdio.c.  */
+ bfd_size_type bfd_read (void *, bfd_size_type, bfd *)
+ ATTRIBUTE_WARN_UNUSED_RESULT;
+@@ -3073,6 +3082,9 @@ char *bfd_follow_build_id_debuglink (bfd *abfd, const char *dir);
+ 
+ const char *bfd_set_filename (bfd *abfd, const char *filename);
+ 
++const char *bfd_extract_object_only_section
++   (bfd *abfd);
++
+ /* Extracted from reloc.c.  */
+ typedef enum bfd_reloc_status
+ {
+diff --git a/bfd/bfd.c b/bfd/bfd.c
+index 194f24179fd..a8d1314b83f 100644
+--- a/bfd/bfd.c
++++ b/bfd/bfd.c
+@@ -80,7 +80,8 @@ EXTERNAL
+ .    lto_non_object,		{* Not an LTO object.  *}
+ .    lto_non_ir_object,		{* An object without LTO IR.  *}
+ .    lto_slim_ir_object,	{* A slim LTO IR object.  *}
+-.    lto_fat_ir_object		{* A fat LTO IR object.  *}
++.    lto_fat_ir_object,		{* A fat LTO IR object.  *}
++.    lto_mixed_object		{* A mixed LTO IR object.  *}
+ .  };
+ .
+ .struct bfd_mmapped_entry
+@@ -306,7 +307,7 @@ CODE_FRAGMENT
+ .  unsigned int read_only : 1;
+ .
+ .  {* LTO object type.  *}
+-.  ENUM_BITFIELD (bfd_lto_object_type) lto_type : 2;
++.  ENUM_BITFIELD (bfd_lto_object_type) lto_type : 3;
+ .
+ .  {* Set if this BFD is currently being processed by
+ .     bfd_check_format_matches.  This is checked by the cache to
+@@ -338,6 +339,9 @@ CODE_FRAGMENT
+ .  {* The last section on the section list.  *}
+ .  struct bfd_section *section_last;
+ .
++.  {* The object-only section on the section list.  *}
++.  struct bfd_section *object_only_section;
++.
+ .  {* The number of sections.  *}
+ .  unsigned int section_count;
+ .
+@@ -3034,3 +3038,41 @@ _bfd_get_link_info (bfd *abfd)
+ 
+   return elf_link_info (abfd);
+ }
++
++/*
++FUNCTION
++	bfd_group_signature
++
++SYNOPSIS
++	asymbol *bfd_group_signature (asection *group, asymbol **isympp);
++
++DESCRIPTION
++	Return a pointer to the symbol used as a signature for GROUP.
++*/
++
++asymbol *
++bfd_group_signature (asection *group, asymbol **isympp)
++{
++  bfd *abfd = group->owner;
++  Elf_Internal_Shdr *ghdr;
++
++  /* PR 20089: An earlier error may have prevented us from loading the
++     symbol table.  */
++  if (isympp == NULL)
++    return NULL;
++
++  if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
++    return NULL;
++
++  ghdr = &elf_section_data (group)->this_hdr;
++  if (ghdr->sh_link == elf_onesymtab (abfd))
++    {
++      const struct elf_backend_data *bed = get_elf_backend_data (abfd);
++      Elf_Internal_Shdr *symhdr = &elf_symtab_hdr (abfd);
++
++      if (ghdr->sh_info > 0
++	  && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
++	return isympp[ghdr->sh_info - 1];
++    }
++  return NULL;
++}
+diff --git a/bfd/elf.c b/bfd/elf.c
+index 218d58df8be..30bbdc662af 100644
+--- a/bfd/elf.c
++++ b/bfd/elf.c
+@@ -3014,6 +3014,7 @@ static const struct bfd_elf_special_section special_sections_g[] =
+   { STRING_COMMA_LEN (".gnu.linkonce.p"), -2, SHT_PROGBITS,    SHF_ALLOC + SHF_WRITE },
+   { STRING_COMMA_LEN (".gnu.lto_"),	  -1, SHT_PROGBITS,    SHF_EXCLUDE },
+   { STRING_COMMA_LEN (".got"),		   0, SHT_PROGBITS,    SHF_ALLOC + SHF_WRITE },
++  { STRING_COMMA_LEN (".gnu_object_only"), 0, SHT_GNU_OBJECT_ONLY, SHF_EXCLUDE },
+   { STRING_COMMA_LEN (".gnu.version"),	   0, SHT_GNU_versym,  0 },
+   { STRING_COMMA_LEN (".gnu.version_d"),   0, SHT_GNU_verdef,  0 },
+   { STRING_COMMA_LEN (".gnu.version_r"),   0, SHT_GNU_verneed, 0 },
+diff --git a/bfd/format.c b/bfd/format.c
+index 125815935f6..7769ad095f6 100644
+--- a/bfd/format.c
++++ b/bfd/format.c
+@@ -46,6 +46,10 @@ SUBSECTION
+ #include "sysdep.h"
+ #include "bfd.h"
+ #include "libbfd.h"
++#if BFD_SUPPORTS_PLUGINS
++#include "plugin-api.h"
++#include "plugin.h"
++#endif
+ 
+ /* IMPORT from targets.c.  */
+ extern const size_t _bfd_target_vector_entries;
+@@ -349,23 +353,32 @@ bfd_set_lto_type (bfd *abfd ATTRIBUTE_UNUSED)
+ #if BFD_SUPPORTS_PLUGINS
+   if (abfd->format == bfd_object
+       && abfd->lto_type == lto_non_object
+-      && (abfd->flags & (DYNAMIC | EXEC_P)) == 0)
++      && (abfd->flags
++	  & (DYNAMIC
++	     | (bfd_get_flavour (abfd) == bfd_target_elf_flavour
++		? EXEC_P : 0))) == 0)
+     {
+       asection *sec;
+       enum bfd_lto_object_type type = lto_non_ir_object;
+-      struct lto_section lsection;
++      struct lto_section lsection = { 0, 0, 0, 0 };
+       /* GCC uses .gnu.lto_.lto.<some_hash> as a LTO bytecode information
+ 	 section.  */
+       for (sec = abfd->sections; sec != NULL; sec = sec->next)
+-	if (startswith (sec->name, ".gnu.lto_.lto.")
+-	    && bfd_get_section_contents (abfd, sec, &lsection, 0,
+-					 sizeof (struct lto_section)))
++	if (strcmp (sec->name, GNU_OBJECT_ONLY_SECTION_NAME) == 0)
++	  {
++	    type = lto_mixed_object;
++	    abfd->object_only_section = sec;
++	    break;
++	  }
++	else if (lsection.major_version == 0
++		 && startswith (sec->name, ".gnu.lto_.lto.")
++		 && bfd_get_section_contents (abfd, sec, &lsection, 0,
++					      sizeof (struct lto_section)))
+ 	  {
+ 	    if (lsection.slim_object)
+ 	      type = lto_slim_ir_object;
+ 	    else
+ 	      type = lto_fat_ir_object;
+-	    break;
+ 	  }
+ 
+       abfd->lto_type = type;
+@@ -397,9 +410,6 @@ bool
+ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
+ {
+   extern const bfd_target binary_vec;
+-#if BFD_SUPPORTS_PLUGINS
+-  extern const bfd_target plugin_vec;
+-#endif
+   const bfd_target * const *target;
+   const bfd_target **matching_vector = NULL;
+   const bfd_target *save_targ, *right_targ, *ar_right_targ, *match_targ;
+@@ -507,11 +517,18 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
+ 	 check the default target twice.  */
+       if (*target == &binary_vec
+ #if BFD_SUPPORTS_PLUGINS
+-	  || (match_count != 0 && *target == &plugin_vec)
++	  || (match_count != 0 && bfd_plugin_target_p (*target))
+ #endif
+ 	  || (!abfd->target_defaulted && *target == save_targ))
+ 	continue;
+ 
++#if BFD_SUPPORTS_PLUGINS
++      /* If the plugin target is explicitly specified when a BFD file
++	 is opened, don't check it twice.  */
++      if (bfd_plugin_specified_p () && bfd_plugin_target_p (*target))
++	continue;
++#endif
++
+       /* If we already tried a match, the bfd is modified and may
+ 	 have sections attached, which will confuse the next
+ 	 _bfd_check_format call.  */
+diff --git a/bfd/opncls.c b/bfd/opncls.c
+index 93adbf117f0..ca7dbf23aa6 100644
+--- a/bfd/opncls.c
++++ b/bfd/opncls.c
+@@ -2054,3 +2054,69 @@ bfd_set_filename (bfd *abfd, const char *filename)
+ 
+   return n;
+ }
++
++/*
++FUNCTION
++	bfd_extract_object_only_section
++
++SYNOPSIS
++	const char *bfd_extract_object_only_section
++	  (bfd *abfd);
++
++DESCRIPTION
++
++	Takes a @var{ABFD} and extract the .gnu_object_only section into
++	a temporary file.
++
++RETURNS
++	The name of the temporary file is returned if all is ok.
++	Otherwise <<NULL>> is returned and bfd_error is set.
++*/
++
++const char *
++bfd_extract_object_only_section (bfd *abfd)
++{
++  asection *sec = abfd->object_only_section;
++  const char *name;
++  FILE *file;
++  bfd_byte *memhunk = NULL;
++  size_t off, size;
++  bfd_error_type err;
++
++  /* Get a temporary object-only file.  */
++  name = make_temp_file (".obj-only.o");
++
++  /* Open the object-only file.  */
++  file = _bfd_real_fopen (name, FOPEN_WB);
++  if (!bfd_get_full_section_contents (abfd, sec, &memhunk))
++    {
++      err = bfd_get_error ();
++
++loser:
++      free (memhunk);
++      fclose (file);
++      unlink (name);
++      bfd_set_error (err);
++      return NULL;
++    }
++
++  off = 0;
++  size = sec->size;
++  while (off != size)
++    {
++      size_t written, nwrite = size - off;
++
++      written = fwrite (memhunk + off, 1, nwrite, file);
++      if (written < nwrite && ferror (file))
++	{
++	  err = bfd_error_system_call;
++	  goto loser;
++	}
++
++      off += written;
++    }
++
++  free (memhunk);
++  fclose (file);
++  return name;
++}
+diff --git a/bfd/plugin.c b/bfd/plugin.c
+index 67454adffb9..d57ae593e78 100644
+--- a/bfd/plugin.c
++++ b/bfd/plugin.c
+@@ -160,6 +160,158 @@ register_claim_file (ld_plugin_claim_file_handler handler)
+   return LDPS_OK;
+ }
+ 
++static asection bfd_plugin_fake_text_section
++  = BFD_FAKE_SECTION (bfd_plugin_fake_text_section, NULL, "plug", 0,
++		      SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS);
++static asection bfd_plugin_fake_data_section
++  = BFD_FAKE_SECTION (bfd_plugin_fake_data_section, NULL, "plug", 0,
++		      SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS);
++static asection bfd_plugin_fake_bss_section
++  = BFD_FAKE_SECTION (bfd_plugin_fake_bss_section, NULL, "plug", 0,
++		      SEC_ALLOC);
++static asection bfd_plugin_fake_common_section
++  = BFD_FAKE_SECTION (bfd_plugin_fake_common_section, NULL, NULL,
++		      0, SEC_IS_COMMON);
++
++/* Get symbols from object only section.  */
++
++static void
++bfd_plugin_get_symbols_in_object_only (bfd *abfd)
++{
++  struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
++  const char *object_only_file;
++  bfd *nbfd;
++  long storage;
++  long object_only_nsyms, added_nsyms, i;
++  asymbol **object_only_syms, **added_syms;
++
++  plugin_data->object_only_syms = NULL;
++  plugin_data->object_only_nsyms = 0;
++
++  if (abfd->sections == NULL && abfd->my_archive == NULL)
++    {
++      nbfd = bfd_openr (abfd->filename, NULL);
++      if (nbfd == NULL)
++	{
++	  (*_bfd_error_handler)
++	    (_("%s: failed to open to extract object only section: %s"),
++	     abfd->filename, bfd_errmsg (bfd_get_error ()));
++	  return;
++	}
++      else if (!bfd_check_format (nbfd, bfd_object))
++	{
++	  /* There is no object only section if it isn't a bfd_object
++	     file.  */
++	  bfd_close (nbfd);
++	  return;
++	}
++    }
++  else
++    {
++      if (!bfd_check_format (abfd, bfd_object))
++	{
++	  (*_bfd_error_handler)
++	    (_("%pB: invalid file to extract object only section: %s"),
++	     abfd, bfd_errmsg (bfd_get_error ()));
++	  return;
++	}
++      nbfd = abfd;
++    }
++
++  if (nbfd->lto_type == lto_mixed_object
++      && (nbfd->flags & HAS_SYMS) != 0)
++    {
++      object_only_file = bfd_extract_object_only_section (nbfd);
++      if (object_only_file == NULL)
++	(*_bfd_error_handler)
++	  (_("%pB: failed to extract object only section: %s"),
++	   abfd, bfd_errmsg (bfd_get_error ()));
++    }
++  else
++    object_only_file = NULL;
++
++  /* Close the new bfd we just opened.  */
++  if (nbfd != abfd)
++    bfd_close (nbfd);
++
++  /* Return if there is no object only section or there is no
++     symbol in object only section.  */
++  if (!object_only_file)
++    return;
++
++  /* Open the file containing object only section.  */
++  nbfd = bfd_openr (object_only_file, NULL);
++  if (!bfd_check_format (nbfd, bfd_object))
++    {
++      (*_bfd_error_handler)
++	(_("%pB: failed to open object only section: %s"),
++	 abfd, bfd_errmsg (bfd_get_error ()));
++      goto quit;
++    }
++
++  storage = bfd_get_symtab_upper_bound (nbfd);
++  if (storage <= 0)
++    {
++      if (storage < 0)
++	(*_bfd_error_handler)
++	  (_("%pB: failed to get symbol table in object only section: %s"),
++	   abfd, bfd_errmsg (bfd_get_error ()));
++
++      goto quit;
++    }
++
++  object_only_syms = (asymbol **) bfd_malloc (storage);
++  object_only_nsyms = bfd_canonicalize_symtab (nbfd, object_only_syms);
++
++  /* FIXME: We waste some spaces if not all symbols are copied.  */
++  added_syms = (asymbol **) bfd_alloc (abfd, storage);
++  added_nsyms = 0;
++
++  /* Copy only global symbols from object only section.  */
++  for (i = 0; i < object_only_nsyms; i++)
++    {
++      asection *sec = object_only_syms[i]->section;
++      flagword flags = object_only_syms[i]->flags;
++      asymbol *s;
++
++      if (bfd_is_com_section (sec))
++	sec = &bfd_plugin_fake_common_section;
++      else if (bfd_is_und_section (sec))
++	;
++      else if ((flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0)
++	{
++	  if ((sec->flags & SEC_CODE) != 0)
++	    sec = &bfd_plugin_fake_text_section;
++	  else if ((sec->flags & SEC_LOAD) != 0)
++	    sec = &bfd_plugin_fake_data_section;
++	  else
++	    sec = &bfd_plugin_fake_bss_section;
++	}
++      else
++	continue;
++
++      s = bfd_alloc (abfd, sizeof (asymbol));
++      BFD_ASSERT (s);
++      added_syms[added_nsyms++] = s;
++
++      s->section = sec;
++      s->the_bfd = abfd;
++      s->name = xstrdup (object_only_syms[i]->name);
++      s->value = 0;
++      s->flags = flags;
++      s->udata.p = NULL;
++    }
++
++  plugin_data->object_only_syms = added_syms;
++  plugin_data->object_only_nsyms = added_nsyms;
++
++  free (object_only_syms);
++
++quit:
++  /* Close and remove the object only section file.  */
++  bfd_close (nbfd);
++  unlink (object_only_file);
++}
+ 
+ /* Register a claim-file handler, version 2. */
+ 
+@@ -185,10 +337,13 @@ add_symbols (void * handle,
+   plugin_data->nsyms = nsyms;
+   plugin_data->syms = syms;
+ 
+-  if (nsyms != 0)
++  abfd->tdata.plugin_data = plugin_data;
++
++  bfd_plugin_get_symbols_in_object_only (abfd);
++
++  if ((nsyms + plugin_data->object_only_nsyms) != 0)
+     abfd->flags |= HAS_SYMS;
+ 
+-  abfd->tdata.plugin_data = plugin_data;
+   return LDPS_OK;
+ }
+ 
+@@ -678,7 +833,8 @@ static long
+ bfd_plugin_get_symtab_upper_bound (bfd *abfd)
+ {
+   struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
+-  long nsyms = plugin_data->nsyms;
++  /* Add symbols from object only section.  */
++  long nsyms = plugin_data->nsyms + plugin_data->object_only_nsyms;
+ 
+   BFD_ASSERT (nsyms >= 0);
+ 
+@@ -712,18 +868,7 @@ bfd_plugin_canonicalize_symtab (bfd *abfd,
+   struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
+   long nsyms = plugin_data->nsyms;
+   const struct ld_plugin_symbol *syms = plugin_data->syms;
+-  static asection fake_text_section
+-    = BFD_FAKE_SECTION (fake_text_section, NULL, "plug", 0,
+-			SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS);
+-  static asection fake_data_section
+-    = BFD_FAKE_SECTION (fake_data_section, NULL, "plug", 0,
+-			SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS);
+-  static asection fake_bss_section
+-    = BFD_FAKE_SECTION (fake_bss_section, NULL, "plug", 0,
+-			SEC_ALLOC);
+-  static asection fake_common_section
+-    = BFD_FAKE_SECTION (fake_common_section, NULL, "plug", 0, SEC_IS_COMMON);
+-  int i;
++  int i, j;
+ 
+   for (i = 0; i < nsyms; i++)
+     {
+@@ -736,10 +881,11 @@ bfd_plugin_canonicalize_symtab (bfd *abfd,
+       s->name = syms[i].name;
+       s->value = 0;
+       s->flags = convert_flags (&syms[i]);
++      s->udata.p = NULL;
+       switch (syms[i].def)
+ 	{
+ 	case LDPK_COMMON:
+-	  s->section = &fake_common_section;
++	  s->section = &bfd_plugin_fake_common_section;
+ 	  break;
+ 	case LDPK_UNDEF:
+ 	case LDPK_WEAKUNDEF:
+@@ -755,25 +901,28 @@ bfd_plugin_canonicalize_symtab (bfd *abfd,
+ 	      case LDST_UNKNOWN:
+ 		/* What is the best fake section for LDST_UNKNOWN?  */
+ 	      case LDST_FUNCTION:
+-		s->section = &fake_text_section;
++		s->section = &bfd_plugin_fake_text_section;
+ 		break;
+ 	      case LDST_VARIABLE:
+ 		if (syms[i].section_kind == LDSSK_BSS)
+-		  s->section = &fake_bss_section;
++		  s->section = &bfd_plugin_fake_bss_section;
+ 		else
+-		  s->section = &fake_data_section;
++		  s->section = &bfd_plugin_fake_data_section;
+ 		break;
+ 	      }
+ 	  else
+-	    s->section = &fake_text_section;
++	    s->section = &bfd_plugin_fake_text_section;
+ 	  break;
+ 	default:
+ 	  BFD_ASSERT (0);
+ 	}
+-
+-      s->udata.p = (void *) &syms[i];
+     }
+ 
++  /* Copy symbols from object only section.  */
++  nsyms += plugin_data->object_only_nsyms;
++  for (j = 0; j < plugin_data->object_only_nsyms; j++, i++)
++    alocation[i] = plugin_data->object_only_syms[j];
++
+   return nsyms;
+ }
+ 
+diff --git a/bfd/plugin.h b/bfd/plugin.h
+index 510689c96ba..f61e6168e2b 100644
+--- a/bfd/plugin.h
++++ b/bfd/plugin.h
+@@ -34,6 +34,8 @@ typedef struct plugin_data_struct
+ {
+   int nsyms;
+   const struct ld_plugin_symbol *syms;
++  int object_only_nsyms;
++  asymbol **object_only_syms;
+ }
+ plugin_data_struct;
+ 
+diff --git a/bfd/section.c b/bfd/section.c
+index 8456c73e8d0..e7674c9dc1a 100644
+--- a/bfd/section.c
++++ b/bfd/section.c
+@@ -661,6 +661,9 @@ EXTERNAL
+ .#define BFD_COM_SECTION_NAME "*COM*"
+ .#define BFD_IND_SECTION_NAME "*IND*"
+ .
++.{* GNU object-only section name.  *}
++.#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only"
++.
+ .{* Pointer to the common section.  *}
+ .#define bfd_com_section_ptr (&_bfd_std_section[0])
+ .{* Pointer to the undefined section.  *}
+diff --git a/binutils/objcopy.c b/binutils/objcopy.c
+index f64417697cb..e2e6bd7ee83 100644
+--- a/binutils/objcopy.c
++++ b/binutils/objcopy.c
+@@ -1266,34 +1266,6 @@ is_specified_symbol (const char *name, htab_t htab)
+   return htab_find (htab, name) != NULL;
+ }
+ 
+-/* Return a pointer to the symbol used as a signature for GROUP.  */
+-
+-static asymbol *
+-group_signature (asection *group)
+-{
+-  bfd *abfd = group->owner;
+-  Elf_Internal_Shdr *ghdr;
+-
+-  /* PR 20089: An earlier error may have prevented us from loading the symbol table.  */
+-  if (isympp == NULL)
+-    return NULL;
+-
+-  if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+-    return NULL;
+-
+-  ghdr = &elf_section_data (group)->this_hdr;
+-  if (ghdr->sh_link == elf_onesymtab (abfd))
+-    {
+-      const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+-      Elf_Internal_Shdr *symhdr = &elf_symtab_hdr (abfd);
+-
+-      if (ghdr->sh_info > 0
+-	  && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
+-	return isympp[ghdr->sh_info - 1];
+-    }
+-  return NULL;
+-}
+-
+ /* Return TRUE if the section is a DWO section.  */
+ 
+ static bool
+@@ -1438,7 +1410,7 @@ is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
+       const char *gname;
+       asection *elt, *first;
+ 
+-      gsym = group_signature (sec);
++      gsym = bfd_group_signature (sec, isympp);
+       /* Strip groups without a valid signature.  */
+       if (gsym == NULL)
+ 	return true;
+@@ -4398,7 +4370,7 @@ setup_section (bfd *ibfd, sec_ptr isection, bfd *obfd)
+ 
+   if ((isection->flags & SEC_GROUP) != 0)
+     {
+-      asymbol *gsym = group_signature (isection);
++      asymbol *gsym = bfd_group_signature (isection, isympp);
+ 
+       if (gsym != NULL)
+ 	{
+diff --git a/binutils/readelf.c b/binutils/readelf.c
+index 4f8f879cf91..949395483bb 100644
+--- a/binutils/readelf.c
++++ b/binutils/readelf.c
+@@ -5941,6 +5941,7 @@ get_os_specific_section_type_name (Filedata * filedata, unsigned int sh_type)
+     case SHT_GNU_ATTRIBUTES:          return "GNU_ATTRIBUTES";
+     case SHT_GNU_HASH:                return "GNU_HASH";
+     case SHT_GNU_LIBLIST:             return "GNU_LIBLIST";
++    case SHT_GNU_OBJECT_ONLY:	      return "GNU_OBJECT_ONLY";
+ 
+     case SHT_SUNW_move:               return "SUNW_MOVE";
+     case SHT_SUNW_COMDAT:             return "SUNW_COMDAT";
+diff --git a/gas/testsuite/gas/elf/section9.d b/gas/testsuite/gas/elf/section9.d
+index 63152fe4b4d..d7e97c014ac 100644
+--- a/gas/testsuite/gas/elf/section9.d
++++ b/gas/testsuite/gas/elf/section9.d
+@@ -4,4 +4,5 @@
+ #...
+ [ 	]*\[.*\][ 	]+\.gnu\.lto_main[ 	]+PROGBITS.*[ 	]+E[   ]+.*
+ [ 	]*\[.*\][ 	]+\.gnu\.lto_\.pureconst[ 	]+PROGBITS.*[ 	]+E[   ]+.*
++[ 	]*\[.*\][ 	]+\.gnu_object_only[ 	]+GNU_OBJECT_ONLY.*[ 	]+E[   ]+.*
+ #pass
+diff --git a/gas/testsuite/gas/elf/section9.s b/gas/testsuite/gas/elf/section9.s
+index 6b8b1074ca3..abcdea10aad 100644
+--- a/gas/testsuite/gas/elf/section9.s
++++ b/gas/testsuite/gas/elf/section9.s
+@@ -2,3 +2,5 @@
+ 	.byte 0,0,0,0
+ 	.section .gnu.lto_.pureconst,"",%progbits
+ 	.byte 0,0,0,0
++	.section .gnu_object_only
++	.byte 0,0,0,0
+diff --git a/include/elf/common.h b/include/elf/common.h
+index 6077db7a8b7..b0b54d87ab4 100644
+--- a/include/elf/common.h
++++ b/include/elf/common.h
+@@ -572,6 +572,7 @@
+ #define SHT_GNU_HASH	             0x6ffffff6	/* GNU style symbol hash table */
+ #define SHT_GNU_LIBLIST	             0x6ffffff7	/* List of prelink dependencies */
+ #define SHT_CHECKSUM	             0x6ffffff8	/* Checksum for DSO content.  */
++#define SHT_GNU_OBJECT_ONLY	     0x6ffffff9	/* Object only */
+ 
+ #define SHT_SUNW_move	             0x6ffffffa
+ #define SHT_SUNW_COMDAT              0x6ffffffb
+diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
+index faa0d3ecd79..ae79961ada1 100644
+--- a/ld/emultempl/aarch64elf.em
++++ b/ld/emultempl/aarch64elf.em
+@@ -309,7 +309,7 @@ gld${EMULATION_NAME}_finish (void)
+ 	}
+     }
+ 
+-  finish_default ();
++  ldelf_finish ();
+ }
+ 
+ /* This is a convenient point to tell BFD about target specific flags.
+diff --git a/ld/emultempl/alphaelf.em b/ld/emultempl/alphaelf.em
+index 6ecacb76a10..5ae2587a653 100644
+--- a/ld/emultempl/alphaelf.em
++++ b/ld/emultempl/alphaelf.em
+@@ -104,7 +104,7 @@ alpha_finish (void)
+   if (limit_32bit)
+     elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT;
+ 
+-  finish_default ();
++  ldelf_finish ();
+ }
+ EOF
+ 
+diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
+index dc2cd9f1139..02a97e7c1ff 100644
+--- a/ld/emultempl/armelf.em
++++ b/ld/emultempl/armelf.em
+@@ -456,7 +456,7 @@ gld${EMULATION_NAME}_finish (void)
+ 	}
+     }
+ 
+-  finish_default ();
++  ldelf_finish ();
+ 
+   if (params.thumb_entry_symbol)
+     {
+diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em
+index 7696a9050d9..0945702bfb6 100644
+--- a/ld/emultempl/avrelf.em
++++ b/ld/emultempl/avrelf.em
+@@ -227,7 +227,7 @@ avr_finish (void)
+ 	elf_elfheader (abfd)->e_flags &= ~EF_AVR_LINKRELAX_PREPARED;
+     }
+ 
+-  finish_default ();
++  ldelf_finish ();
+ }
+ EOF
+ 
+diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
+index 4d431995d2e..0bad25d3a46 100644
+--- a/ld/emultempl/elf.em
++++ b/ld/emultempl/elf.em
+@@ -1173,6 +1173,7 @@ LDEMUL_BEFORE_PLACE_ORPHANS=${LDEMUL_BEFORE_PLACE_ORPHANS-ldelf_before_place_orp
+ LDEMUL_AFTER_ALLOCATION=${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation}
+ LDEMUL_SET_OUTPUT_ARCH=${LDEMUL_SET_OUTPUT_ARCH-ldelf_set_output_arch}
+ LDEMUL_BEFORE_ALLOCATION=${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation}
++LDEMUL_FINISH=${LDEMUL_FINISH-ldelf_finish}
+ LDEMUL_OPEN_DYNAMIC_ARCHIVE=${LDEMUL_OPEN_DYNAMIC_ARCHIVE-ldelf_open_dynamic_archive}
+ LDEMUL_PLACE_ORPHAN=${LDEMUL_PLACE_ORPHAN-ldelf_place_orphan}
+ LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
+diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
+index acd673a7b84..529a5920920 100644
+--- a/ld/emultempl/ppc32elf.em
++++ b/ld/emultempl/ppc32elf.em
+@@ -238,7 +238,7 @@ ppc_finish (void)
+     lang_for_each_statement (no_zero_padding);
+   if (!ppc_finish_symbols (&link_info))
+     einfo (_("%X%P: ppc_finish_symbols problem %E\n"));
+-  finish_default ();
++  ldelf_finish ();
+ }
+ 
+ EOF
+diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
+index f9ace66a5b2..1e6ae7af738 100644
+--- a/ld/emultempl/ppc64elf.em
++++ b/ld/emultempl/ppc64elf.em
+@@ -616,7 +616,7 @@ gld${EMULATION_NAME}_finish (void)
+   fflush (stderr);
+   free (msg);
+ 
+-  finish_default ();
++  ldelf_finish ();
+ }
+ 
+ 
+diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
+index dd8d259a31f..76776ba2555 100644
+--- a/ld/emultempl/spuelf.em
++++ b/ld/emultempl/spuelf.em
+@@ -432,7 +432,7 @@ gld${EMULATION_NAME}_finish (void)
+ 	einfo (_("%P: --auto-overlay ignored with zero local store range\n"));
+     }
+ 
+-  finish_default ();
++  ldelf_finish ();
+ }
+ 
+ static char *
+diff --git a/ld/ld.h b/ld/ld.h
+index 48d34bc6acd..254f0a097bb 100644
+--- a/ld/ld.h
++++ b/ld/ld.h
+@@ -306,6 +306,12 @@ typedef struct
+   /* If set, store plugin intermediate files permanently.  */
+   bool plugin_save_temps;
+ 
++  /* If set, if the .gnu_object_only section should be created.  */
++  bool emit_gnu_object_only;
++
++  /* If set, if the .gnu_object_only section is being created.  */
++  bool emitting_gnu_object_only;
++
+   /* If set, print discarded sections in map file output.  */
+   bool print_map_discarded;
+ 
+diff --git a/ld/ldelf.c b/ld/ldelf.c
+index 4cbfc19c161..a66d1d21394 100644
+--- a/ld/ldelf.c
++++ b/ld/ldelf.c
+@@ -63,6 +63,7 @@ static lang_input_statement_type *global_found;
+ static struct stat global_stat;
+ static struct bfd_link_needed_list *global_vercheck_needed;
+ static bool global_vercheck_failed;
++static bool orphan_init_done;
+ 
+ void
+ ldelf_after_parse (void)
+@@ -2101,7 +2102,7 @@ elf_orphan_compatible (asection *in, asection *out)
+ lang_output_section_statement_type *
+ ldelf_place_orphan (asection *s, const char *secname, int constraint)
+ {
+-  static struct orphan_save hold[] =
++  static struct orphan_save orig_hold[] =
+     {
+       { ".text",
+ 	SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE,
+@@ -2131,6 +2132,7 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
+ 	SEC_HAS_CONTENTS,
+ 	0, 0, 0, 0 },
+     };
++  static struct orphan_save hold[ARRAY_SIZE (orig_hold)];
+   enum orphan_save_index
+     {
+       orphan_text = 0,
+@@ -2143,7 +2145,6 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
+       orphan_sdata,
+       orphan_nonalloc
+     };
+-  static int orphan_init_done = 0;
+   struct orphan_save *place;
+   lang_output_section_statement_type *after;
+   lang_output_section_statement_type *os;
+@@ -2272,16 +2273,23 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
+ 
+   if (!orphan_init_done)
+     {
+-      struct orphan_save *ho;
++      struct orphan_save *ho, *horig;
+ 
+       for (ho = hold; ho < hold + sizeof (hold) / sizeof (hold[0]); ++ho)
++      for (ho = hold, horig = orig_hold;
++	   ho < hold + ARRAY_SIZE (hold);
++	   ++ho, ++horig)
++	{
++	  *ho = *horig;
++	  if (ho->name != NULL)
+ 	if (ho->name != NULL)
+ 	  {
+ 	    ho->os = lang_output_section_find (ho->name);
+ 	    if (ho->os != NULL && ho->os->flags == 0)
+ 	      ho->os->flags = ho->flags;
+ 	  }
+-      orphan_init_done = 1;
++	}
++      orphan_init_done = true;
+     }
+ 
+   /* If this is a final link, then always put .gnu.warning.SYMBOL
+@@ -2428,3 +2436,13 @@ ldelf_set_output_arch (void)
+   if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour)
+     elf_link_info (link_info.output_bfd) = &link_info;
+ }
++
++void
++ldelf_finish (void)
++{
++  /* Support the object-only output.  */
++  if (config.emit_gnu_object_only)
++    orphan_init_done = false;
++
++  finish_default ();
++}
+diff --git a/ld/ldelf.h b/ld/ldelf.h
+index 96fb1e5b6a8..a6498cf2758 100644
+--- a/ld/ldelf.h
++++ b/ld/ldelf.h
+@@ -21,6 +21,7 @@
+ extern const char *ldelf_emit_note_gnu_build_id;
+ extern const char *ldelf_emit_note_fdo_package_metadata;
+ 
++extern void ldelf_finish (void);
+ extern void ldelf_after_parse (void);
+ extern bool ldelf_load_symbols (lang_input_statement_type *);
+ extern void ldelf_before_plugin_all_symbols_read (int, int, int, int,
+diff --git a/ld/ldexp.c b/ld/ldexp.c
+index f0b8d7cb748..035cef60448 100644
+--- a/ld/ldexp.c
++++ b/ld/ldexp.c
+@@ -1699,14 +1699,15 @@ align_n (bfd_vma value, bfd_vma align)
+ }
+ 
+ void
+-ldexp_init (void)
++ldexp_init (bool object_only)
+ {
+   /* The value "13" is ad-hoc, somewhat related to the expected number of
+      assignments in a linker script.  */
+-  if (!bfd_hash_table_init_n (&definedness_table,
+-			      definedness_newfunc,
+-			      sizeof (struct definedness_hash_entry),
+-			      13))
++  if (!object_only
++      && !bfd_hash_table_init_n (&definedness_table,
++				 definedness_newfunc,
++				 sizeof (struct definedness_hash_entry),
++				 13))
+     einfo (_("%F%P: can not create hash table: %E\n"));
+ }
+ 
+@@ -1763,7 +1764,8 @@ ldexp_is_final_sym_absolute (const struct bfd_link_hash_entry *h)
+ }
+ 
+ void
+-ldexp_finish (void)
++ldexp_finish (bool object_only)
+ {
+-  bfd_hash_table_free (&definedness_table);
++  if (!object_only)
++    bfd_hash_table_free (&definedness_table);
+ }
+diff --git a/ld/ldexp.h b/ld/ldexp.h
+index f7d2cba4f4c..16953caf7cd 100644
+--- a/ld/ldexp.h
++++ b/ld/ldexp.h
+@@ -250,9 +250,9 @@ fill_type *exp_get_fill
+   (etree_type *, fill_type *, char *);
+ bfd_vma exp_get_abs_int
+   (etree_type *, int, char *);
+-void ldexp_init (void);
++void ldexp_init (bool);
+ void ldexp_finalize_syms (void);
+ bool ldexp_is_final_sym_absolute (const struct bfd_link_hash_entry *);
+-void ldexp_finish (void);
++void ldexp_finish (bool);
+ 
+ #endif
+diff --git a/ld/ldfile.c b/ld/ldfile.c
+index 9bf5014ad95..530a5fef5e3 100644
+--- a/ld/ldfile.c
++++ b/ld/ldfile.c
+@@ -532,7 +532,9 @@ ldfile_try_open_bfd (const char *attempt,
+       && !no_more_claiming
+       && bfd_check_format (entry->the_bfd, bfd_object))
+     plugin_maybe_claim (entry);
++  else
+ #endif /* BFD_SUPPORTS_PLUGINS */
++    cmdline_check_object_only_section (entry->the_bfd, false);
+ 
+   /* It opened OK, the format checked out, and the plugins have had
+      their chance to claim it, so this is success.  */
+diff --git a/ld/ldlang.c b/ld/ldlang.c
+index 4c8d4e7a7fc..e1e491732a9 100644
+--- a/ld/ldlang.c
++++ b/ld/ldlang.c
+@@ -37,6 +37,7 @@
+ #include "ldctor.h"
+ #include "ldfile.h"
+ #include "ldemul.h"
++#include "ldwrite.h"
+ #include "fnmatch.h"
+ #include "demangle.h"
+ #include "hashtab.h"
+@@ -47,6 +48,9 @@
+ #include "plugin.h"
+ #endif
+ 
++/* FIXME: Put it here to avoid NAME conflict from ldgram.h.  */
++#include "elf-bfd.h"
++
+ #ifndef offsetof
+ #define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER))
+ #endif
+@@ -76,6 +80,9 @@ static lang_statement_list_type **stat_save_ptr = &stat_save[0];
+ static struct unique_sections *unique_section_list;
+ static struct asneeded_minfo *asneeded_list_head;
+ static unsigned int opb_shift = 0;
++static cmdline_list_type cmdline_object_only_file_list;
++static cmdline_list_type cmdline_object_only_archive_list;
++static cmdline_list_type cmdline_temp_object_only_list;
+ 
+ /* Forward declarations.  */
+ static void exp_init_os (etree_type *);
+@@ -99,6 +106,10 @@ static void lang_do_version_exports_section (void);
+ static void lang_finalize_version_expr_head
+   (struct bfd_elf_version_expr_head *);
+ static void lang_do_memory_regions (bool);
++static void cmdline_lists_init (void);
++static void cmdline_get_object_only_input_files (void);
++static void print_cmdline_list (cmdline_union_type *);
++static bool cmdline_on_object_only_archive_list_p (bfd *);
+ 
+ /* Exported variables.  */
+ const char *output_target;
+@@ -1353,15 +1364,20 @@ output_section_statement_table_free (void)
+ /* Build enough state so that the parser can build its tree.  */
+ 
+ void
+-lang_init (void)
++lang_init (bool object_only)
+ {
+-  obstack_begin (&stat_obstack, 1000);
+-  obstack_init (&pt_obstack);
++  if (!object_only)
++    {
++      obstack_begin (&stat_obstack, 1000);
++      obstack_init (&pt_obstack);
++    }
+ 
+   stat_ptr = &statement_list;
+ 
+   output_section_statement_table_init ();
+ 
++  cmdline_lists_init ();
++
+   lang_list_init (stat_ptr);
+ 
+   lang_list_init (&input_file_chain);
+@@ -3142,6 +3158,12 @@ load_symbols (lang_input_statement_type *entry,
+ 		  loaded = false;
+ 		}
+ 
++	      if (config.emitting_gnu_object_only)
++		{
++		  if (!cmdline_on_object_only_archive_list_p (member))
++		    continue;
++		}
++
+ 	      subsbfd = member;
+ 	      if (!(*link_info.callbacks
+ 		    ->add_archive_element) (&link_info, member,
+@@ -8343,7 +8365,42 @@ lang_process (void)
+ 	    }
+ 	}
+     }
++  else
+ #endif /* BFD_SUPPORTS_PLUGINS */
++    if (bfd_link_relocatable (&link_info))
++    {
++      /* Check if .gnu_object_only section should be created.  */
++      bfd *p;
++      int object_type;
++
++      object_type = 0;
++      for (p = link_info.input_bfds; p != (bfd *) NULL; p = p->link.next)
++	{
++	  enum bfd_lto_object_type lto_type = bfd_get_lto_type (p);
++	  /* NB: Treat fat IR object as IR object here.  */
++	  if (lto_type == lto_fat_ir_object)
++	    lto_type = lto_slim_ir_object;
++	  object_type |= 1 << lto_type;
++	  if ((object_type & (1 << lto_mixed_object)) != 0
++	      || ((object_type
++		   & (1 << lto_non_ir_object
++		      | 1 << lto_slim_ir_object))
++		  == (1 << lto_non_ir_object | 1 << lto_slim_ir_object)))
++	    {
++	      config.emit_gnu_object_only = true;
++	      break;
++	    }
++	}
++
++      if (verbose
++	  && (cmdline_object_only_file_list.head
++	      || cmdline_object_only_archive_list.head))
++	{
++	  info_msg (_("Object-only input files:\n "));
++	  print_cmdline_list (cmdline_object_only_file_list.head);
++	  print_cmdline_list (cmdline_object_only_archive_list.head);
++	}
++    }
+ 
+   struct bfd_sym_chain **sym = &link_info.gc_sym_list;
+   while (*sym)
+@@ -10022,3 +10079,967 @@ lang_print_memory_usage (void)
+       printf ("\n");
+     }
+ }
++
++static void
++cmdline_lists_init (void)
++{
++  cmdline_object_only_file_list.tail
++    = &cmdline_object_only_file_list.head;
++  cmdline_object_only_archive_list.tail
++    = &cmdline_object_only_archive_list.head;
++  cmdline_temp_object_only_list.tail
++    = &cmdline_temp_object_only_list.head;
++}
++
++/* Allocate an item with TYPE and DATA.  */
++
++static cmdline_union_type *
++cmdline_list_new (cmdline_enum_type type, void *data)
++{
++  cmdline_union_type *new_opt;
++
++  new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
++  new_opt->header.type = type;
++  switch (type)
++    {
++    default:
++      break;
++    case cmdline_is_file_enum:
++      new_opt->file.filename = (const char *) data;
++      break;
++    case cmdline_is_bfd_enum:
++      new_opt->abfd.abfd = (bfd *) data;
++      break;
++    }
++  return new_opt;
++}
++
++/* Append an item with TYPE and DATA to LIST.  */
++
++static void
++cmdline_list_append (cmdline_list_type *list, cmdline_enum_type type,
++		     void *data)
++{
++  cmdline_union_type *new_opt = cmdline_list_new (type, data);
++  new_opt->header.next = NULL;
++  *list->tail = new_opt;
++  list->tail = &new_opt->header.next;
++}
++
++static void
++print_cmdline_list (cmdline_union_type *c)
++{
++  for (; c != NULL; c = c->header.next)
++    switch (c->header.type)
++      {
++      default:
++	abort ();
++      case cmdline_is_file_enum:
++	info_msg (" %s", c->file.filename);
++	break;
++      case cmdline_is_bfd_enum:
++	info_msg (" [%B]", c->abfd.abfd);
++	break;
++      }
++
++  info_msg ("\n");
++}
++
++/* Return TRUE if ABFD is on cmdline_object_only_archive_list.  */
++
++static bool
++cmdline_on_object_only_archive_list_p (bfd *abfd)
++{
++  cmdline_union_type *c, *next;
++  bfd *archive, *obfd, *oarchive;
++  ufile_ptr origin = abfd->origin;
++
++  archive = abfd->my_archive;
++  for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
++    {
++      if (c->header.type != cmdline_is_bfd_enum)
++	abort ();
++
++      next = c->header.next;
++      obfd = c->abfd.abfd;
++      oarchive = obfd->my_archive;
++
++      /* The list is grouped by archive file name and sorted by member
++	 origin.  */
++      if (strcmp (archive->filename, oarchive->filename) != 0)
++	continue;
++
++      if (origin == obfd->origin)
++	return true;
++      else if (origin < obfd->origin)
++	return false;
++    }
++
++  return false;
++}
++
++/* Append an item with TYPE and DATA to cmdline_object_only_file_list
++   or cmdline_object_only_archive_list if needed.  */
++
++static void
++cmdline_object_only_list_append (cmdline_enum_type type, void *data)
++{
++  cmdline_union_type *c;
++  cmdline_union_type *new_opt, *next, **prev;
++  bfd *abfd, *archive;
++  bfd *obfd, *oarchive;
++  bfd *nbfd, *narchive;
++  ufile_ptr origin, norigin;
++
++  /* Put it on cmdline_object_only_file_list if it isn't an archive
++     member.  */
++  switch (type)
++    {
++    default:
++      abort ();
++    case cmdline_is_bfd_enum:
++      abfd = (bfd *) data;
++      archive = abfd->my_archive;
++      if (archive)
++	break;
++      /* Fallthru */
++    case cmdline_is_file_enum:
++      cmdline_list_append (&cmdline_object_only_file_list, type, data);
++      return;
++    }
++
++  /* Put archive member on cmdline_object_only_archive_list and sort
++     the list by archive name and archive member origin.  */
++  new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt));
++  new_opt->header.type = cmdline_is_bfd_enum;
++  new_opt->header.next = NULL;
++  new_opt->abfd.abfd = (bfd *) data;
++
++  c = cmdline_object_only_archive_list.head;
++  if (c == NULL)
++    {
++      cmdline_object_only_archive_list.head = new_opt;
++      cmdline_object_only_archive_list.tail = &new_opt->header.next;
++      return;
++    }
++
++  prev = NULL;
++  origin = abfd->origin;
++  for (; c != NULL; c = next)
++    {
++      if (c->header.type != cmdline_is_bfd_enum)
++	abort ();
++
++      next = c->header.next;
++
++      obfd = c->abfd.abfd;
++      oarchive = obfd->my_archive;
++
++      if (strcmp (archive->filename, oarchive->filename) == 0)
++	{
++	  bool after;
++
++	  if (origin < obfd->origin)
++	    {
++	      /* Insert it before the current.  */
++	      new_opt->header.next = c;
++	      if (prev)
++		*prev = new_opt;
++	      else
++		cmdline_object_only_archive_list.head = new_opt;
++	      return;
++	    }
++
++	  after = true;
++
++	  /* Check origin.  */
++	  while (next)
++	    {
++	      if (next->header.type != cmdline_is_bfd_enum)
++		abort ();
++
++	      nbfd = next->abfd.abfd;
++	      norigin = nbfd->origin;
++	      if (origin > norigin)
++		{
++		  /* Insert it after NEXT.  */
++		  break;
++		}
++
++	      narchive = nbfd->my_archive;
++	      if (strcmp (archive->filename, narchive->filename) != 0)
++		{
++		  /* Insert it befor NEXT.  */
++		  after = false;
++		  break;
++		}
++
++	      c = next;
++	      next = next->header.next;
++	    }
++
++	  if (after && next)
++	    {
++	      c = next;
++	      next = next->header.next;
++	    }
++
++	  if (*cmdline_object_only_archive_list.tail == c->header.next)
++	    cmdline_object_only_archive_list.tail
++	      = &new_opt->header.next;
++
++	  prev = &c->header.next;
++	  new_opt->header.next = next;
++	  *prev = new_opt;
++	  return;
++	}
++
++      prev = &c->header.next;
++    }
++
++  *cmdline_object_only_archive_list.tail = new_opt;
++  cmdline_object_only_archive_list.tail = &new_opt->header.next;
++}
++
++/* Get object-only input files.  */
++
++static void
++cmdline_get_object_only_input_files (void)
++{
++  cmdline_union_type *c, *next;
++  bfd *abfd, *archive;
++  bfd *nbfd, *narchive;
++
++  /* Add files first.  */
++  for (c = cmdline_object_only_file_list.head;
++       c != NULL; c = c->header.next)
++    switch (c->header.type)
++      {
++      default:
++	abort ();
++      case cmdline_is_file_enum:
++	lang_add_input_file (c->file.filename,
++			     lang_input_file_is_file_enum, NULL);
++	break;
++      case cmdline_is_bfd_enum:
++	abfd = c->abfd.abfd;
++	if (abfd->my_archive)
++	  abort ();
++	lang_add_input_file (abfd->filename,
++			     lang_input_file_is_file_enum, NULL);
++	break;
++      }
++
++  /* Add archive members next.  */
++  for (c = cmdline_object_only_archive_list.head; c != NULL; c = next)
++    {
++      if (c->header.type != cmdline_is_bfd_enum)
++	abort ();
++
++      next = c->header.next;
++
++      abfd = c->abfd.abfd;
++      archive = abfd->my_archive;
++
++      /* Add the first archive of the archive member group.  */
++      lang_add_input_file (archive->filename,
++			   lang_input_file_is_file_enum, NULL);
++
++      /* Skip the rest members in the archive member group.  */
++      do
++	{
++	  if (!next)
++	    break;
++
++	  if (next->header.type != cmdline_is_bfd_enum)
++	    abort ();
++
++	  next = next->header.next;
++	  if (!next)
++	    break;
++	  nbfd = next->abfd.abfd;
++	  narchive = nbfd->my_archive;
++	}
++      while (strcmp (archive->filename, narchive->filename) == 0);
++    }
++}
++
++struct cmdline_arg
++{
++  bfd *obfd;
++  asymbol **isympp;
++  int status;
++};
++
++/* Create a section in OBFD with the same
++   name and attributes as ISECTION in IBFD.  */
++
++static void
++setup_section (bfd *ibfd, sec_ptr isection, void *p)
++{
++  struct cmdline_arg *arg = (struct cmdline_arg *) p;
++  bfd *obfd = arg->obfd;
++  asymbol **isympp = arg->isympp;
++  const char *name = isection->name;
++  sec_ptr osection;
++  const char *err;
++
++  /* Skip the object-only section.  */
++  if (ibfd->object_only_section == isection)
++    return;
++
++  /* If we have already failed earlier on, do not keep on generating
++     complaints now.  */
++  if (arg->status)
++    return;
++
++  osection = bfd_make_section_anyway_with_flags (obfd, name,
++						 isection->flags);
++
++  if (osection == NULL)
++    {
++      err = _("failed to create output section");
++      goto loser;
++    }
++
++  osection->size = isection->size;
++  osection->vma = isection->vma;
++  osection->lma = isection->lma;
++  osection->alignment_power = isection->alignment_power;
++
++  /* Copy merge entity size.  */
++  osection->entsize = isection->entsize;
++
++  /* This used to be mangle_section; we do here to avoid using
++     bfd_get_section_by_name since some formats allow multiple
++     sections with the same name.  */
++  isection->output_section = osection;
++  isection->output_offset = 0;
++
++  if ((isection->flags & SEC_GROUP) != 0)
++    {
++      asymbol *gsym = bfd_group_signature (isection, isympp);
++
++      if (gsym != NULL)
++	{
++	  gsym->flags |= BSF_KEEP;
++	  if (ibfd->xvec->flavour == bfd_target_elf_flavour)
++	    elf_group_id (isection) = gsym;
++	}
++    }
++
++  /* Allow the BFD backend to copy any private data it understands
++     from the input section to the output section.  */
++  if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
++    {
++      err = _("failed to copy private data");
++      goto loser;
++    }
++
++  /* All went well.  */
++  return;
++
++loser:
++  arg->status = 1;
++  einfo (_("%P%F: setup_section: %s: %s\n"), err, name);
++}
++
++/* Copy the data of input section ISECTION of IBFD
++   to an output section with the same name in OBFD.
++   If stripping then don't copy any relocation info.  */
++
++static void
++copy_section (bfd *ibfd, sec_ptr isection, void *p)
++{
++  struct cmdline_arg *arg = (struct cmdline_arg *) p;
++  bfd *obfd = arg->obfd;
++  asymbol **isympp = arg->isympp;
++  arelent **relpp;
++  long relcount;
++  sec_ptr osection;
++  bfd_size_type size;
++  long relsize;
++  flagword flags;
++  const char *err;
++
++  /* Skip the object-only section.  */
++  if (ibfd->object_only_section == isection)
++    return;
++
++  /* If we have already failed earlier on, do not keep on generating
++     complaints now.  */
++  if (arg->status)
++    return;
++
++  flags = bfd_section_flags (isection);
++  if ((flags & SEC_GROUP) != 0)
++    return;
++
++  osection = isection->output_section;
++  size = bfd_section_size (isection);
++
++  if (size == 0 || osection == 0)
++    return;
++
++  relsize = bfd_get_reloc_upper_bound (ibfd, isection);
++
++  if (relsize < 0)
++    {
++      /* Do not complain if the target does not support relocations.  */
++      if (relsize == -1
++	  && bfd_get_error () == bfd_error_invalid_operation)
++	relsize = 0;
++      else
++	{
++	  err = bfd_errmsg (bfd_get_error ());
++	  goto loser;
++	}
++    }
++
++  if (relsize == 0)
++    bfd_set_reloc (obfd, osection, NULL, 0);
++  else
++    {
++      relpp = (arelent **) xmalloc (relsize);
++      relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
++      if (relcount < 0)
++	{
++	  err = _("relocation count is negative");
++	  goto loser;
++	}
++
++      bfd_set_reloc (obfd, osection,
++		     relcount == 0 ? NULL : relpp, relcount);
++      if (relcount == 0)
++	free (relpp);
++    }
++
++  if (bfd_section_flags (isection) & SEC_HAS_CONTENTS)
++    {
++      bfd_byte *memhunk = NULL;
++
++      if (!bfd_get_full_section_contents (ibfd, isection, &memhunk))
++	{
++	  err = bfd_errmsg (bfd_get_error ());
++	  goto loser;
++	}
++
++      if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
++	{
++	  err = bfd_errmsg (bfd_get_error ());
++	  goto loser;
++	}
++      free (memhunk);
++    }
++
++  /* All went well.  */
++  return;
++
++loser:
++  einfo (_("%P%F: copy_section: %s: %s\n"), err, isection->name);
++}
++/* Open the temporary bfd created in the same directory as PATH.  */
++
++static bfd *
++cmdline_fopen_temp (const char *path, const char *target,
++		    const char *mode)
++{
++#define template "ldXXXXXX"
++  const char *slash = strrchr (path, '/');
++  char *tmpname;
++  size_t len;
++  int fd;
++
++#ifdef HAVE_DOS_BASED_FILE_SYSTEM
++  {
++    /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
++    char *bslash = strrchr (path, '\\');
++
++    if (slash == NULL || (bslash != NULL && bslash > slash))
++      slash = bslash;
++    if (slash == NULL && path[0] != '\0' && path[1] == ':')
++      slash = path + 1;
++  }
++#endif
++
++  if (slash != (char *) NULL)
++    {
++      len = slash - path;
++      tmpname = (char *) xmalloc (len + sizeof (template) + 2);
++      memcpy (tmpname, path, len);
++
++#ifdef HAVE_DOS_BASED_FILE_SYSTEM
++      /* If tmpname is "X:", appending a slash will make it a root
++	 directory on drive X, which is NOT the same as the current
++	 directory on drive X.  */
++      if (len == 2 && tmpname[1] == ':')
++	tmpname[len++] = '.';
++#endif
++      tmpname[len++] = '/';
++    }
++  else
++    {
++      tmpname = (char *) xmalloc (sizeof (template));
++      len = 0;
++    }
++
++  memcpy (tmpname + len, template, sizeof (template));
++#undef template
++
++#ifdef HAVE_MKSTEMP
++  fd = mkstemp (tmpname);
++#else
++  tmpname = mktemp (tmpname);
++  if (tmpname == NULL)
++    return NULL;
++  fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600);
++#endif
++  if (fd == -1)
++    return NULL;
++  return bfd_fopen (tmpname, target, mode, fd);
++}
++
++/* Add the object-only section.  */
++
++static void
++cmdline_add_object_only_section (bfd_byte *contents, size_t size)
++{
++  bfd_vma start;
++  flagword flags;
++  enum bfd_architecture iarch;
++  unsigned int imach;
++  long symcount;
++  long symsize;
++  asymbol **isympp = NULL;
++  asymbol **osympp = NULL;
++  bfd *obfd = NULL, *ibfd;
++  const char *err;
++  struct arg
++    {
++      bfd *obfd;
++      asymbol **isympp;
++      int status;
++    } arg;
++  char **matching;
++  char *ofilename = NULL;
++  asection *sec;
++
++  ibfd = bfd_openr (output_filename, output_target);
++  if (!ibfd)
++    {
++      err = bfd_errmsg (bfd_get_error ());
++      goto loser;
++    }
++
++  if (!bfd_check_format_matches (ibfd, bfd_object, &matching))
++    {
++      err = bfd_errmsg (bfd_get_error ());
++      goto loser;
++    }
++
++  obfd = cmdline_fopen_temp (output_filename, output_target, FOPEN_WB);
++  if (!obfd)
++    {
++      err = bfd_errmsg (bfd_get_error ());
++      goto loser;
++    }
++  /* To be used after bfd_close ().  */
++  ofilename = xstrdup (bfd_get_filename (obfd));
++
++  if (!bfd_set_format (obfd, bfd_object))
++    {
++      err = bfd_errmsg (bfd_get_error ());
++      goto loser;
++    }
++
++  /* Copy the start address, flags and architecture of input file to
++     output file.  */
++  flags = bfd_get_file_flags (ibfd);
++  start = bfd_get_start_address (ibfd);
++  iarch = bfd_get_arch (ibfd);
++  imach = bfd_get_mach (ibfd);
++  if (!bfd_set_start_address (obfd, start)
++      || !bfd_set_file_flags (obfd, flags)
++      || !bfd_set_arch_mach (obfd, iarch, imach))
++    {
++      err = bfd_errmsg (bfd_get_error ());
++      goto loser;
++    }
++
++  symsize = bfd_get_symtab_upper_bound (ibfd);
++  if (symsize < 0)
++    {
++      err = bfd_errmsg (bfd_get_error ());
++      goto loser;
++    }
++
++  isympp = (asymbol **) xmalloc (symsize);
++  symcount = bfd_canonicalize_symtab (ibfd, isympp);
++  if (symcount < 0)
++    {
++      err = bfd_errmsg (bfd_get_error ());
++      goto loser;
++    }
++
++  arg.obfd = obfd;
++  arg.isympp = isympp;
++  arg.status = 0;
++
++  /* BFD mandates that all output sections be created and sizes set before
++     any output is done.  Thus, we traverse all sections multiple times.  */
++  bfd_map_over_sections (ibfd, setup_section, &arg);
++
++  if (arg.status)
++    {
++      err = _("error setting up sections");
++      goto loser;
++    }
++
++  /* Allow the BFD backend to copy any private data it understands
++     from the input section to the output section.  */
++  if (! bfd_copy_private_header_data (ibfd, obfd))
++    {
++      err = _("error copying private header data");
++      goto loser;
++    }
++
++  /* Create the object-only section.  */
++  sec = bfd_make_section_with_flags (obfd,
++				     GNU_OBJECT_ONLY_SECTION_NAME,
++				     (SEC_HAS_CONTENTS
++				      | SEC_READONLY
++				      | SEC_DATA
++				      | SEC_LINKER_CREATED));
++  if (sec == NULL)
++    {
++      err = _("can't create object-only section");
++      goto loser;
++    }
++
++  if (! bfd_set_section_size (sec, size))
++    {
++      err = _("can't set object-only section size");
++      goto loser;
++    }
++
++  if (ibfd->object_only_section)
++    {
++      /* Filter out the object-only section symbol.  */
++      long src_count = 0, dst_count = 0;
++      asymbol **from, **to;
++
++      osympp = (asymbol **) xmalloc (symcount * sizeof (asymbol *));
++      from = isympp;
++      to = osympp;
++      for (; src_count < symcount; src_count++)
++	{
++	  asymbol *sym = from[src_count];
++	  if (bfd_asymbol_section (sym) != ibfd->object_only_section)
++	    to[dst_count++] = sym;
++	}
++      to[dst_count] = NULL;
++      symcount = dst_count;
++      bfd_set_symtab (obfd, osympp, symcount);
++    }
++  else
++    bfd_set_symtab (obfd, isympp, symcount);
++
++  /* This has to happen after the symbol table has been set.  */
++  bfd_map_over_sections (ibfd, copy_section, &arg);
++
++  if (arg.status)
++    {
++      err = _("error copying sections");
++      goto loser;
++    }
++
++  /* Copy the object-only section to the output.  */
++  if (! bfd_set_section_contents (obfd, sec, contents, 0, size))
++    {
++      err = _("error adding object-only section");
++      goto loser;
++    }
++
++  /* Allow the BFD backend to copy any private data it understands
++     from the input BFD to the output BFD.  This is done last to
++     permit the routine to look at the filtered symbol table, which is
++     important for the ECOFF code at least.  */
++  if (! bfd_copy_private_bfd_data (ibfd, obfd))
++    {
++      err = _("error copying private BFD data");
++      goto loser;
++    }
++
++  if (!bfd_close (obfd))
++    {
++      unlink (ofilename);
++      einfo (_("%P%F: failed to finish output with object-only section\n"));
++    }
++
++  /* Must be freed after bfd_close ().  */
++  free (isympp);
++  if (osympp)
++    free (osympp);
++
++  if (rename (ofilename, output_filename))
++    {
++      unlink (ofilename);
++      einfo (_("%P%F: failed to rename output with object-only section\n"));
++    }
++
++  free (ofilename);
++  return;
++
++loser:
++  if (isympp)
++    free (isympp);
++  if (osympp)
++    free (osympp);
++  if (obfd)
++    bfd_close (obfd);
++  if (ofilename)
++    unlink (ofilename);
++  einfo (_("%P%F: failed to add object-only section: %s\n"), err);
++}
++
++/* Emit the final output with object-only section.  */
++
++void
++cmdline_emit_object_only_section (void)
++{
++  const char *saved_output_filename = output_filename;
++  int fd;
++  size_t size, off;
++  bfd_byte *contents;
++  struct stat st;
++
++  /* Get a temporary object-only file.  */
++  output_filename = make_temp_file (".obj-only.o");
++
++  had_output_filename = false;
++  link_info.input_bfds = NULL;
++  link_info.input_bfds_tail = &link_info.input_bfds;
++
++  lang_init (true);
++  ldexp_init (true);
++
++  ld_parse_linker_script ();
++
++  /* Set up the object-only output. */
++  lang_final ();
++
++  /* Open the object-only file for output.  */
++  lang_for_each_statement (ldlang_open_output);
++
++  ldemul_create_output_section_statements ();
++
++  if (!bfd_section_already_linked_table_init ())
++    einfo (_("%P%F: Failed to create hash table\n"));
++
++  /* Call cmdline_on_object_only_archive_list_p to check which member
++     should be loaded.  */
++  input_flags.whole_archive = true;
++
++  /* Set it to avoid adding more to cmdline lists.  */
++  config.emitting_gnu_object_only = true;
++
++  /* Get object-only input files.  */
++  cmdline_get_object_only_input_files ();
++
++  /* Open object-only input files.  */
++  open_input_bfds (statement_list.head, NULL, OPEN_BFD_NORMAL);
++
++  ldemul_after_open ();
++
++  bfd_section_already_linked_table_free ();
++
++  /* Make sure that we're not mixing architectures.  We call this
++     after all the input files have been opened, but before we do any
++     other processing, so that any operations merge_private_bfd_data
++     does on the output file will be known during the rest of the
++     link.  */
++  lang_check ();
++
++  /* Size up the common data.  */
++  lang_common ();
++
++  /* Update wild statements.  */
++  update_wild_statements (statement_list.head);
++
++  /* Run through the contours of the script and attach input sections
++     to the correct output sections.  */
++  map_input_to_output_sections (statement_list.head, NULL, NULL);
++
++  /* Find any sections not attached explicitly and handle them.  */
++  lang_place_orphans ();
++
++  /* Do anything special before sizing sections.  This is where ELF
++     and other back-ends size dynamic sections.  */
++  ldemul_before_allocation ();
++
++  /* Size up the sections.  */
++  lang_size_sections (NULL, ! RELAXATION_ENABLED);
++
++  /* See if anything special should be done now we know how big
++     everything is.  This is where relaxation is done.  */
++  ldemul_after_allocation ();
++
++  ldemul_finish ();
++
++  /* Make sure that the section addresses make sense.  */
++  if (command_line.check_section_addresses)
++    lang_check_section_addresses ();
++
++  lang_end ();
++
++  ldwrite ();
++
++  ldexp_finish (true);
++  lang_finish ();
++
++  if (! bfd_close (link_info.output_bfd))
++    einfo (_("%P%F:%s: final close failed on object-only output: %E\n"),
++	   output_filename);
++
++  link_info.output_bfd = NULL;
++
++  /* Read in the object-only file.  */
++  fd = open (output_filename, O_RDONLY | O_BINARY);
++  if (fd < 0)
++    {
++      bfd_set_error (bfd_error_system_call);
++      einfo (_("%P%F:%s: cannot open object-only output: %E\n"),
++	     output_filename);
++    }
++
++  /* Get the object-only file size.  */
++  if (fstat (fd, &st) != 0)
++    {
++      bfd_set_error (bfd_error_system_call);
++      einfo (_("%P%F:%s: cannot stat object-only output: %E\n"),
++	     output_filename);
++    }
++
++  size = st.st_size;
++  off = 0;
++  contents = (bfd_byte *) xmalloc (size);
++  while (off != size)
++    {
++      ssize_t got;
++
++      got = read (fd, contents + off, size - off);
++      if (got < 0)
++	{
++	  bfd_set_error (bfd_error_system_call);
++	  einfo (_("%P%F:%s: read failed on object-only output: %E\n"),
++		 output_filename);
++	}
++
++      off += got;
++    }
++
++  close (fd);
++
++  /* Remove the temporary object-only file.  */
++  unlink (output_filename);
++
++  output_filename = saved_output_filename;
++
++  cmdline_add_object_only_section (contents, size);
++
++  free (contents);
++}
++
++/* Extract the object-only section.  */
++
++static const char *
++cmdline_extract_object_only_section (bfd *abfd)
++{
++  const char *name = bfd_extract_object_only_section (abfd);
++
++  if (name == NULL)
++    einfo (_("%P%F: cannot extract object-only section from %B: %E\n"),
++	   abfd);
++
++  /* It should be removed after it is done.  */
++  cmdline_list_append (&cmdline_temp_object_only_list,
++		       cmdline_is_file_enum, (void *) name);
++
++  return name;
++}
++
++/* Check and handle the object-only section.   */
++
++void
++cmdline_check_object_only_section (bfd *abfd, bool lto)
++{
++  const char *filename;
++
++  if (config.emitting_gnu_object_only || abfd->format != bfd_object)
++    return;
++
++  if (lto)
++    {
++      /* For LTO link, we only need to extract object-only section
++	 from the mixed object, add it to input, and put it on LTO
++	 claimed output.  */
++      switch (bfd_get_lto_type (abfd))
++	{
++	default:
++	  abort ();
++	case lto_mixed_object:
++	  filename = cmdline_extract_object_only_section (abfd);
++	  lang_add_input_file (filename,
++			       lang_input_file_is_file_enum, NULL);
++	  break;
++	case lto_non_ir_object:
++	case lto_slim_ir_object:
++	case lto_fat_ir_object:
++	  break;
++	}
++    }
++  else if (bfd_link_relocatable (&link_info))
++    {
++      /* For non-LTO relocatable link, we need to append non-IR object
++	 file and the object file in object-only section to the object
++	 only list.  */
++      switch (bfd_get_lto_type (abfd))
++	{
++	default:
++	  abort ();
++	case lto_mixed_object:
++	  filename = cmdline_extract_object_only_section (abfd);
++	  cmdline_object_only_list_append (cmdline_is_file_enum,
++					  (void *) filename);
++	  break;
++	case lto_non_ir_object:
++	  cmdline_object_only_list_append (cmdline_is_bfd_enum, abfd);
++	  break;
++	case lto_slim_ir_object:
++	case lto_fat_ir_object:
++	  break;
++	}
++    }
++}
++
++/* Remove temporary object-only files.  */
++
++void
++cmdline_remove_object_only_files (void)
++{
++  cmdline_union_type *c;
++
++  if (config.plugin_save_temps)
++    return;
++
++  c = cmdline_temp_object_only_list.head;
++  for (; c != NULL; c = c->header.next)
++    switch (c->header.type)
++      {
++      default:
++	abort ();
++      case cmdline_is_file_enum:
++	unlink (c->file.filename);
++	break;
++      }
++}
+diff --git a/ld/ldlang.h b/ld/ldlang.h
+index e32c5acaaca..91779a584b4 100644
+--- a/ld/ldlang.h
++++ b/ld/ldlang.h
+@@ -552,7 +552,7 @@ extern struct asneeded_minfo **asneeded_list_tail;
+ extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *);
+ 
+ extern void lang_init
+-  (void);
++  (bool);
+ extern void lang_finish
+   (void);
+ extern lang_memory_region_type * lang_memory_region_lookup
+@@ -746,4 +746,46 @@ print_one_symbol (struct bfd_link_hash_entry *, void *);
+ 
+ extern void lang_add_version_string
+   (void);
++
++typedef enum
++{
++  cmdline_is_file_enum,
++  cmdline_is_bfd_enum
++} cmdline_enum_type;
++
++typedef struct cmdline_header_struct
++{
++  union cmdline_union *next;
++  cmdline_enum_type type;
++} cmdline_header_type;
++
++typedef struct cmdline_file_struct
++{
++  cmdline_header_type header;
++  const char *filename;
++} cmdline_file_type;
++
++typedef struct cmdline_bfd_struct
++{
++  cmdline_header_type header;
++  bfd *abfd;
++} cmdline_bfd_type;
++
++typedef union cmdline_union
++{
++  cmdline_header_type header;
++  cmdline_file_type file;
++  cmdline_bfd_type abfd;
++} cmdline_union_type;
++
++typedef struct cmdline_list
++{
++  cmdline_union_type *head;
++  cmdline_union_type **tail;
++} cmdline_list_type;
++
++extern void cmdline_emit_object_only_section (void);
++extern void cmdline_check_object_only_section (bfd *, bool);
++extern void cmdline_remove_object_only_files (void);
++
+ #endif
+diff --git a/ld/ldmain.c b/ld/ldmain.c
+index 64c4cce8371..dcef7bb9278 100644
+--- a/ld/ldmain.c
++++ b/ld/ldmain.c
+@@ -302,6 +302,9 @@ main (int argc, char **argv)
+ 
+   xatexit (ld_cleanup);
+ 
++  /* Remove temporary object-only files.  */
++  xatexit (cmdline_remove_object_only_files);
++
+   /* Set up the sysroot directory.  */
+   ld_sysroot = get_sysroot (argc, argv);
+   if (*ld_sysroot)
+@@ -391,8 +394,8 @@ main (int argc, char **argv)
+   emulation = get_emulation (argc, argv);
+   ldemul_choose_mode (emulation);
+   default_target = ldemul_choose_target (argc, argv);
+-  lang_init ();
+-  ldexp_init ();
++  lang_init (false);
++  ldexp_init (false);
+   ldemul_before_parse ();
+   lang_has_input_file = false;
+   parse_args (argc, argv);
+@@ -407,34 +410,7 @@ main (int argc, char **argv)
+ 
+   ldemul_set_symbols ();
+ 
+-  /* If we have not already opened and parsed a linker script,
+-     try the default script from command line first.  */
+-  if (saved_script_handle == NULL
+-      && command_line.default_script != NULL)
+-    {
+-      ldfile_open_script_file (command_line.default_script);
+-      parser_input = input_script;
+-      yyparse ();
+-    }
+-
+-  /* If we have not already opened and parsed a linker script
+-     read the emulation's appropriate default script.  */
+-  if (saved_script_handle == NULL)
+-    {
+-      int isfile;
+-      char *s = ldemul_get_script (&isfile);
+-
+-      if (isfile)
+-	ldfile_open_default_command_file (s);
+-      else
+-	{
+-	  lex_string = s;
+-	  lex_redirect (s, _("built in linker script"), 1);
+-	}
+-      parser_input = input_script;
+-      yyparse ();
+-      lex_string = NULL;
+-    }
++  ld_parse_linker_script ();
+ 
+   if (verbose)
+     {
+@@ -572,7 +548,7 @@ main (int argc, char **argv)
+     fprintf (stderr, "lookup = %p val %lx\n", h, h ? h->u.def.value : 1);
+   }
+ #endif
+-  ldexp_finish ();
++  ldexp_finish (false);
+   lang_finish ();
+ 
+   if (config.dependency_file != NULL)
+@@ -597,6 +573,8 @@ main (int argc, char **argv)
+       if (!bfd_close (obfd))
+ 	einfo (_("%F%P: %s: final close failed: %E\n"), output_filename);
+ 
++      link_info.output_bfd = NULL;
++
+       /* If the --force-exe-suffix is enabled, and we're making an
+ 	 executable file and it doesn't end in .exe, copy it to one
+ 	 which does.  */
+@@ -644,6 +622,9 @@ main (int argc, char **argv)
+ 	}
+     }
+ 
++  if (config.emit_gnu_object_only)
++    cmdline_emit_object_only_section ();
++
+   if (config.stats)
+     {
+       long run_time = get_run_time () - start_time;
+@@ -951,7 +932,9 @@ add_archive_element (struct bfd_link_info *info,
+ 	  *subsbfd = input->the_bfd;
+ 	}
+     }
++  else
+ #endif /* BFD_SUPPORTS_PLUGINS */
++    cmdline_check_object_only_section (input->the_bfd, false);
+ 
+   if (link_info.input_bfds_tail == &input->the_bfd->link.next
+       || input->the_bfd->link.next != NULL)
+@@ -1694,3 +1677,38 @@ notice (struct bfd_link_info *info,
+ 
+   return true;
+ }
++
++/* Parse the linker script.   */
++
++void
++ld_parse_linker_script (void)
++{
++  /* If we have not already opened and parsed a linker script,
++     try the default script from command line first.  */
++  if (saved_script_handle == NULL
++      && command_line.default_script != NULL)
++    {
++      ldfile_open_script_file (command_line.default_script);
++      parser_input = input_script;
++      yyparse ();
++    }
++
++  /* If we have not already opened and parsed a linker script
++     read the emulation's appropriate default script.  */
++  if (saved_script_handle == NULL)
++    {
++      int isfile;
++      char *s = ldemul_get_script (&isfile);
++
++      if (isfile)
++	ldfile_open_default_command_file (s);
++      else
++	{
++	  lex_string = s;
++	  lex_redirect (s, _("built in linker script"), 1);
++	}
++      parser_input = input_script;
++      yyparse ();
++      lex_string = NULL;
++    }
++}
+diff --git a/ld/ldmain.h b/ld/ldmain.h
+index 0baa3c305c3..34770762f1c 100644
+--- a/ld/ldmain.h
++++ b/ld/ldmain.h
+@@ -63,4 +63,6 @@ extern void add_ignoresym (struct bfd_link_info *, const char *);
+ extern void add_keepsyms_file (const char *);
+ extern void track_dependency_files (const char *);
+ 
++extern void ld_parse_linker_script (void);
++
+ #endif
+diff --git a/ld/plugin.c b/ld/plugin.c
+index ecced25bd9b..ea0c6fcdd67 100644
+--- a/ld/plugin.c
++++ b/ld/plugin.c
+@@ -1341,6 +1341,9 @@ plugin_maybe_claim (lang_input_statement_type *entry)
+     {
+       bfd *abfd = entry->the_bfd->plugin_dummy_bfd;
+ 
++      /* Check object only section.  */
++      cmdline_check_object_only_section (entry->the_bfd, true);
++
+       /* Discard the real file's BFD and substitute the dummy one.  */
+ 
+       /* We can't call bfd_close on archives.  BFD archive handling
+diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
+index ccecc1088b8..deb69dde543 100644
+--- a/ld/scripttempl/elf.sc
++++ b/ld/scripttempl/elf.sc
+@@ -244,7 +244,7 @@ RELA_IPLT=".rela.iplt    ${RELOCATING-0} :
+ DYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
+ RODATA=".${RODATA_NAME}       ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
+ DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
+-DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
++DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
+ if test -z "${NO_SMALL_DATA}"; then
+   SBSS=".${SBSS_NAME}         ${RELOCATING-0} :
+   {
+diff --git a/ld/scripttempl/elf64hppa.sc b/ld/scripttempl/elf64hppa.sc
+index c468453d79d..b6701bf1d26 100644
+--- a/ld/scripttempl/elf64hppa.sc
++++ b/ld/scripttempl/elf64hppa.sc
+@@ -132,7 +132,7 @@ fi
+ DYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
+ RODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
+ DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
+-DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink)  *(.gnu.lto_*) }"
++DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
+ if test -z "${NO_SMALL_DATA}"; then
+   SBSS=".sbss         ${RELOCATING-0} :
+   {
+diff --git a/ld/scripttempl/elfxtensa.sc b/ld/scripttempl/elfxtensa.sc
+index fcda83c4dc9..2f62c2dbc54 100644
+--- a/ld/scripttempl/elfxtensa.sc
++++ b/ld/scripttempl/elfxtensa.sc
+@@ -145,7 +145,7 @@ fi
+ DYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
+ RODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
+ DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
+-DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink)  *(.gnu.lto_*) }"
++DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
+ INIT_LIT=".init.literal 0 : { *(.init.literal)	}"
+ INIT=".init         0 : { KEEP (*(SORT_NONE(.init))) }"
+ FINI_LIT=".fini.literal 0 : { *(.fini.literal)	}"
+diff --git a/ld/scripttempl/mep.sc b/ld/scripttempl/mep.sc
+index 7f0f46ae8e9..8fdf3117a40 100644
+--- a/ld/scripttempl/mep.sc
++++ b/ld/scripttempl/mep.sc
+@@ -119,7 +119,7 @@ fi
+ DYNAMIC=".dynamic      ${RELOCATING-0} : { *(.dynamic) }"
+ RODATA=".rodata       ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }"
+ DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }"
+-DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink)  *(.gnu.lto_*) }"
++DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }"
+ if test -z "${NO_SMALL_DATA}"; then
+   SBSS=".sbss         ${RELOCATING-0} :
+   {
+diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc
+index 6ca5f040a36..96a47515444 100644
+--- a/ld/scripttempl/pe.sc
++++ b/ld/scripttempl/pe.sc
+@@ -230,6 +230,7 @@ SECTIONS
+     ${RELOCATING+ *(.drectve)}
+     ${RELOCATING+ *(.note.GNU-stack)}
+     ${RELOCATING+ *(.gnu.lto_*)}
++    ${RELOCATING+ *(.gnu_object_only)}
+   }
+ 
+   .idata ${RELOCATING+BLOCK(__section_alignment__)} :
+diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc
+index d9ba2be49d9..e2c6c2cedd2 100644
+--- a/ld/scripttempl/pep.sc
++++ b/ld/scripttempl/pep.sc
+@@ -237,6 +237,7 @@ SECTIONS
+     ${RELOCATING+ *(.drectve)}
+     ${RELOCATING+ *(.note.GNU-stack)}
+     ${RELOCATING+ *(.gnu.lto_*)}
++    ${RELOCATING+ *(.gnu_object_only)}
+   }
+ 
+   .idata ${RELOCATING+BLOCK(__section_alignment__)} :
+diff --git a/ld/testsuite/ld-plugin/lto-10.out b/ld/testsuite/ld-plugin/lto-10.out
+new file mode 100644
+index 00000000000..ce013625030
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-10.out
+@@ -0,0 +1 @@
++hello
+diff --git a/ld/testsuite/ld-plugin/lto-10a.c b/ld/testsuite/ld-plugin/lto-10a.c
+new file mode 100644
+index 00000000000..93d57b520cb
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-10a.c
+@@ -0,0 +1,6 @@
++extern int foo(void);
++
++int main(void)
++{
++  return foo();
++}
+diff --git a/ld/testsuite/ld-plugin/lto-10b.c b/ld/testsuite/ld-plugin/lto-10b.c
+new file mode 100644
+index 00000000000..507055be341
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-10b.c
+@@ -0,0 +1,7 @@
++#include <stdio.h>
++
++int foo(void)
++{
++  printf ("hello\n");
++  return 0;
++}
+diff --git a/ld/testsuite/ld-plugin/lto-10r.d b/ld/testsuite/ld-plugin/lto-10r.d
+new file mode 100644
+index 00000000000..3502056153d
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-10r.d
+@@ -0,0 +1,9 @@
++#ld: -r tmpdir/lto-10a.o tmpdir/lto-10b.o
++#source: dummy.s
++#objdump: -h
++
++#...
++ *[0-9]+ +\.gnu\.lto_\.[0-9a-zA-Z_\.]+ +[0-9a-f]+ +[0-9a-f]+  +[0-9a-f]+ +[0-9a-f]+ .*
++#...
++ *[0-9]+ +\.gnu_object_only +[0-9a-f]+ +0+ +0+ +0+[1-9a-f][0-9a-f]+ +.*
++#pass
+diff --git a/ld/testsuite/ld-plugin/lto-4.out b/ld/testsuite/ld-plugin/lto-4.out
+new file mode 100644
+index 00000000000..8d8cc9240c8
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-4.out
+@@ -0,0 +1,2 @@
++hello bar
++hello foo
+diff --git a/ld/testsuite/ld-plugin/lto-4a.c b/ld/testsuite/ld-plugin/lto-4a.c
+new file mode 100644
+index 00000000000..2d07cf585da
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-4a.c
+@@ -0,0 +1,7 @@
++extern void foo(void);
++
++int main(void)
++{
++  foo();
++  return 0;
++}
+diff --git a/ld/testsuite/ld-plugin/lto-4b.c b/ld/testsuite/ld-plugin/lto-4b.c
+new file mode 100644
+index 00000000000..bb4a68bb986
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-4b.c
+@@ -0,0 +1,9 @@
++#include <stdio.h>
++
++extern void bar (void);
++
++void foo(void)
++{
++  bar ();
++  printf ("hello foo\n");
++}
+diff --git a/ld/testsuite/ld-plugin/lto-4c.c b/ld/testsuite/ld-plugin/lto-4c.c
+new file mode 100644
+index 00000000000..317e6fcdacd
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-4c.c
+@@ -0,0 +1,6 @@
++#include <stdio.h>
++
++void bar (void)
++{
++  printf ("hello bar\n");
++}
+diff --git a/ld/testsuite/ld-plugin/lto-4r-a.d b/ld/testsuite/ld-plugin/lto-4r-a.d
+new file mode 100644
+index 00000000000..c618cffb028
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-4r-a.d
+@@ -0,0 +1,7 @@
++#ld: -r tmpdir/lto-4a.o tmpdir/lto-4b.o tmpdir/lto-4c.o
++#source: dummy.s
++#objdump: -h
++
++#...
++.* .gnu_object_only.*
++#pass
+diff --git a/ld/testsuite/ld-plugin/lto-4r-b.d b/ld/testsuite/ld-plugin/lto-4r-b.d
+new file mode 100644
+index 00000000000..07d71cb5328
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-4r-b.d
+@@ -0,0 +1,7 @@
++#ld: -r tmpdir/lto-4a.o tmpdir/lto-4b.o
++#source: dummy.s
++#objdump: -h
++
++#...
++.* .gnu_object_only.*
++#pass
+diff --git a/ld/testsuite/ld-plugin/lto-4r-c.d b/ld/testsuite/ld-plugin/lto-4r-c.d
+new file mode 100644
+index 00000000000..4e691ea01ac
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-4r-c.d
+@@ -0,0 +1,7 @@
++#ld: -r tmpdir/lto-4r-b.o tmpdir/lto-4c.o --no-warn-execstack --no-error-execstack
++#source: dummy.s
++#objdump: -h
++
++#...
++.* .gnu_object_only.*
++#pass
+diff --git a/ld/testsuite/ld-plugin/lto-4r-d.d b/ld/testsuite/ld-plugin/lto-4r-d.d
+new file mode 100644
+index 00000000000..d4c58526cc5
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/lto-4r-d.d
+@@ -0,0 +1,7 @@
++#ld: -r --whole-archive tmpdir/liblto-4.a
++#source: dummy.s
++#objdump: -h
++
++#...
++.* .gnu_object_only.*
++#pass
+diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
+index e36480aee78..e454b485ed9 100644
+--- a/ld/testsuite/ld-plugin/lto.exp
++++ b/ld/testsuite/ld-plugin/lto.exp
+@@ -72,6 +72,15 @@ set lto_link_tests [list \
+   [list "Build liblto-3.a" \
+    "" "-flto $lto_fat" \
+    {lto-3b.c} {} "liblto-3.a"] \
++  [list "Compile 4a" \
++   "" "-flto $lto_fat" \
++   {lto-4a.c} {} ""] \
++  [list "Compile 4b" \
++   "" "-O2" \
++   {lto-4b.c} {} ""] \
++  [list "Compile 4c" \
++   "" "-O2" \
++   {lto-4c.c} {} ""] \
+   [list "Compile 5a" \
+    "" "-flto $lto_fat" \
+    {lto-5a.c} {} ""] \
+@@ -84,6 +93,12 @@ set lto_link_tests [list \
+   [list "Compile 9" \
+    "" "-O2 -finline -flto" \
+    {lto-9.cc} {} "" "c++"] \
++  [list "Compile 10a" \
++   "" "-O2" \
++   {lto-10a.c} {} ""] \
++  [list "Compile 10b" \
++   "" "-O2 -flto $lto_fat" \
++   {lto-10b.c} {} ""] \
+   [list "Compile 11a" \
+    "" "-O -flto" \
+    {lto-11a.c} {} ""] \
+@@ -711,9 +726,29 @@ set lto_run_tests [list \
+   [list "LTO 3c" \
+    "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o -Wl,--whole-archive tmpdir/liblto-3.a -Wl,--no-whole-archive tmpdir/liblto-3.a" "" \
+    {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"] \
++  [list "LTO 4a" \
++   "-O2 -flto -fuse-linker-plugin \
++    -Wl,--no-warn-execstack,--no-error-execstack \
++    tmpdir/lto-4r-a.o" "" \
++   {dummy.c} "lto-4a.exe" "lto-4.out" "" "c"] \
++  [list "LTO 4c" \
++   "-O2 -flto -fuse-linker-plugin \
++    -Wl,--no-warn-execstack,--no-error-execstack \
++    tmpdir/lto-4r-c.o" "" \
++   {dummy.c} "lto-4c.exe" "lto-4.out" "" "c"] \
++  [list "LTO 4d" \
++   "-O2 -flto -fuse-linker-plugin \
++    -Wl,--no-warn-execstack,--no-error-execstack \
++    tmpdir/lto-4r-d.o" "" \
++   {dummy.c} "lto-4d.exe" "lto-4.out" "" "c"] \
+   [list "LTO 5" \
+    "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
+    {dummy.c} "lto-5.exe" "lto-5.out" "" "c"] \
++  [list "LTO 10" \
++   "-O2 -flto -fuse-linker-plugin \
++    -Wl,--no-warn-execstack,--no-error-execstack \
++    tmpdir/lto-10.o" "" \
++   {dummy.c} "lto-10.exe" "lto-10.out" "" "c"] \
+   [list "LTO 11" \
+    "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" \
+    {dummy.c} "lto-11.exe" "lto-11.out" "" "c"] \
+@@ -979,6 +1014,15 @@ if [string match "" $exec_output] then {
+     fail "PR ld/28138 (build only)"
+ }
+ 
++set testname "Build liblto-4.a"
++remote_file host delete "tmpdir/liblto-4.a"
++set catch_output [run_host_cmd "$ar" "rc tmpdir/liblto-4.a tmpdir/lto-4a.o tmpdir/lto-4b.o tmpdir/lto-4c.o"]
++if {![string match "" $catch_output]} {
++    unresolved $testname
++    restore_notify
++    return
++}
++
+ set testname "Build liblto-11.a"
+ remote_file host delete "tmpdir/liblto-11.a"
+ set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
+@@ -1091,8 +1135,30 @@ if { [at_least_gcc_version 4 7] } {
+ # Run "ld -r" to generate inputs for complex LTO tests.
+ run_dump_test "lto-3r"
+ remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o"
++run_dump_test "lto-4r-a"
++remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-a.o"
++run_dump_test "lto-4r-b"
++remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-b.o"
++run_dump_test "lto-4r-c"
++remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-c.o"
++run_dump_test "lto-4r-d"
++remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-d.o"
+ run_dump_test "lto-5r"
+ remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
++run_dump_test "lto-10r"
++remote_exec host "mv" "tmpdir/dump tmpdir/lto-10.o"
++set testname "nm mixed object"
++set lto_plugin [string trim [run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so"]]
++if { [ regexp "liblto_plugin.so" $lto_plugin ] } {
++    set exec_output [run_host_cmd "$NM" "--plugin $lto_plugin tmpdir/lto-10.o"]
++    if { [ regexp "T main" $exec_output ] } {
++	pass $testname
++    } {
++	fail $testname
++    }
++} {
++    fail $testname
++ }
+ 
+ run_cc_link_tests $lto_link_symbol_tests
+ 
+-- 
+2.48.0
+

diff --git a/9999/0007-ld-Document-mixing-LTO-and-non-LTO-objects-for-r.patch b/9999/0007-ld-Document-mixing-LTO-and-non-LTO-objects-for-r.patch
new file mode 100644
index 0000000..9c17dc9
--- /dev/null
+++ b/9999/0007-ld-Document-mixing-LTO-and-non-LTO-objects-for-r.patch
@@ -0,0 +1,42 @@
+From 2c86c77dc5795a7f1e8f915c138c27893d8141d4 Mon Sep 17 00:00:00 2001
+Message-ID: <2c86c77dc5795a7f1e8f915c138c27893d8141d4.1736748624.git.sam@gentoo.org>
+In-Reply-To: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
+References: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Sat, 11 Jan 2025 07:23:27 +0800
+Subject: [PATCH 7/8] ld: Document mixing LTO and non-LTO objects for -r
+
+	* ld.texi: Document mixing LTO and non-LTO relocatable files for
+	"ld -r".
+
+Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
+---
+ ld/ld.texi | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/ld/ld.texi b/ld/ld.texi
+index da714a20855..d1787453f57 100644
+--- a/ld/ld.texi
++++ b/ld/ld.texi
+@@ -1126,6 +1126,18 @@ relocations.  Different output formats can have further restrictions; for
+ example some @code{a.out}-based formats do not support partial linking
+ with input files in other formats at all.
+ 
++On ELF platforms, when the relocatable output contains both contents
++which require link-time optimization (LTO) and contents which don't
++require LTO, a .gnu_object_only section will be created to contain a
++relocatable object file, as if @samp{-r} is applied to all relocatable
++inputs which don't require LTO.  When processing a relocatable input
++with a .gnu_object_only section, the linker will extract the
++.gnu_object_only section as a separate input.
++
++Note that since @samp{-r} groups some sections from different input files
++together, there may be negative impacts on code size and locality in
++final executable or shared library.
++
+ This option does the same thing as @samp{-i}.
+ 
+ @kindex -R @var{file}
+-- 
+2.48.0
+

diff --git a/9999/0008-h8300-Handle-.gnu_object_only-section.patch b/9999/0008-h8300-Handle-.gnu_object_only-section.patch
new file mode 100644
index 0000000..1336250
--- /dev/null
+++ b/9999/0008-h8300-Handle-.gnu_object_only-section.patch
@@ -0,0 +1,37 @@
+From c5f942b863c660280535dac32586e64d45308550 Mon Sep 17 00:00:00 2001
+Message-ID: <c5f942b863c660280535dac32586e64d45308550.1736748624.git.sam@gentoo.org>
+In-Reply-To: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
+References: <9f57274faacf1dbb6c2b56d29de150b5e79ecb3d.1736748624.git.sam@gentoo.org>
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Tue, 27 Oct 2020 06:39:59 -0700
+Subject: [PATCH 8/8] h8300: Handle .gnu_object_only section
+
+	PR ld/12291
+	PR ld/12430
+	PR ld/13298
+	* config/tc-h8300.c (h8300_elf_section): Handle .gnu_object_only
+	section.
+---
+ gas/config/tc-h8300.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
+index f8e54064166..105461da92b 100644
+--- a/gas/config/tc-h8300.c
++++ b/gas/config/tc-h8300.c
+@@ -146,8 +146,10 @@ pint (int arg ATTRIBUTE_UNUSED)
+ static void
+ h8300_elf_section (int push)
+ {
+-  static const char * known_data_sections [] = { ".rodata", ".tdata", ".tbss" };
+-  static const char * known_data_prefixes [] = { ".debug", ".zdebug", ".gnu.warning" };
++  static const char * known_data_sections []
++    = { ".rodata", ".tdata", ".tbss", ".gnu_object_only" };
++  static const char * known_data_prefixes []
++    = { ".debug", ".zdebug", ".gnu.warning" };
+   char * saved_ilp = input_line_pointer;
+   const char * name;
+ 
+-- 
+2.48.0
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-01-02 13:48 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-01-02 13:48 UTC (permalink / raw
  To: gentoo-commits

commit:     58f7f7f524284de1cbbacdc6403021b1d33a720b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  2 13:48:12 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan  2 13:48:12 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=58f7f7f5

9999: drop macro reverts

H.J. landed it upstream now.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 9999/0006-Revert-PR-32391-memory-leak.patch        |  28 -
 ...7-Revert-macro.c-871-heap-buffer-overflow.patch |  38 -
 9999/0008-Revert-PR-32391-testcase.patch           | 185 -----
 ...Fix-error-macro-may-be-used-uninitialized.patch |  39 -
 ...the-handling-or-arguments-and-macro-pseud.patch | 900 ---------------------
 5 files changed, 1190 deletions(-)

diff --git a/9999/0006-Revert-PR-32391-memory-leak.patch b/9999/0006-Revert-PR-32391-memory-leak.patch
deleted file mode 100644
index a20c54d..0000000
--- a/9999/0006-Revert-PR-32391-memory-leak.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 4bed21d47f9d838dc6b55ce026989ede4eacc789 Mon Sep 17 00:00:00 2001
-Message-ID: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Wed, 1 Jan 2025 14:03:43 +0000
-Subject: [PATCH 06/10] Revert "PR 32391 memory leak"
-
-This reverts commit 599739cc1c5d70ac958583130b4b5413aa101d8e.
----
- gas/macro.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/gas/macro.c b/gas/macro.c
-index 9eefc8360b1..9670b38c152 100644
---- a/gas/macro.c
-+++ b/gas/macro.c
-@@ -878,7 +878,6 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
- 	      (void) macro_expand_body (add, &newadd, NULL, NULL,
- 					orig_macro, orig_macro->count);
- 	      sb_add_sb (out, &newadd);
--	      sb_kill (&newadd);
- 	    }
- 	  else
- 	    {
-
-base-commit: 94e2b2a770fc49e42c9baec80f4fb88f63391a4e
--- 
-2.47.1
-

diff --git a/9999/0007-Revert-macro.c-871-heap-buffer-overflow.patch b/9999/0007-Revert-macro.c-871-heap-buffer-overflow.patch
deleted file mode 100644
index b461443..0000000
--- a/9999/0007-Revert-macro.c-871-heap-buffer-overflow.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 7daa5da3eab39e733f40eccbf4f6cd2078e3335e Mon Sep 17 00:00:00 2001
-Message-ID: <7daa5da3eab39e733f40eccbf4f6cd2078e3335e.1735740264.git.sam@gentoo.org>
-In-Reply-To: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
-References: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Wed, 1 Jan 2025 14:03:44 +0000
-Subject: [PATCH 07/10] Revert "macro.c:871 heap-buffer-overflow"
-
-This reverts commit 6d9b7667974372357fed1f02c54a805f8c21dcde.
----
- gas/macro.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gas/macro.c b/gas/macro.c
-index 9670b38c152..5fa2011ab7a 100644
---- a/gas/macro.c
-+++ b/gas/macro.c
-@@ -868,7 +868,7 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
- 	  /* The parent's FORMALs might contain parameters that need further
- 	     substitution.  See gas/testsuite/gas/arm/macro-vld1.s for an
- 	     example of this.  */
--	  if (memchr (add->ptr, '\\', add->len))
-+	  if (strchr (add->ptr, '\\'))
- 	    {
- 	      sb newadd;
- 
-@@ -1485,7 +1485,7 @@ delete_macro (const char *name)
- 	}
-     }
- 
--  if (j < 0)
-+  if (macro == NULL)
-     as_warn (_("Attempt to purge non-existing macro `%s'"), copy);
- 
-   free (copy);
--- 
-2.47.1
-

diff --git a/9999/0008-Revert-PR-32391-testcase.patch b/9999/0008-Revert-PR-32391-testcase.patch
deleted file mode 100644
index 4376e58..0000000
--- a/9999/0008-Revert-PR-32391-testcase.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From da631c6ce21783acebd2dc44b834fd17c84a0381 Mon Sep 17 00:00:00 2001
-Message-ID: <da631c6ce21783acebd2dc44b834fd17c84a0381.1735740264.git.sam@gentoo.org>
-In-Reply-To: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
-References: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Wed, 1 Jan 2025 14:03:45 +0000
-Subject: [PATCH 08/10] Revert "PR 32391 testcase"
-
-This reverts commit c8fcfa9aad211dfd8296ae6e978a356797936c61.
----
- gas/testsuite/gas/macros/nesting.s | 120 ++++++++++++++---------------
- 1 file changed, 60 insertions(+), 60 deletions(-)
-
-diff --git a/gas/testsuite/gas/macros/nesting.s b/gas/testsuite/gas/macros/nesting.s
-index 9746ca183ef..438d5af8d00 100644
---- a/gas/testsuite/gas/macros/nesting.s
-+++ b/gas/testsuite/gas/macros/nesting.s
-@@ -1,104 +1,104 @@
-- .text
-+
-+	.text
- /* PR 32391: Automatic counters inside macros should increment when nested
--   macros finish execution.  */
-- .macro o1
-- .global before_at_\@
-+	macros finish execution.  */
-+.macro o1
-+.global before_at_\@
- before_at_\@:
-- .global before_plus_\+
-+.global before_plus_\+
- before_plus_\+:
- 
-- .macro i1
-- .global inside_at_\@
-+	.macro i1
-+.global inside_at_\@
- inside_at_\@:
-- .global inside_plus_\+
-+.global inside_plus_\+
- inside_plus_\+:
-- .endm
-+	.endm
- 
-- i1
-- i1
-+	i1
-+	i1
- 
-- .global after_at_\@
-+.global after_at_\@
- after_at_\@:
-- .global after_plus_\+
-+.global after_plus_\+
- after_plus_\+:
- 
-- .endm
-+.endm
- 
- /* Invoking o1 should produce these symbols in this order:
- 
--   before_at_0
--   before_plus_0
--   inside_at_1
--   inside_plus_0
--   inside_at_2
--   inside_plus_1
--   after_at_0
--   after_plus_0  */
-- o1
--
-+	before_at_0
-+	before_plus_0
-+	inside_at_1
-+	inside_plus_0
-+	inside_at_2
-+	inside_plus_1
-+	after_at_0
-+	after_plus_0  */
-+o1
-+	
- /* A second invocation of o1 should not produce any errors about
--   symbols or macros being redefined.  */
-- o1
--
-+	symbols or macros being redefined.  */
-+o1
-+	
- /* This definition should not collide with the definition inside o1.  */
-- .macro i1
-- .global other_inner_\@
-+.macro i1
-+.global other_inner_\@
- other_inner_\@:
-- .endm
-+.endm 
- 
--/* And invoking it should invoke the second defintion of i1, not the first.  */
-- i1
--
-- .macro o2
-- .global _m\@_
-+/* And invoking it should invoke the second defintion of i1, not the first.  */	
-+i1
-+		
-+.macro o2
-+.global _m\@_
- _m\@_:
-- .macro i2
-- .global _m\@_
-+.macro i2
-+.global _m\@_
- _m\@_:
-- .endm
-- i2
-- .endm
-+.endm
-+i2
-+.endm
- 
- /* This should not generate conflicting symbols because the assembler
-    inserts the contents of o2 into the input buffer as pure text (ie
-    without evaluating i2).  The first use of \@ is evaluated at this
-    time, creating _m4_.  But the second use is not evaluated because
-    it is inside a .macro definition.
--
-+	
-    This finishes the evaluation of o2, so the \@ counter is incremented.
--
-+	
-    Next the input buffer is re-evaluated and the i2 macro definition
-    and invocation are encounterd.  The text from i2 are inserted into
-    the input buffer and at this point the second use of \@ is evaluated
-    resulting in the creation of a symbol called _m5_.  */
-- o2
-+o2
- 
- /* Macro arguments should be independent of nesting.  */
-- .macro O3 arg
-- .global o3_\arg
-+.macro O3 arg
-+.global o3_\arg
- o3_\arg:
- 
-- .macro I3 arg
-- .global i3_\arg
-+	.macro I3 arg
-+.global i3_\arg
- i3_\arg:
-- .endm
-+       .endm
- 
-- i3 bar		/* Macro names are case insensitive.  */
-- .endm
-+	i3 bar		/* Macro names are case insensitive.  */
-+.endm
- 
-- o3 foo		/* Should produce two labels: o3_foo and i3_bar.  */
-+o3 foo	/* Should produce two labels: o3_foo and i3_bar.  */
- 
- /* Nested macros can access the arguments of their parents.
-    In addition their arguments can be substituted into the arguments
-    that are substited from their parents:  */
-- .macro OUTER arg1, arg2, arg3:vararg
-- .macro INNER arg4 arg2
-+.macro OUTER arg1, arg2, arg3:vararg
-+     .macro INNER arg4 arg2
-         .dc.a \arg2
-- .dc.a \arg3
-- .endm
-- INNER \arg1 bert
-- .dc.a \arg2
-- .endm
-+	.dc.a \arg3
-+     .endm
-+     INNER \arg1 bert
-+	.dc.a \arg2
-+.endm
- 
--/* This produces references to "jim", "bert" and "harryfred".  */
-- OUTER fred, jim, harry\arg4
-+OUTER fred, jim, harry\arg4 /* This produces references to "jim", "bert" and "harryfred".  */
--- 
-2.47.1
-

diff --git a/9999/0009-Revert-Fix-error-macro-may-be-used-uninitialized.patch b/9999/0009-Revert-Fix-error-macro-may-be-used-uninitialized.patch
deleted file mode 100644
index dd6ff9a..0000000
--- a/9999/0009-Revert-Fix-error-macro-may-be-used-uninitialized.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 44100045e8d1df5df3578d60206df94498bcd236 Mon Sep 17 00:00:00 2001
-Message-ID: <44100045e8d1df5df3578d60206df94498bcd236.1735740264.git.sam@gentoo.org>
-In-Reply-To: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
-References: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Wed, 1 Jan 2025 14:03:46 +0000
-Subject: [PATCH 09/10] Revert "Fix error: macro may be used uninitialized"
-
-This reverts commit f404dc565a4ccfe6922b45cf5526c319aedf75d6.
----
- gas/macro.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/gas/macro.c b/gas/macro.c
-index 5fa2011ab7a..c1b43e76a61 100644
---- a/gas/macro.c
-+++ b/gas/macro.c
-@@ -1411,6 +1411,7 @@ check_macro (const char *line, sb *expand,
- {
-   const char *s;
-   char *copy, *cls;
-+  macro_entry *macro;
-   sb line_sb;
- 
-   if (! macros_defined)
-@@ -1430,8 +1431,8 @@ check_macro (const char *line, sb *expand,
-   for (cls = copy; *cls != '\0'; cls ++)
-     *cls = TOLOWER (*cls);
- 
--  macro_entry *macro = NULL;
--  for (int i = macro_nesting_depth; i >= 0; i--)
-+  int i;
-+  for (i = macro_nesting_depth; i >= 0; i--)
-     {
-       macro = str_hash_find (macro_hash[i], copy);
-       if (macro != NULL)
--- 
-2.47.1
-

diff --git a/9999/0010-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch b/9999/0010-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
deleted file mode 100644
index 3a3b6c0..0000000
--- a/9999/0010-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
+++ /dev/null
@@ -1,900 +0,0 @@
-From cfb2c161d55d2a4ab5ab3729b16ad364c8ec1c3f Mon Sep 17 00:00:00 2001
-Message-ID: <cfb2c161d55d2a4ab5ab3729b16ad364c8ec1c3f.1735740264.git.sam@gentoo.org>
-In-Reply-To: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
-References: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Wed, 1 Jan 2025 14:03:46 +0000
-Subject: [PATCH 10/10] Revert "Fix the handling or arguments and macro
- pseudo-variables inside nested assembler macros."
-
-This reverts commit 9f2e3c21f6506f081f1360f02b847606e0e00995.
----
- gas/config/tc-iq2000.c              |   6 +-
- gas/doc/as.texi                     |  60 +------
- gas/input-scrub.c                   |   7 +-
- gas/macro.c                         | 270 +++++-----------------------
- gas/macro.h                         |  17 +-
- gas/read.c                          |  15 +-
- gas/testsuite/gas/macros/macros.exp |   1 -
- gas/testsuite/gas/macros/nesting.d  |  28 ---
- gas/testsuite/gas/macros/nesting.s  | 104 -----------
- 9 files changed, 64 insertions(+), 444 deletions(-)
- delete mode 100644 gas/testsuite/gas/macros/nesting.d
- delete mode 100644 gas/testsuite/gas/macros/nesting.s
-
-diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c
-index 8dc3b768e3a..c65f264528f 100644
---- a/gas/config/tc-iq2000.c
-+++ b/gas/config/tc-iq2000.c
-@@ -105,6 +105,8 @@ struct iq2000_hi_fixup
- /* The list of unmatched HI relocs.  */
- static struct iq2000_hi_fixup * iq2000_hi_fixup_list;
- 
-+/* Macro hash table, which we will add to.  */
-+extern struct htab *macro_hash;
- \f
- const char md_shortopts[] = "";
- const struct option md_longopts[] =
-@@ -277,7 +279,9 @@ iq2000_add_macro (const char *  name,
- 	}
-     }
- 
--  (void) add_macro (macro, true);
-+  str_hash_insert (macro_hash, macro->name, macro, 1);
-+
-+  macro_defined = 1;
- }
- 
- static void
-diff --git a/gas/doc/as.texi b/gas/doc/as.texi
-index 69d6d3c88b0..c9f65a47125 100644
---- a/gas/doc/as.texi
-+++ b/gas/doc/as.texi
-@@ -6215,12 +6215,7 @@ With that definition, @samp{SUM 0,5} is equivalent to this assembly input:
- @item .macro @var{macname}
- @itemx .macro @var{macname} @var{macargs} @dots{}
- @cindex @code{macro} directive
--Begin the definition of a macro called @var{macname}.  Macro names are case
--insensitive.  Macro definitions can be nested, although their behaviour is
--sometimes counter intuitive.  Nested macros only have scope within their
--defining macro.
--
--If your macro
-+Begin the definition of a macro called @var{macname}.  If your macro
- definition requires arguments, specify their names after the macro name,
- separated by commas or spaces.  You can qualify the macro argument to
- indicate whether all invocations must specify a non-blank value (through
-@@ -6385,29 +6380,6 @@ adjacent string literals - even if separated only by a blank - will not be
- concatenated when determining macro arguments, even if they're only separated
- by white space.  This is unlike certain other pseudo ops, e.g. @code{.ascii}.
- 
--Nested macros can access the arguments of their parents.  But also if their
--argument names clash with those of their parents, their versions are used.  So
--for example:
--
--@smallexample
--.macro OUTER arg1, arg2, arg3:vararg
--     .macro INNER arg4 arg2
--        .dc.a \arg2
--	.dc.a \arg3
--     .endm
--     INNER \arg1 bert
--	.dc.a \arg2
--.endm
--
--OUTER fred, jim, harry\arg4
--@end smallexample
--
--This will generate references to symbols called @samp{jim} - from the
--definition of the OUTER macro, @samp{bert} - from the definition in INNER
--where arg2 has been overridden and @samp{harryfred} - from the definition in
--INNER where the value of arg3 from OUTER is used, but with the value of arg4
--substituted into the symbol.
--
- @item .endm
- @cindex @code{endm} directive
- Mark the end of a macro definition.
-@@ -6423,33 +6395,6 @@ Exit early from the current macro definition.
- executed in this pseudo-variable; you can copy that number to your
- output with @samp{\@@}, but @emph{only within a macro definition}.
- 
--Note - the @samp{\@@} counter is incremented at the end of the expansion of a
--macro, but before the contents of any nested macros are evaluated.  This can
--lead to counter-intuitive behaviour when nested macros are used.  For example:
--
--@smallexample
--  .macro o
--    .macro i
--    _i\@@_:
--    .endm
--    i
--    _o\@@_:
--  .endm
--  o
--@end smallexample
--
--Produces two symbols @samp{_o0_} and @samp{_i1_}.  This happens because the
--@samp{o} macro executes entirely first, putting the definition and invocation
--of the @samp{i} macro into the input buffer.  It also puts the definition of
--the @samp{_o\@@_} symbol into the input buffer, evaluating the @samp{\@@}
--counter in the process and so generating a symbol called @samp{_o0_}.
--
--That finishes the invocation of @samp{o} so the @samp{\@@} counter is
--incremented.  Then the input buffer is re-evaluated and the definition and
--invocation of macro @samp{i} is found.  This results in @samp{_i\@@_} being put
--into the input buffer and this time @samp{\@@} evaluates to 1, so the symbol
--created is @samp{_i1_}.
--
- @cindex number of times a macro has been executed
- @cindex macro, execution count
- @item \+
-@@ -6736,9 +6681,6 @@ those explicitly specified with @code{.eject}.
- Undefine the macro @var{name}, so that later uses of the string will not be
- expanded.  @xref{Macro}.
- 
--Note - nested macros are automatically purged at the end of the macro that
--defines them.
--
- @ifset ELF
- @node PushSection
- @section @code{.pushsection @var{name} [, @var{subsection}] [, "@var{flags}"[, @@@var{type}[,@var{arguments}]]]}
-diff --git a/gas/input-scrub.c b/gas/input-scrub.c
-index 3433bc6472d..2e0ce832b2b 100644
---- a/gas/input-scrub.c
-+++ b/gas/input-scrub.c
-@@ -23,7 +23,6 @@
- #include "input-file.h"
- #include "sb.h"
- #include "listing.h"
--#include "macro.h"
- 
- /*
-  * O/S independent module to supply buffers of sanitised source code
-@@ -291,13 +290,12 @@ input_scrub_include_sb (sb *from, char *position, enum expansion expansion)
-       ++macro_nest;
-     }
- 
-+#ifdef md_macro_start
-   if (expansion == expanding_macro)
-     {
--#ifdef md_macro_start
-       md_macro_start ();
--#endif
--      increment_macro_nesting_depth ();
-     }
-+#endif
- 
-   next_saved_file = input_scrub_push (position);
- 
-@@ -352,7 +350,6 @@ input_scrub_next_buffer (char **bufp)
- 	         data.  */
- 	      md_macro_end ();
- #endif
--	      decrement_macro_nesting_depth ();
- 	    }
- 	  if (from_sb_expansion != expanding_app)
- 	    --macro_nest;
-diff --git a/gas/macro.c b/gas/macro.c
-index c1b43e76a61..5ae76c6e661 100644
---- a/gas/macro.c
-+++ b/gas/macro.c
-@@ -44,24 +44,11 @@
- 
- /* The macro hash table.  */
- 
--/* Macro nesting depth.  Similar to macro_nest defined in sb.c, but this
--   counter is specific to macros, whereas macro_nest also counts repeated
--   string blocks.  */
--static unsigned int macro_nesting_depth;
-+htab_t macro_hash;
- 
--/* Maximum nesting depth.  Ideally the same as the value of max_macro_nest
--   as defined in as.c (ie 100).  But there is one test in the assembler
--   testsuite (bfin/allinsn16.s) that nests macros to a depth of 8192.  So
--   we have a ridiculously large number here.  */
--#define MAX_MACRO_DEPTH 8193
-+/* Whether any macros have been defined.  */
- 
--static htab_t macro_hash[MAX_MACRO_DEPTH];
--
--/* Whether any macros have been defined.
--   FIXME:  This could be a counter that is incremented
--   with .macro and decremented with .purgem.  */
--
--static bool macros_defined = false;
-+int macro_defined;
- 
- /* Whether we should strip '@' characters.  */
- 
-@@ -73,18 +60,6 @@ static unsigned int macro_number;
- 
- static void free_macro (macro_entry *);
- 
--bool
--add_macro (macro_entry * macro, bool replace)
--{
--  if (str_hash_insert (macro_hash [macro_nesting_depth],
--		       macro->name, macro, replace) == NULL)
--    {
--      macros_defined = true;
--      return true;
--    }
--  return false;
--}
--
- static void
- macro_del_f (void *ent)
- {
-@@ -97,23 +72,15 @@ macro_del_f (void *ent)
- void
- macro_init (void)
- {
--  int i;
--
--  for (i = 0; i < MAX_MACRO_DEPTH; i++)
--    macro_hash[i] = htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
--				       macro_del_f, notes_calloc, NULL);
--  macros_defined = false;
-+  macro_hash = htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
-+				  macro_del_f, notes_calloc, NULL);
-+  macro_defined = 0;
- }
- 
- void
- macro_end (void)
- {
--  int i;
--
--  for (i = MAX_MACRO_DEPTH; i--;)
--    htab_delete (macro_hash[i]);
--
--  macros_defined = false;
-+  htab_delete (macro_hash);
- }
- 
- /* Read input lines till we get to a TO string.
-@@ -688,13 +655,6 @@ free_macro (macro_entry *macro)
-   free (macro);
- }
- 
--static macro_entry * last_recorded_macro = NULL;
--void
--macro_record_invocation (macro_entry * macro)
--{
--  last_recorded_macro = macro;
--}
--
- /* Define a new macro.  */
- 
- macro_entry *
-@@ -758,19 +718,15 @@ define_macro (sb *in, sb *label, size_t (*get_line) (sb *))
-   /* And stick it in the macro hash table.  */
-   for (idx = 0; idx < name.len; idx++)
-     name.ptr[idx] = TOLOWER (name.ptr[idx]);
--
--  if (macro_nesting_depth > 0)
--    macro->parent = last_recorded_macro;
--  else
--    macro->parent = NULL;
--
-   if (!error)
-     {
--      if (! add_macro (macro, false))
-+      if (str_hash_insert (macro_hash, macro->name, macro, 0) != NULL)
- 	error = _("Macro `%s' was already defined");
-     }
- 
--  if (error != NULL)
-+  if (!error)
-+    macro_defined = 1;
-+  else
-     {
-       as_bad_where (macro->file, macro->line, error, macro->name);
-       free_macro (macro);
-@@ -794,25 +750,11 @@ get_apost_token (size_t idx, sb *in, sb *name, int kind)
-   return idx;
- }
- 
--static const char *
--macro_expand_body (sb *, sb *, formal_entry *, struct htab *,
--		   const macro_entry *, unsigned int);
--
--/* Find the actual value for a formal parameter starting at START inside IN.
--    Appends the value of parameter onto OUT.
--   The hash table of formal parameters is provided by FORMAL_HASH.
--   The character that indicated the presense of a formal parameter is passed
--    in KIND.
--   If COPYIFNOTTHERE is true and the parameter is not found in the hash table
--    then it is appended as plain text onto OUT.
--   The macro containing the formal parameters is passed in MACRO.
--    This can be empty.
--   Returns the offset inside IN after advanceing past the parameter.
--   Also stores the parameter's name into T.  */
-+/* Substitute the actual value for a formal parameter.  */
- 
- static size_t
- sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
--	    int kind, sb *out, int copyifnotthere, const macro_entry * macro)
-+	    int kind, sb *out, int copyifnotthere)
- {
-   size_t src;
-   formal_entry *ptr;
-@@ -826,12 +768,16 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
-     ptr = NULL;
-   else
-     ptr = str_hash_find (formal_hash, sb_terminate (t));
--  
-   if (ptr)
-     {
--      sb * add = ptr->actual.len ? &ptr->actual : &ptr->def;
--
--      sb_add_sb (out, add);
-+      if (ptr->actual.len)
-+	{
-+	  sb_add_sb (out, &ptr->actual);
-+	}
-+      else
-+	{
-+	  sb_add_sb (out, &ptr->def);
-+	}
-     }
-   else if (kind == '&')
-     {
-@@ -845,55 +791,6 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
-     {
-       sb_add_sb (out, t);
-     }
--  else if (!macro_strip_at
--	   && macro_nesting_depth > 0
--	   && macro != NULL
--	   && macro->parent != NULL)
--    {
--      const macro_entry * orig_macro = macro;
--      bool success = false;
--
--      /* We have failed to find T, but we are inside nested macros.  So check
--	 the parent macros so see if they have a FORMAL that matches T.  */
--      while (macro->parent != NULL)
--	{
--	  macro = macro->parent;
--
--	  ptr = str_hash_find (macro->formal_hash, t->ptr);
--	  if (ptr == NULL)
--	    continue;
--
--	  sb * add = ptr->actual.len ? &ptr->actual : &ptr->def;
--
--	  /* The parent's FORMALs might contain parameters that need further
--	     substitution.  See gas/testsuite/gas/arm/macro-vld1.s for an
--	     example of this.  */
--	  if (strchr (add->ptr, '\\'))
--	    {
--	      sb newadd;
--
--	      sb_new (&newadd);
--	      /* FIXME: Should we do something if the call to
--		 macro_expand_body returns an error message ?  */
--	      (void) macro_expand_body (add, &newadd, NULL, NULL,
--					orig_macro, orig_macro->count);
--	      sb_add_sb (out, &newadd);
--	    }
--	  else
--	    {
--	      sb_add_sb (out, add);
--	    }
--	  success = true;
--	  break;
--	}
--      if (! success)
--	{
--	  /* We reached the outermost macro and failed to find T, so
--	     just copy the entire parameter as is.  */
--	  sb_add_char (out, '\\');
--	  sb_add_sb (out, t);
--	}
--    }
-   else
-     {
-       sb_add_char (out, '\\');
-@@ -902,12 +799,7 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
-   return src;
- }
- 
--/* Expands the body of a macro / block of text IN, copying it into OUT.
--   Parameters for substitution are found in FORMALS and FORMAL_HASH or
--   MACRO.
--   The number of times that this macro / block of text have already been
--   copied into the output is held in INSTANCE.
--   Returns NULL upon success or an error message otherwise.  */
-+/* Expand the body of a macro.  */
- 
- static const char *
- macro_expand_body (sb *in, sb *out, formal_entry *formals,
-@@ -919,38 +811,18 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
-   int inquote = 0, macro_line = 0;
-   formal_entry *loclist = NULL;
-   const char *err = NULL;
--  int nesting = 0;
- 
--  if (formals == NULL && macro != NULL)
--    formals = macro->formals;
--
--  if (formal_hash == NULL && macro != NULL)
--    formal_hash = macro->formal_hash;
--  
-   sb_new (&t);
- 
-   while (src < in->len && !err)
-     {
--      if (in->ptr[src] == '.')
--	{
--	  /* Check to see if we have encountered ".macro" or ".endm" */
--	  if (in->len > src + 5
--	      && strncmp (in->ptr + src, ".macro", 6) == 0)
--	    ++ nesting;
--
--	  else if (in->len > src + 4
--		   && strncmp (in->ptr + src, ".endm", 5) == 0)
--	    -- nesting;
--	}
--
-       if (in->ptr[src] == '&')
- 	{
- 	  sb_reset (&t);
- 	  if (flag_mri)
- 	    {
- 	      if (src + 1 < in->len && in->ptr[src + 1] == '&')
--		src = sub_actual (src + 2, in, &t, formal_hash,
--				  '\'', out, 1, macro);
-+		src = sub_actual (src + 2, in, &t, formal_hash, '\'', out, 1);
- 	      else
- 		sb_add_char (out, in->ptr[src++]);
- 	    }
-@@ -958,8 +830,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
- 	    {
- 	      /* Permit macro parameter substitution delineated with
- 		 an '&' prefix and optional '&' suffix.  */
--	      src = sub_actual (src + 1, in, &t, formal_hash,
--				'&', out, 0, macro);
-+	      src = sub_actual (src + 1, in, &t, formal_hash, '&', out, 0);
- 	    }
- 	}
-       else if (in->ptr[src] == '\\')
-@@ -980,12 +851,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
- 	      else
- 		as_bad_where (macro->file, macro->line + macro_line, _("missing `)'"));
- 	    }
--	  else if (src < in->len
--		   && in->ptr[src] == '@'
--		   /* PR 32391: Do not perform the substition inside nested
--		      macros.  Instead wait until they are re-evaluated and
--		      perform the substition then.  */
--		   && ! nesting)
-+	  else if (src < in->len && in->ptr[src] == '@')
- 	    {
- 	      /* Sub in the total macro invocation number.  */
- 
-@@ -994,12 +860,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
- 	      sprintf (buffer, "%u", macro_number);
- 	      sb_add_string (out, buffer);
- 	    }
--	  else if (src < in->len
--		   && in->ptr[src] == '+'
--		   /* PR 32391: Do not perform the substition inside nested
--		      macros.  Instead wait until they are re-evaluated and
--		      perform the substition then.  */
--		   && ! nesting)
-+	  else if (src < in->len && in->ptr[src] == '+')
- 	    {
- 	      /* Sub in the current macro invocation number.  */
- 
-@@ -1043,18 +904,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
- 	  else
- 	    {
- 	      sb_reset (&t);
--
--	      if (nesting)
--		{
--		  src = get_apost_token (src, in, &t, '\'');
--		  sb_add_char (out, '\\');
--		  sb_add_sb (out, &t);
--		}
--	      else
--		{
--		  src = sub_actual (src, in, &t, formal_hash,
--				    '\'', out, 0, macro);
--		}
-+	      src = sub_actual (src, in, &t, formal_hash, '\'', out, 0);
- 	    }
- 	}
-       else if ((flag_macro_alternate || flag_mri)
-@@ -1073,7 +923,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
- 	      sb_reset (&t);
- 	      src = sub_actual (src, in, &t, formal_hash,
- 				(macro_strip_at && inquote) ? '@' : '\'',
--				out, 1, macro);
-+				out, 1);
- 	    }
- 	  else
- 	    {
-@@ -1185,7 +1035,6 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
- 
-   if (!err && (out->len == 0 || out->ptr[out->len - 1] != '\n'))
-     sb_add_char (out, '\n');
--
-   return err;
- }
- 
-@@ -1370,7 +1219,8 @@ macro_expand (size_t idx, sb *in, macro_entry *m, sb *out)
- 	    }
- 	}
- 
--      err = macro_expand_body (&m->sub, out, NULL, NULL, m, m->count);
-+      err = macro_expand_body (&m->sub, out, m->formals, m->formal_hash, m,
-+			       m->count);
-     }
- 
-   /* Discard any unnamed formal arguments.  */
-@@ -1403,9 +1253,9 @@ macro_expand (size_t idx, sb *in, macro_entry *m, sb *out)
- }
- 
- /* Check for a macro.  If one is found, put the expansion into
--   *EXPAND.  Return TRUE if a macro is found, FALSE otherwise.  */
-+   *EXPAND.  Return 1 if a macro is found, 0 otherwise.  */
- 
--bool
-+int
- check_macro (const char *line, sb *expand,
- 	     const char **error, macro_entry **info)
- {
-@@ -1414,12 +1264,9 @@ check_macro (const char *line, sb *expand,
-   macro_entry *macro;
-   sb line_sb;
- 
--  if (! macros_defined)
--    return false;
--
-   if (! is_name_beginner (*line)
-       && (! flag_mri || *line != '.'))
--    return false;
-+    return 0;
- 
-   s = line + 1;
-   while (is_part_of_name (*s))
-@@ -1431,17 +1278,11 @@ check_macro (const char *line, sb *expand,
-   for (cls = copy; *cls != '\0'; cls ++)
-     *cls = TOLOWER (*cls);
- 
--  int i;
--  for (i = macro_nesting_depth; i >= 0; i--)
--    {
--      macro = str_hash_find (macro_hash[i], copy);
--      if (macro != NULL)
--	break;
--    }
-+  macro = str_hash_find (macro_hash, copy);
-   free (copy);
- 
-   if (macro == NULL)
--    return false;
-+    return 0;
- 
-   /* Wrap the line up in an sb.  */
-   sb_new (&line_sb);
-@@ -1457,7 +1298,7 @@ check_macro (const char *line, sb *expand,
-   if (info)
-     *info = macro;
- 
--  return true;
-+  return 1;
- }
- 
- /* Delete a macro.  */
-@@ -1475,20 +1316,11 @@ delete_macro (const char *name)
-     copy[i] = TOLOWER (name[i]);
-   copy[i] = '\0';
- 
--  int j;
--  for (j = macro_nesting_depth; j >= 0; j--)
--    {
--      macro = str_hash_find (macro_hash [j], copy);
--      if (macro != NULL)
--	{
--	  str_hash_delete (macro_hash[j], copy);
--	  break;
--	}
--    }
--
--  if (macro == NULL)
-+  macro = str_hash_find (macro_hash, copy);
-+  if (macro != NULL)
-+    str_hash_delete (macro_hash, copy);
-+  else
-     as_warn (_("Attempt to purge non-existing macro `%s'"), copy);
--
-   free (copy);
- }
- 
-@@ -1590,25 +1422,3 @@ expand_irp (int irpc, size_t idx, sb *in, sb *out, size_t (*get_line) (sb *))
- 
-   return err;
- }
--
--void
--increment_macro_nesting_depth (void)
--{
-- if (macro_nesting_depth >= (MAX_MACRO_DEPTH - 1))
--    as_fatal (_("macros nested too deeply"));
--  else
--    ++macro_nesting_depth;
--}
--
--void
--decrement_macro_nesting_depth (void)
--{
--  if (macro_nesting_depth == 0)
--    as_fatal (_("too much macro un-nesting"));
--  else
--    {
--      /* FIXME: Potential memory leak here.  */
--      htab_empty (macro_hash [macro_nesting_depth]);
--      --macro_nesting_depth;
--    }
--}
-diff --git a/gas/macro.h b/gas/macro.h
-index 55b28b2f82a..3ebcfe8c8fd 100644
---- a/gas/macro.h
-+++ b/gas/macro.h
-@@ -64,28 +64,31 @@ typedef struct macro_struct
-   int             formal_count;		/* Number of formal args.  */
-   formal_entry *  formals;		/* List of formal_structs.  */
-   htab_t          formal_hash;		/* Hash table of formals.  */
--  struct macro_struct * parent;         /* Parent of nested macros.  */
-   const char *    name;			/* Macro name.  */
-   const char *    file;			/* File the macro was defined in.  */
-   unsigned int    line;			/* Line number of definition.  */
-   unsigned int    count;                /* Invocation count.  */
- } macro_entry;
- 
--/* The macro/text block nesting level.  */
-+/* Whether any macros have been defined.  */
-+
-+extern int macro_defined;
-+
-+/* The macro nesting level.  */
- 
- extern int macro_nest;
- 
-+/* The macro hash table.  */
-+
-+extern htab_t macro_hash;
-+
- extern int buffer_and_nest (const char *, const char *, sb *,
- 			    size_t (*) (sb *));
- extern void macro_init (void);
- extern void macro_end (void);
- extern macro_entry *define_macro (sb *, sb *, size_t (*) (sb *));
--extern bool check_macro (const char *, sb *, const char **, macro_entry **);
-+extern int check_macro (const char *, sb *, const char **, macro_entry **);
- extern void delete_macro (const char *);
- extern const char *expand_irp (int, size_t, sb *, sb *, size_t (*) (sb *));
--extern void increment_macro_nesting_depth (void);
--extern void decrement_macro_nesting_depth (void);
--extern void macro_record_invocation (macro_entry *);
--extern bool add_macro (macro_entry *, bool);
- 
- #endif
-diff --git a/gas/read.c b/gas/read.c
-index 5be2686822d..6d0d4b5e31a 100644
---- a/gas/read.c
-+++ b/gas/read.c
-@@ -656,8 +656,7 @@ poend (void)
-     }
- 
- /* Helper function of read_a_source_file, which tries to expand a macro.  */
--
--static bool
-+static int
- try_macro (char term, const char *line)
- {
-   sb out;
-@@ -674,14 +673,12 @@ try_macro (char term, const char *line)
-       sb_kill (&out);
-       buffer_limit =
- 	input_scrub_next_buffer (&input_line_pointer);
--
--      macro_record_invocation (macro);
- #ifdef md_macro_info
-       md_macro_info (macro);
- #endif
--      return true;
-+      return 1;
-     }
--  return false;
-+  return 0;
- }
- 
- #ifdef HANDLE_BUNDLE
-@@ -1273,7 +1270,7 @@ read_a_source_file (const char *name)
- 			  s_ignore (0);
- 			  nul_char = next_char = *--input_line_pointer;
- 			  *input_line_pointer = '\0';
--			  if (! try_macro (next_char, s))
-+			  if (! macro_defined || ! try_macro (next_char, s))
- 			    {
- 			      *end = '\0';
- 			      as_bad (_("unknown pseudo-op: `%s'"), s);
-@@ -1310,7 +1307,7 @@ read_a_source_file (const char *name)
- 
- 		      generate_lineno_debug ();
- 
--		      if (try_macro (next_char, s))
-+		      if (macro_defined && try_macro (next_char, s))
- 			continue;
- 
- 		      if (mri_pending_align)
-@@ -2820,7 +2817,7 @@ s_macro (int ignore ATTRIBUTE_UNUSED)
- 	  as_warn_where (macro->file, macro->line,
- 			 _("attempt to redefine pseudo-op `%s' ignored"),
- 			 macro->name);
--	  delete_macro (macro->name);
-+	  str_hash_delete (macro_hash, macro->name);
- 	}
-     }
- 
-diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp
-index de3df4d803d..278cf405225 100644
---- a/gas/testsuite/gas/macros/macros.exp
-+++ b/gas/testsuite/gas/macros/macros.exp
-@@ -112,4 +112,3 @@ run_list_test count
- run_list_test irp-count
- run_list_test irpc-quote
- run_list_test rept-count
--run_dump_test nesting
-diff --git a/gas/testsuite/gas/macros/nesting.d b/gas/testsuite/gas/macros/nesting.d
-deleted file mode 100644
-index 2f44aedb2dc..00000000000
---- a/gas/testsuite/gas/macros/nesting.d
-+++ /dev/null
-@@ -1,28 +0,0 @@
--#nm: -j 
--#name: Nested macros (PR 32391)
--# Sone targets do not support macros used like this.
--#skip: tic*-*-* mmix-*
--
--#...
--_m7_
--_m8_
--after_at_0
--after_at_3
--after_plus_0
--after_plus_1
--before_at_0
--before_at_3
--before_plus_0
--before_plus_1
--bert
--harryfred
--i3_bar
--inside_at_1
--inside_at_2
--inside_at_4
--inside_at_5
--inside_plus_0
--inside_plus_1
--jim
--o3_foo
--other_inner_6
-diff --git a/gas/testsuite/gas/macros/nesting.s b/gas/testsuite/gas/macros/nesting.s
-deleted file mode 100644
-index 438d5af8d00..00000000000
---- a/gas/testsuite/gas/macros/nesting.s
-+++ /dev/null
-@@ -1,104 +0,0 @@
--
--	.text
--/* PR 32391: Automatic counters inside macros should increment when nested
--	macros finish execution.  */
--.macro o1
--.global before_at_\@
--before_at_\@:
--.global before_plus_\+
--before_plus_\+:
--
--	.macro i1
--.global inside_at_\@
--inside_at_\@:
--.global inside_plus_\+
--inside_plus_\+:
--	.endm
--
--	i1
--	i1
--
--.global after_at_\@
--after_at_\@:
--.global after_plus_\+
--after_plus_\+:
--
--.endm
--
--/* Invoking o1 should produce these symbols in this order:
--
--	before_at_0
--	before_plus_0
--	inside_at_1
--	inside_plus_0
--	inside_at_2
--	inside_plus_1
--	after_at_0
--	after_plus_0  */
--o1
--	
--/* A second invocation of o1 should not produce any errors about
--	symbols or macros being redefined.  */
--o1
--	
--/* This definition should not collide with the definition inside o1.  */
--.macro i1
--.global other_inner_\@
--other_inner_\@:
--.endm 
--
--/* And invoking it should invoke the second defintion of i1, not the first.  */	
--i1
--		
--.macro o2
--.global _m\@_
--_m\@_:
--.macro i2
--.global _m\@_
--_m\@_:
--.endm
--i2
--.endm
--
--/* This should not generate conflicting symbols because the assembler
--   inserts the contents of o2 into the input buffer as pure text (ie
--   without evaluating i2).  The first use of \@ is evaluated at this
--   time, creating _m4_.  But the second use is not evaluated because
--   it is inside a .macro definition.
--	
--   This finishes the evaluation of o2, so the \@ counter is incremented.
--	
--   Next the input buffer is re-evaluated and the i2 macro definition
--   and invocation are encounterd.  The text from i2 are inserted into
--   the input buffer and at this point the second use of \@ is evaluated
--   resulting in the creation of a symbol called _m5_.  */
--o2
--
--/* Macro arguments should be independent of nesting.  */
--.macro O3 arg
--.global o3_\arg
--o3_\arg:
--
--	.macro I3 arg
--.global i3_\arg
--i3_\arg:
--       .endm
--
--	i3 bar		/* Macro names are case insensitive.  */
--.endm
--
--o3 foo	/* Should produce two labels: o3_foo and i3_bar.  */
--
--/* Nested macros can access the arguments of their parents.
--   In addition their arguments can be substituted into the arguments
--   that are substited from their parents:  */
--.macro OUTER arg1, arg2, arg3:vararg
--     .macro INNER arg4 arg2
--        .dc.a \arg2
--	.dc.a \arg3
--     .endm
--     INNER \arg1 bert
--	.dc.a \arg2
--.endm
--
--OUTER fred, jim, harry\arg4 /* This produces references to "jim", "bert" and "harryfred".  */
--- 
-2.47.1
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2025-01-01 14:05 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2025-01-01 14:05 UTC (permalink / raw
  To: gentoo-commits

commit:     6832c5a8fb253c080d9fb43ba83210c67bcbe2a2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  1 14:04:51 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan  1 14:04:51 2025 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=6832c5a8

9999: add more more macro reverts

Bug: https://sourceware.org/PR32484
Bug: https://sourceware.org/PR32486
Bug: https://sourceware.org/PR32487
Signed-off-by: Sam James <sam <AT> gentoo.org>

 9999/0006-Revert-PR-32391-memory-leak.patch        | 28 +++++++++++++++++
 ...-Revert-macro.c-871-heap-buffer-overflow.patch} | 14 ++++-----
 ...e.patch => 0008-Revert-PR-32391-testcase.patch} | 12 ++++----
 ...ix-error-macro-may-be-used-uninitialized.patch} | 14 ++++-----
 ...he-handling-or-arguments-and-macro-pseud.patch} | 36 +++++++++++-----------
 5 files changed, 66 insertions(+), 38 deletions(-)

diff --git a/9999/0006-Revert-PR-32391-memory-leak.patch b/9999/0006-Revert-PR-32391-memory-leak.patch
new file mode 100644
index 0000000..a20c54d
--- /dev/null
+++ b/9999/0006-Revert-PR-32391-memory-leak.patch
@@ -0,0 +1,28 @@
+From 4bed21d47f9d838dc6b55ce026989ede4eacc789 Mon Sep 17 00:00:00 2001
+Message-ID: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Wed, 1 Jan 2025 14:03:43 +0000
+Subject: [PATCH 06/10] Revert "PR 32391 memory leak"
+
+This reverts commit 599739cc1c5d70ac958583130b4b5413aa101d8e.
+---
+ gas/macro.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/gas/macro.c b/gas/macro.c
+index 9eefc8360b1..9670b38c152 100644
+--- a/gas/macro.c
++++ b/gas/macro.c
+@@ -878,7 +878,6 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
+ 	      (void) macro_expand_body (add, &newadd, NULL, NULL,
+ 					orig_macro, orig_macro->count);
+ 	      sb_add_sb (out, &newadd);
+-	      sb_kill (&newadd);
+ 	    }
+ 	  else
+ 	    {
+
+base-commit: 94e2b2a770fc49e42c9baec80f4fb88f63391a4e
+-- 
+2.47.1
+

diff --git a/9999/0006-Revert-macro.c-871-heap-buffer-overflow.patch b/9999/0007-Revert-macro.c-871-heap-buffer-overflow.patch
similarity index 65%
rename from 9999/0006-Revert-macro.c-871-heap-buffer-overflow.patch
rename to 9999/0007-Revert-macro.c-871-heap-buffer-overflow.patch
index 4d0ac10..b461443 100644
--- a/9999/0006-Revert-macro.c-871-heap-buffer-overflow.patch
+++ b/9999/0007-Revert-macro.c-871-heap-buffer-overflow.patch
@@ -1,8 +1,10 @@
-From a6aac087c94bab6335335e24aa9ab58ce0682859 Mon Sep 17 00:00:00 2001
-Message-ID: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
+From 7daa5da3eab39e733f40eccbf4f6cd2078e3335e Mon Sep 17 00:00:00 2001
+Message-ID: <7daa5da3eab39e733f40eccbf4f6cd2078e3335e.1735740264.git.sam@gentoo.org>
+In-Reply-To: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
+References: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>
-Date: Thu, 26 Dec 2024 01:15:13 +0000
-Subject: [PATCH 1/4] Revert "macro.c:871 heap-buffer-overflow"
+Date: Wed, 1 Jan 2025 14:03:44 +0000
+Subject: [PATCH 07/10] Revert "macro.c:871 heap-buffer-overflow"
 
 This reverts commit 6d9b7667974372357fed1f02c54a805f8c21dcde.
 ---
@@ -10,7 +12,7 @@ This reverts commit 6d9b7667974372357fed1f02c54a805f8c21dcde.
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/gas/macro.c b/gas/macro.c
-index ded0645be8d..3d5a9f14341 100644
+index 9670b38c152..5fa2011ab7a 100644
 --- a/gas/macro.c
 +++ b/gas/macro.c
 @@ -868,7 +868,7 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
@@ -31,8 +33,6 @@ index ded0645be8d..3d5a9f14341 100644
      as_warn (_("Attempt to purge non-existing macro `%s'"), copy);
  
    free (copy);
-
-base-commit: fa93e88f754e10dfb60dd4c9bf9cef858d4c7e4a
 -- 
 2.47.1
 

diff --git a/9999/0007-Revert-PR-32391-testcase.patch b/9999/0008-Revert-PR-32391-testcase.patch
similarity index 91%
rename from 9999/0007-Revert-PR-32391-testcase.patch
rename to 9999/0008-Revert-PR-32391-testcase.patch
index 5cfdeec..4376e58 100644
--- a/9999/0007-Revert-PR-32391-testcase.patch
+++ b/9999/0008-Revert-PR-32391-testcase.patch
@@ -1,10 +1,10 @@
-From bf07b8ac6f4c0ffe4977951d099c09c50fbe0c29 Mon Sep 17 00:00:00 2001
-Message-ID: <bf07b8ac6f4c0ffe4977951d099c09c50fbe0c29.1735175975.git.sam@gentoo.org>
-In-Reply-To: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
-References: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
+From da631c6ce21783acebd2dc44b834fd17c84a0381 Mon Sep 17 00:00:00 2001
+Message-ID: <da631c6ce21783acebd2dc44b834fd17c84a0381.1735740264.git.sam@gentoo.org>
+In-Reply-To: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
+References: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>
-Date: Tue, 24 Dec 2024 06:25:51 +0000
-Subject: [PATCH 2/4] Revert "PR 32391 testcase"
+Date: Wed, 1 Jan 2025 14:03:45 +0000
+Subject: [PATCH 08/10] Revert "PR 32391 testcase"
 
 This reverts commit c8fcfa9aad211dfd8296ae6e978a356797936c61.
 ---

diff --git a/9999/0008-Revert-Fix-error-macro-may-be-used-uninitialized.patch b/9999/0009-Revert-Fix-error-macro-may-be-used-uninitialized.patch
similarity index 66%
rename from 9999/0008-Revert-Fix-error-macro-may-be-used-uninitialized.patch
rename to 9999/0009-Revert-Fix-error-macro-may-be-used-uninitialized.patch
index 52cbc39..dd6ff9a 100644
--- a/9999/0008-Revert-Fix-error-macro-may-be-used-uninitialized.patch
+++ b/9999/0009-Revert-Fix-error-macro-may-be-used-uninitialized.patch
@@ -1,10 +1,10 @@
-From cc2fcd3f83d79ca491c61654b94e267386cdab3a Mon Sep 17 00:00:00 2001
-Message-ID: <cc2fcd3f83d79ca491c61654b94e267386cdab3a.1735175975.git.sam@gentoo.org>
-In-Reply-To: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
-References: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
+From 44100045e8d1df5df3578d60206df94498bcd236 Mon Sep 17 00:00:00 2001
+Message-ID: <44100045e8d1df5df3578d60206df94498bcd236.1735740264.git.sam@gentoo.org>
+In-Reply-To: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
+References: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>
-Date: Tue, 24 Dec 2024 06:25:57 +0000
-Subject: [PATCH 3/4] Revert "Fix error: macro may be used uninitialized"
+Date: Wed, 1 Jan 2025 14:03:46 +0000
+Subject: [PATCH 09/10] Revert "Fix error: macro may be used uninitialized"
 
 This reverts commit f404dc565a4ccfe6922b45cf5526c319aedf75d6.
 ---
@@ -12,7 +12,7 @@ This reverts commit f404dc565a4ccfe6922b45cf5526c319aedf75d6.
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/gas/macro.c b/gas/macro.c
-index 3d5a9f14341..a0f2a5c764c 100644
+index 5fa2011ab7a..c1b43e76a61 100644
 --- a/gas/macro.c
 +++ b/gas/macro.c
 @@ -1411,6 +1411,7 @@ check_macro (const char *line, sb *expand,

diff --git a/9999/0009-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch b/9999/0010-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
similarity index 96%
rename from 9999/0009-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
rename to 9999/0010-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
index e24e8d2..3a3b6c0 100644
--- a/9999/0009-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
+++ b/9999/0010-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
@@ -1,10 +1,10 @@
-From 499b2dbc38cbd668b62704165ee572c6ab784a4e Mon Sep 17 00:00:00 2001
-Message-ID: <499b2dbc38cbd668b62704165ee572c6ab784a4e.1735175975.git.sam@gentoo.org>
-In-Reply-To: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
-References: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
+From cfb2c161d55d2a4ab5ab3729b16ad364c8ec1c3f Mon Sep 17 00:00:00 2001
+Message-ID: <cfb2c161d55d2a4ab5ab3729b16ad364c8ec1c3f.1735740264.git.sam@gentoo.org>
+In-Reply-To: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
+References: <4bed21d47f9d838dc6b55ce026989ede4eacc789.1735740264.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>
-Date: Tue, 24 Dec 2024 06:26:16 +0000
-Subject: [PATCH 4/4] Revert "Fix the handling or arguments and macro
+Date: Wed, 1 Jan 2025 14:03:46 +0000
+Subject: [PATCH 10/10] Revert "Fix the handling or arguments and macro
  pseudo-variables inside nested assembler macros."
 
 This reverts commit 9f2e3c21f6506f081f1360f02b847606e0e00995.
@@ -23,7 +23,7 @@ This reverts commit 9f2e3c21f6506f081f1360f02b847606e0e00995.
  delete mode 100644 gas/testsuite/gas/macros/nesting.s
 
 diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c
-index 1cbc578281f..2198ffda2b9 100644
+index 8dc3b768e3a..c65f264528f 100644
 --- a/gas/config/tc-iq2000.c
 +++ b/gas/config/tc-iq2000.c
 @@ -105,6 +105,8 @@ struct iq2000_hi_fixup
@@ -47,7 +47,7 @@ index 1cbc578281f..2198ffda2b9 100644
  
  static void
 diff --git a/gas/doc/as.texi b/gas/doc/as.texi
-index 1683594a0bb..6be54b57599 100644
+index 69d6d3c88b0..c9f65a47125 100644
 --- a/gas/doc/as.texi
 +++ b/gas/doc/as.texi
 @@ -6215,12 +6215,7 @@ With that definition, @samp{SUM 0,5} is equivalent to this assembly input:
@@ -139,7 +139,7 @@ index 1683594a0bb..6be54b57599 100644
  @node PushSection
  @section @code{.pushsection @var{name} [, @var{subsection}] [, "@var{flags}"[, @@@var{type}[,@var{arguments}]]]}
 diff --git a/gas/input-scrub.c b/gas/input-scrub.c
-index 25fac879a56..878edc8fd36 100644
+index 3433bc6472d..2e0ce832b2b 100644
 --- a/gas/input-scrub.c
 +++ b/gas/input-scrub.c
 @@ -23,7 +23,6 @@
@@ -175,7 +175,7 @@ index 25fac879a56..878edc8fd36 100644
  	  if (from_sb_expansion != expanding_app)
  	    --macro_nest;
 diff --git a/gas/macro.c b/gas/macro.c
-index a0f2a5c764c..8b376f7f490 100644
+index c1b43e76a61..5ae76c6e661 100644
 --- a/gas/macro.c
 +++ b/gas/macro.c
 @@ -44,24 +44,11 @@
@@ -642,7 +642,7 @@ index a0f2a5c764c..8b376f7f490 100644
 -    }
 -}
 diff --git a/gas/macro.h b/gas/macro.h
-index 97f2a5a4066..e87f64e70ca 100644
+index 55b28b2f82a..3ebcfe8c8fd 100644
 --- a/gas/macro.h
 +++ b/gas/macro.h
 @@ -64,28 +64,31 @@ typedef struct macro_struct
@@ -685,10 +685,10 @@ index 97f2a5a4066..e87f64e70ca 100644
  
  #endif
 diff --git a/gas/read.c b/gas/read.c
-index e5185f4ba26..589c7b080c2 100644
+index 5be2686822d..6d0d4b5e31a 100644
 --- a/gas/read.c
 +++ b/gas/read.c
-@@ -655,8 +655,7 @@ poend (void)
+@@ -656,8 +656,7 @@ poend (void)
      }
  
  /* Helper function of read_a_source_file, which tries to expand a macro.  */
@@ -698,7 +698,7 @@ index e5185f4ba26..589c7b080c2 100644
  try_macro (char term, const char *line)
  {
    sb out;
-@@ -673,14 +672,12 @@ try_macro (char term, const char *line)
+@@ -674,14 +673,12 @@ try_macro (char term, const char *line)
        sb_kill (&out);
        buffer_limit =
  	input_scrub_next_buffer (&input_line_pointer);
@@ -715,7 +715,7 @@ index e5185f4ba26..589c7b080c2 100644
  }
  
  #ifdef HANDLE_BUNDLE
-@@ -1272,7 +1269,7 @@ read_a_source_file (const char *name)
+@@ -1273,7 +1270,7 @@ read_a_source_file (const char *name)
  			  s_ignore (0);
  			  nul_char = next_char = *--input_line_pointer;
  			  *input_line_pointer = '\0';
@@ -724,7 +724,7 @@ index e5185f4ba26..589c7b080c2 100644
  			    {
  			      *end = '\0';
  			      as_bad (_("unknown pseudo-op: `%s'"), s);
-@@ -1309,7 +1306,7 @@ read_a_source_file (const char *name)
+@@ -1310,7 +1307,7 @@ read_a_source_file (const char *name)
  
  		      generate_lineno_debug ();
  
@@ -733,7 +733,7 @@ index e5185f4ba26..589c7b080c2 100644
  			continue;
  
  		      if (mri_pending_align)
-@@ -2819,7 +2816,7 @@ s_macro (int ignore ATTRIBUTE_UNUSED)
+@@ -2820,7 +2817,7 @@ s_macro (int ignore ATTRIBUTE_UNUSED)
  	  as_warn_where (macro->file, macro->line,
  			 _("attempt to redefine pseudo-op `%s' ignored"),
  			 macro->name);
@@ -743,7 +743,7 @@ index e5185f4ba26..589c7b080c2 100644
      }
  
 diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp
-index 94ac37cdb8b..3ac199feaa5 100644
+index de3df4d803d..278cf405225 100644
 --- a/gas/testsuite/gas/macros/macros.exp
 +++ b/gas/testsuite/gas/macros/macros.exp
 @@ -112,4 +112,3 @@ run_list_test count


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2024-12-26  1:21 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2024-12-26  1:21 UTC (permalink / raw
  To: gentoo-commits

commit:     d3feed6f35091e1269b51b59ecb1c406dc497e5d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 26 01:20:33 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 26 01:20:33 2024 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=d3feed6f

9999: add more more macro reverts

Bug: https://sourceware.org/PR32484
Bug: https://sourceware.org/PR32486
Bug: https://sourceware.org/PR32487
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...6-Revert-macro.c-871-heap-buffer-overflow.patch | 38 ++++++++++++++++++++++
 ...e.patch => 0007-Revert-PR-32391-testcase.patch} |  8 +++--
 ...ix-error-macro-may-be-used-uninitialized.patch} | 10 +++---
 ...he-handling-or-arguments-and-macro-pseud.patch} | 10 +++---
 4 files changed, 53 insertions(+), 13 deletions(-)

diff --git a/9999/0006-Revert-macro.c-871-heap-buffer-overflow.patch b/9999/0006-Revert-macro.c-871-heap-buffer-overflow.patch
new file mode 100644
index 0000000..4d0ac10
--- /dev/null
+++ b/9999/0006-Revert-macro.c-871-heap-buffer-overflow.patch
@@ -0,0 +1,38 @@
+From a6aac087c94bab6335335e24aa9ab58ce0682859 Mon Sep 17 00:00:00 2001
+Message-ID: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Thu, 26 Dec 2024 01:15:13 +0000
+Subject: [PATCH 1/4] Revert "macro.c:871 heap-buffer-overflow"
+
+This reverts commit 6d9b7667974372357fed1f02c54a805f8c21dcde.
+---
+ gas/macro.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gas/macro.c b/gas/macro.c
+index ded0645be8d..3d5a9f14341 100644
+--- a/gas/macro.c
++++ b/gas/macro.c
+@@ -868,7 +868,7 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
+ 	  /* The parent's FORMALs might contain parameters that need further
+ 	     substitution.  See gas/testsuite/gas/arm/macro-vld1.s for an
+ 	     example of this.  */
+-	  if (memchr (add->ptr, '\\', add->len))
++	  if (strchr (add->ptr, '\\'))
+ 	    {
+ 	      sb newadd;
+ 
+@@ -1485,7 +1485,7 @@ delete_macro (const char *name)
+ 	}
+     }
+ 
+-  if (j < 0)
++  if (macro == NULL)
+     as_warn (_("Attempt to purge non-existing macro `%s'"), copy);
+ 
+   free (copy);
+
+base-commit: fa93e88f754e10dfb60dd4c9bf9cef858d4c7e4a
+-- 
+2.47.1
+

diff --git a/9999/0006-Revert-PR-32391-testcase.patch b/9999/0007-Revert-PR-32391-testcase.patch
similarity index 92%
rename from 9999/0006-Revert-PR-32391-testcase.patch
rename to 9999/0007-Revert-PR-32391-testcase.patch
index d847d98..5cfdeec 100644
--- a/9999/0006-Revert-PR-32391-testcase.patch
+++ b/9999/0007-Revert-PR-32391-testcase.patch
@@ -1,8 +1,10 @@
-From 423c670c7d80a334fb9f10b71dcc68c022c2a2a5 Mon Sep 17 00:00:00 2001
-Message-ID: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
+From bf07b8ac6f4c0ffe4977951d099c09c50fbe0c29 Mon Sep 17 00:00:00 2001
+Message-ID: <bf07b8ac6f4c0ffe4977951d099c09c50fbe0c29.1735175975.git.sam@gentoo.org>
+In-Reply-To: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
+References: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>
 Date: Tue, 24 Dec 2024 06:25:51 +0000
-Subject: [PATCH 1/3] Revert "PR 32391 testcase"
+Subject: [PATCH 2/4] Revert "PR 32391 testcase"
 
 This reverts commit c8fcfa9aad211dfd8296ae6e978a356797936c61.
 ---

diff --git a/9999/0007-Revert-Fix-error-macro-may-be-used-uninitialized.patch b/9999/0008-Revert-Fix-error-macro-may-be-used-uninitialized.patch
similarity index 72%
rename from 9999/0007-Revert-Fix-error-macro-may-be-used-uninitialized.patch
rename to 9999/0008-Revert-Fix-error-macro-may-be-used-uninitialized.patch
index 410cf76..52cbc39 100644
--- a/9999/0007-Revert-Fix-error-macro-may-be-used-uninitialized.patch
+++ b/9999/0008-Revert-Fix-error-macro-may-be-used-uninitialized.patch
@@ -1,10 +1,10 @@
-From bbdfc672d363ee12f00ce6fc6c7660032cdf4f88 Mon Sep 17 00:00:00 2001
-Message-ID: <bbdfc672d363ee12f00ce6fc6c7660032cdf4f88.1735021582.git.sam@gentoo.org>
-In-Reply-To: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
-References: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
+From cc2fcd3f83d79ca491c61654b94e267386cdab3a Mon Sep 17 00:00:00 2001
+Message-ID: <cc2fcd3f83d79ca491c61654b94e267386cdab3a.1735175975.git.sam@gentoo.org>
+In-Reply-To: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
+References: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>
 Date: Tue, 24 Dec 2024 06:25:57 +0000
-Subject: [PATCH 2/3] Revert "Fix error: macro may be used uninitialized"
+Subject: [PATCH 3/4] Revert "Fix error: macro may be used uninitialized"
 
 This reverts commit f404dc565a4ccfe6922b45cf5526c319aedf75d6.
 ---

diff --git a/9999/0008-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch b/9999/0009-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
similarity index 98%
rename from 9999/0008-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
rename to 9999/0009-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
index ab3210d..e24e8d2 100644
--- a/9999/0008-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
+++ b/9999/0009-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
@@ -1,10 +1,10 @@
-From 6bb8e5ad25557fc476ccc64ee925d9c1d199a39a Mon Sep 17 00:00:00 2001
-Message-ID: <6bb8e5ad25557fc476ccc64ee925d9c1d199a39a.1735021582.git.sam@gentoo.org>
-In-Reply-To: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
-References: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
+From 499b2dbc38cbd668b62704165ee572c6ab784a4e Mon Sep 17 00:00:00 2001
+Message-ID: <499b2dbc38cbd668b62704165ee572c6ab784a4e.1735175975.git.sam@gentoo.org>
+In-Reply-To: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
+References: <a6aac087c94bab6335335e24aa9ab58ce0682859.1735175975.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>
 Date: Tue, 24 Dec 2024 06:26:16 +0000
-Subject: [PATCH 3/3] Revert "Fix the handling or arguments and macro
+Subject: [PATCH 4/4] Revert "Fix the handling or arguments and macro
  pseudo-variables inside nested assembler macros."
 
 This reverts commit 9f2e3c21f6506f081f1360f02b847606e0e00995.


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2024-12-24  6:27 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2024-12-24  6:27 UTC (permalink / raw
  To: gentoo-commits

commit:     43f28a46d9f3ea14979b20a23d05eadf76b76d14
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 24 06:27:14 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 24 06:27:14 2024 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=43f28a46

9999: add more macro reverts

Bug: https://sourceware.org/PR32484
Bug: https://sourceware.org/PR32486
Bug: https://sourceware.org/PR32487
Signed-off-by: Sam James <sam <AT> gentoo.org>

 9999/0006-Revert-PR-32391-testcase.patch           | 183 +++++++++++++++++++++
 ...Fix-error-macro-may-be-used-uninitialized.patch |  39 +++++
 ...he-handling-or-arguments-and-macro-pseud.patch} |  20 +--
 3 files changed, 228 insertions(+), 14 deletions(-)

diff --git a/9999/0006-Revert-PR-32391-testcase.patch b/9999/0006-Revert-PR-32391-testcase.patch
new file mode 100644
index 0000000..d847d98
--- /dev/null
+++ b/9999/0006-Revert-PR-32391-testcase.patch
@@ -0,0 +1,183 @@
+From 423c670c7d80a334fb9f10b71dcc68c022c2a2a5 Mon Sep 17 00:00:00 2001
+Message-ID: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Tue, 24 Dec 2024 06:25:51 +0000
+Subject: [PATCH 1/3] Revert "PR 32391 testcase"
+
+This reverts commit c8fcfa9aad211dfd8296ae6e978a356797936c61.
+---
+ gas/testsuite/gas/macros/nesting.s | 120 ++++++++++++++---------------
+ 1 file changed, 60 insertions(+), 60 deletions(-)
+
+diff --git a/gas/testsuite/gas/macros/nesting.s b/gas/testsuite/gas/macros/nesting.s
+index 9746ca183ef..438d5af8d00 100644
+--- a/gas/testsuite/gas/macros/nesting.s
++++ b/gas/testsuite/gas/macros/nesting.s
+@@ -1,104 +1,104 @@
+- .text
++
++	.text
+ /* PR 32391: Automatic counters inside macros should increment when nested
+-   macros finish execution.  */
+- .macro o1
+- .global before_at_\@
++	macros finish execution.  */
++.macro o1
++.global before_at_\@
+ before_at_\@:
+- .global before_plus_\+
++.global before_plus_\+
+ before_plus_\+:
+ 
+- .macro i1
+- .global inside_at_\@
++	.macro i1
++.global inside_at_\@
+ inside_at_\@:
+- .global inside_plus_\+
++.global inside_plus_\+
+ inside_plus_\+:
+- .endm
++	.endm
+ 
+- i1
+- i1
++	i1
++	i1
+ 
+- .global after_at_\@
++.global after_at_\@
+ after_at_\@:
+- .global after_plus_\+
++.global after_plus_\+
+ after_plus_\+:
+ 
+- .endm
++.endm
+ 
+ /* Invoking o1 should produce these symbols in this order:
+ 
+-   before_at_0
+-   before_plus_0
+-   inside_at_1
+-   inside_plus_0
+-   inside_at_2
+-   inside_plus_1
+-   after_at_0
+-   after_plus_0  */
+- o1
+-
++	before_at_0
++	before_plus_0
++	inside_at_1
++	inside_plus_0
++	inside_at_2
++	inside_plus_1
++	after_at_0
++	after_plus_0  */
++o1
++	
+ /* A second invocation of o1 should not produce any errors about
+-   symbols or macros being redefined.  */
+- o1
+-
++	symbols or macros being redefined.  */
++o1
++	
+ /* This definition should not collide with the definition inside o1.  */
+- .macro i1
+- .global other_inner_\@
++.macro i1
++.global other_inner_\@
+ other_inner_\@:
+- .endm
++.endm 
+ 
+-/* And invoking it should invoke the second defintion of i1, not the first.  */
+- i1
+-
+- .macro o2
+- .global _m\@_
++/* And invoking it should invoke the second defintion of i1, not the first.  */	
++i1
++		
++.macro o2
++.global _m\@_
+ _m\@_:
+- .macro i2
+- .global _m\@_
++.macro i2
++.global _m\@_
+ _m\@_:
+- .endm
+- i2
+- .endm
++.endm
++i2
++.endm
+ 
+ /* This should not generate conflicting symbols because the assembler
+    inserts the contents of o2 into the input buffer as pure text (ie
+    without evaluating i2).  The first use of \@ is evaluated at this
+    time, creating _m4_.  But the second use is not evaluated because
+    it is inside a .macro definition.
+-
++	
+    This finishes the evaluation of o2, so the \@ counter is incremented.
+-
++	
+    Next the input buffer is re-evaluated and the i2 macro definition
+    and invocation are encounterd.  The text from i2 are inserted into
+    the input buffer and at this point the second use of \@ is evaluated
+    resulting in the creation of a symbol called _m5_.  */
+- o2
++o2
+ 
+ /* Macro arguments should be independent of nesting.  */
+- .macro O3 arg
+- .global o3_\arg
++.macro O3 arg
++.global o3_\arg
+ o3_\arg:
+ 
+- .macro I3 arg
+- .global i3_\arg
++	.macro I3 arg
++.global i3_\arg
+ i3_\arg:
+- .endm
++       .endm
+ 
+- i3 bar		/* Macro names are case insensitive.  */
+- .endm
++	i3 bar		/* Macro names are case insensitive.  */
++.endm
+ 
+- o3 foo		/* Should produce two labels: o3_foo and i3_bar.  */
++o3 foo	/* Should produce two labels: o3_foo and i3_bar.  */
+ 
+ /* Nested macros can access the arguments of their parents.
+    In addition their arguments can be substituted into the arguments
+    that are substited from their parents:  */
+- .macro OUTER arg1, arg2, arg3:vararg
+- .macro INNER arg4 arg2
++.macro OUTER arg1, arg2, arg3:vararg
++     .macro INNER arg4 arg2
+         .dc.a \arg2
+- .dc.a \arg3
+- .endm
+- INNER \arg1 bert
+- .dc.a \arg2
+- .endm
++	.dc.a \arg3
++     .endm
++     INNER \arg1 bert
++	.dc.a \arg2
++.endm
+ 
+-/* This produces references to "jim", "bert" and "harryfred".  */
+- OUTER fred, jim, harry\arg4
++OUTER fred, jim, harry\arg4 /* This produces references to "jim", "bert" and "harryfred".  */
+-- 
+2.47.1
+

diff --git a/9999/0007-Revert-Fix-error-macro-may-be-used-uninitialized.patch b/9999/0007-Revert-Fix-error-macro-may-be-used-uninitialized.patch
new file mode 100644
index 0000000..410cf76
--- /dev/null
+++ b/9999/0007-Revert-Fix-error-macro-may-be-used-uninitialized.patch
@@ -0,0 +1,39 @@
+From bbdfc672d363ee12f00ce6fc6c7660032cdf4f88 Mon Sep 17 00:00:00 2001
+Message-ID: <bbdfc672d363ee12f00ce6fc6c7660032cdf4f88.1735021582.git.sam@gentoo.org>
+In-Reply-To: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
+References: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Tue, 24 Dec 2024 06:25:57 +0000
+Subject: [PATCH 2/3] Revert "Fix error: macro may be used uninitialized"
+
+This reverts commit f404dc565a4ccfe6922b45cf5526c319aedf75d6.
+---
+ gas/macro.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/gas/macro.c b/gas/macro.c
+index 3d5a9f14341..a0f2a5c764c 100644
+--- a/gas/macro.c
++++ b/gas/macro.c
+@@ -1411,6 +1411,7 @@ check_macro (const char *line, sb *expand,
+ {
+   const char *s;
+   char *copy, *cls;
++  macro_entry *macro;
+   sb line_sb;
+ 
+   if (! macros_defined)
+@@ -1430,8 +1431,8 @@ check_macro (const char *line, sb *expand,
+   for (cls = copy; *cls != '\0'; cls ++)
+     *cls = TOLOWER (*cls);
+ 
+-  macro_entry *macro = NULL;
+-  for (int i = macro_nesting_depth; i >= 0; i--)
++  int i;
++  for (i = macro_nesting_depth; i >= 0; i--)
+     {
+       macro = str_hash_find (macro_hash[i], copy);
+       if (macro != NULL)
+-- 
+2.47.1
+

diff --git a/9999/0006-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch b/9999/0008-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
similarity index 98%
rename from 9999/0006-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
rename to 9999/0008-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
index 3eff67e..ab3210d 100644
--- a/9999/0006-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
+++ b/9999/0008-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
@@ -1,19 +1,13 @@
-From 35123215fe882c439955a644a715b23d31c4174d Mon Sep 17 00:00:00 2001
-Message-ID: <35123215fe882c439955a644a715b23d31c4174d.1734739720.git.sam@gentoo.org>
+From 6bb8e5ad25557fc476ccc64ee925d9c1d199a39a Mon Sep 17 00:00:00 2001
+Message-ID: <6bb8e5ad25557fc476ccc64ee925d9c1d199a39a.1735021582.git.sam@gentoo.org>
+In-Reply-To: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
+References: <423c670c7d80a334fb9f10b71dcc68c022c2a2a5.1735021582.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>
-Date: Sat, 21 Dec 2024 00:07:29 +0000
-Subject: [PATCH] Revert "Fix the handling or arguments and macro
+Date: Tue, 24 Dec 2024 06:26:16 +0000
+Subject: [PATCH 3/3] Revert "Fix the handling or arguments and macro
  pseudo-variables inside nested assembler macros."
 
 This reverts commit 9f2e3c21f6506f081f1360f02b847606e0e00995.
-
-Breaks kernel build on amd64 and some multimedia bits on arm*, revert
-for now.
-
-Bug: https://sourceware.org/PR32484
-Bug: https://sourceware.org/PR32486
-Bug: https://sourceware.org/PR32487
-Signed-off-by: Sam James <sam@gentoo.org>
 ---
  gas/config/tc-iq2000.c              |   6 +-
  gas/doc/as.texi                     |  60 +------
@@ -901,8 +895,6 @@ index 438d5af8d00..00000000000
 -.endm
 -
 -OUTER fred, jim, harry\arg4 /* This produces references to "jim", "bert" and "harryfred".  */
-
-base-commit: 14848fc2b22e6e718abadcfbcc0491688df19a8e
 -- 
 2.47.1
 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2024-12-21  0:09 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2024-12-21  0:09 UTC (permalink / raw
  To: gentoo-commits

commit:     8338985dde30f332b85aa008f1ff932941c2583e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 21 00:09:16 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 21 00:09:16 2024 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=8338985d

9999: Revert patch breaking kernel build

Revert "Fix the handling or arguments and macro pseudo-variables inside
nested assembler macros."

This reverts upstream commit 9f2e3c21f6506f081f1360f02b847606e0e00995.

Breaks kernel build on amd64 and some multimedia bits on arm*, revert
for now.

Bug: https://sourceware.org/PR32484
Bug: https://sourceware.org/PR32486
Bug: https://sourceware.org/PR32487
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...the-handling-or-arguments-and-macro-pseud.patch | 908 +++++++++++++++++++++
 1 file changed, 908 insertions(+)

diff --git a/9999/0006-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch b/9999/0006-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
new file mode 100644
index 0000000..3eff67e
--- /dev/null
+++ b/9999/0006-Revert-Fix-the-handling-or-arguments-and-macro-pseud.patch
@@ -0,0 +1,908 @@
+From 35123215fe882c439955a644a715b23d31c4174d Mon Sep 17 00:00:00 2001
+Message-ID: <35123215fe882c439955a644a715b23d31c4174d.1734739720.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Sat, 21 Dec 2024 00:07:29 +0000
+Subject: [PATCH] Revert "Fix the handling or arguments and macro
+ pseudo-variables inside nested assembler macros."
+
+This reverts commit 9f2e3c21f6506f081f1360f02b847606e0e00995.
+
+Breaks kernel build on amd64 and some multimedia bits on arm*, revert
+for now.
+
+Bug: https://sourceware.org/PR32484
+Bug: https://sourceware.org/PR32486
+Bug: https://sourceware.org/PR32487
+Signed-off-by: Sam James <sam@gentoo.org>
+---
+ gas/config/tc-iq2000.c              |   6 +-
+ gas/doc/as.texi                     |  60 +------
+ gas/input-scrub.c                   |   7 +-
+ gas/macro.c                         | 270 +++++-----------------------
+ gas/macro.h                         |  17 +-
+ gas/read.c                          |  15 +-
+ gas/testsuite/gas/macros/macros.exp |   1 -
+ gas/testsuite/gas/macros/nesting.d  |  28 ---
+ gas/testsuite/gas/macros/nesting.s  | 104 -----------
+ 9 files changed, 64 insertions(+), 444 deletions(-)
+ delete mode 100644 gas/testsuite/gas/macros/nesting.d
+ delete mode 100644 gas/testsuite/gas/macros/nesting.s
+
+diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c
+index 1cbc578281f..2198ffda2b9 100644
+--- a/gas/config/tc-iq2000.c
++++ b/gas/config/tc-iq2000.c
+@@ -105,6 +105,8 @@ struct iq2000_hi_fixup
+ /* The list of unmatched HI relocs.  */
+ static struct iq2000_hi_fixup * iq2000_hi_fixup_list;
+ 
++/* Macro hash table, which we will add to.  */
++extern struct htab *macro_hash;
+ \f
+ const char md_shortopts[] = "";
+ const struct option md_longopts[] =
+@@ -277,7 +279,9 @@ iq2000_add_macro (const char *  name,
+ 	}
+     }
+ 
+-  (void) add_macro (macro, true);
++  str_hash_insert (macro_hash, macro->name, macro, 1);
++
++  macro_defined = 1;
+ }
+ 
+ static void
+diff --git a/gas/doc/as.texi b/gas/doc/as.texi
+index 1683594a0bb..6be54b57599 100644
+--- a/gas/doc/as.texi
++++ b/gas/doc/as.texi
+@@ -6215,12 +6215,7 @@ With that definition, @samp{SUM 0,5} is equivalent to this assembly input:
+ @item .macro @var{macname}
+ @itemx .macro @var{macname} @var{macargs} @dots{}
+ @cindex @code{macro} directive
+-Begin the definition of a macro called @var{macname}.  Macro names are case
+-insensitive.  Macro definitions can be nested, although their behaviour is
+-sometimes counter intuitive.  Nested macros only have scope within their
+-defining macro.
+-
+-If your macro
++Begin the definition of a macro called @var{macname}.  If your macro
+ definition requires arguments, specify their names after the macro name,
+ separated by commas or spaces.  You can qualify the macro argument to
+ indicate whether all invocations must specify a non-blank value (through
+@@ -6385,29 +6380,6 @@ adjacent string literals - even if separated only by a blank - will not be
+ concatenated when determining macro arguments, even if they're only separated
+ by white space.  This is unlike certain other pseudo ops, e.g. @code{.ascii}.
+ 
+-Nested macros can access the arguments of their parents.  But also if their
+-argument names clash with those of their parents, their versions are used.  So
+-for example:
+-
+-@smallexample
+-.macro OUTER arg1, arg2, arg3:vararg
+-     .macro INNER arg4 arg2
+-        .dc.a \arg2
+-	.dc.a \arg3
+-     .endm
+-     INNER \arg1 bert
+-	.dc.a \arg2
+-.endm
+-
+-OUTER fred, jim, harry\arg4
+-@end smallexample
+-
+-This will generate references to symbols called @samp{jim} - from the
+-definition of the OUTER macro, @samp{bert} - from the definition in INNER
+-where arg2 has been overridden and @samp{harryfred} - from the definition in
+-INNER where the value of arg3 from OUTER is used, but with the value of arg4
+-substituted into the symbol.
+-
+ @item .endm
+ @cindex @code{endm} directive
+ Mark the end of a macro definition.
+@@ -6423,33 +6395,6 @@ Exit early from the current macro definition.
+ executed in this pseudo-variable; you can copy that number to your
+ output with @samp{\@@}, but @emph{only within a macro definition}.
+ 
+-Note - the @samp{\@@} counter is incremented at the end of the expansion of a
+-macro, but before the contents of any nested macros are evaluated.  This can
+-lead to counter-intuitive behaviour when nested macros are used.  For example:
+-
+-@smallexample
+-  .macro o
+-    .macro i
+-    _i\@@_:
+-    .endm
+-    i
+-    _o\@@_:
+-  .endm
+-  o
+-@end smallexample
+-
+-Produces two symbols @samp{_o0_} and @samp{_i1_}.  This happens because the
+-@samp{o} macro executes entirely first, putting the definition and invocation
+-of the @samp{i} macro into the input buffer.  It also puts the definition of
+-the @samp{_o\@@_} symbol into the input buffer, evaluating the @samp{\@@}
+-counter in the process and so generating a symbol called @samp{_o0_}.
+-
+-That finishes the invocation of @samp{o} so the @samp{\@@} counter is
+-incremented.  Then the input buffer is re-evaluated and the definition and
+-invocation of macro @samp{i} is found.  This results in @samp{_i\@@_} being put
+-into the input buffer and this time @samp{\@@} evaluates to 1, so the symbol
+-created is @samp{_i1_}.
+-
+ @cindex number of times a macro has been executed
+ @cindex macro, execution count
+ @item \+
+@@ -6736,9 +6681,6 @@ those explicitly specified with @code{.eject}.
+ Undefine the macro @var{name}, so that later uses of the string will not be
+ expanded.  @xref{Macro}.
+ 
+-Note - nested macros are automatically purged at the end of the macro that
+-defines them.
+-
+ @ifset ELF
+ @node PushSection
+ @section @code{.pushsection @var{name} [, @var{subsection}] [, "@var{flags}"[, @@@var{type}[,@var{arguments}]]]}
+diff --git a/gas/input-scrub.c b/gas/input-scrub.c
+index 25fac879a56..878edc8fd36 100644
+--- a/gas/input-scrub.c
++++ b/gas/input-scrub.c
+@@ -23,7 +23,6 @@
+ #include "input-file.h"
+ #include "sb.h"
+ #include "listing.h"
+-#include "macro.h"
+ 
+ /*
+  * O/S independent module to supply buffers of sanitised source code
+@@ -291,13 +290,12 @@ input_scrub_include_sb (sb *from, char *position, enum expansion expansion)
+       ++macro_nest;
+     }
+ 
++#ifdef md_macro_start
+   if (expansion == expanding_macro)
+     {
+-#ifdef md_macro_start
+       md_macro_start ();
+-#endif
+-      increment_macro_nesting_depth ();
+     }
++#endif
+ 
+   next_saved_file = input_scrub_push (position);
+ 
+@@ -352,7 +350,6 @@ input_scrub_next_buffer (char **bufp)
+ 	         data.  */
+ 	      md_macro_end ();
+ #endif
+-	      decrement_macro_nesting_depth ();
+ 	    }
+ 	  if (from_sb_expansion != expanding_app)
+ 	    --macro_nest;
+diff --git a/gas/macro.c b/gas/macro.c
+index a0f2a5c764c..8b376f7f490 100644
+--- a/gas/macro.c
++++ b/gas/macro.c
+@@ -44,24 +44,11 @@
+ 
+ /* The macro hash table.  */
+ 
+-/* Macro nesting depth.  Similar to macro_nest defined in sb.c, but this
+-   counter is specific to macros, whereas macro_nest also counts repeated
+-   string blocks.  */
+-static unsigned int macro_nesting_depth;
++htab_t macro_hash;
+ 
+-/* Maximum nesting depth.  Ideally the same as the value of max_macro_nest
+-   as defined in as.c (ie 100).  But there is one test in the assembler
+-   testsuite (bfin/allinsn16.s) that nests macros to a depth of 8192.  So
+-   we have a ridiculously large number here.  */
+-#define MAX_MACRO_DEPTH 8193
++/* Whether any macros have been defined.  */
+ 
+-static htab_t macro_hash[MAX_MACRO_DEPTH];
+-
+-/* Whether any macros have been defined.
+-   FIXME:  This could be a counter that is incremented
+-   with .macro and decremented with .purgem.  */
+-
+-static bool macros_defined = false;
++int macro_defined;
+ 
+ /* Whether we should strip '@' characters.  */
+ 
+@@ -73,18 +60,6 @@ static unsigned int macro_number;
+ 
+ static void free_macro (macro_entry *);
+ 
+-bool
+-add_macro (macro_entry * macro, bool replace)
+-{
+-  if (str_hash_insert (macro_hash [macro_nesting_depth],
+-		       macro->name, macro, replace) == NULL)
+-    {
+-      macros_defined = true;
+-      return true;
+-    }
+-  return false;
+-}
+-
+ static void
+ macro_del_f (void *ent)
+ {
+@@ -97,23 +72,15 @@ macro_del_f (void *ent)
+ void
+ macro_init (void)
+ {
+-  int i;
+-
+-  for (i = 0; i < MAX_MACRO_DEPTH; i++)
+-    macro_hash[i] = htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
+-				       macro_del_f, notes_calloc, NULL);
+-  macros_defined = false;
++  macro_hash = htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
++				  macro_del_f, notes_calloc, NULL);
++  macro_defined = 0;
+ }
+ 
+ void
+ macro_end (void)
+ {
+-  int i;
+-
+-  for (i = MAX_MACRO_DEPTH; i--;)
+-    htab_delete (macro_hash[i]);
+-
+-  macros_defined = false;
++  htab_delete (macro_hash);
+ }
+ 
+ /* Read input lines till we get to a TO string.
+@@ -688,13 +655,6 @@ free_macro (macro_entry *macro)
+   free (macro);
+ }
+ 
+-static macro_entry * last_recorded_macro = NULL;
+-void
+-macro_record_invocation (macro_entry * macro)
+-{
+-  last_recorded_macro = macro;
+-}
+-
+ /* Define a new macro.  */
+ 
+ macro_entry *
+@@ -758,19 +718,15 @@ define_macro (sb *in, sb *label, size_t (*get_line) (sb *))
+   /* And stick it in the macro hash table.  */
+   for (idx = 0; idx < name.len; idx++)
+     name.ptr[idx] = TOLOWER (name.ptr[idx]);
+-
+-  if (macro_nesting_depth > 0)
+-    macro->parent = last_recorded_macro;
+-  else
+-    macro->parent = NULL;
+-
+   if (!error)
+     {
+-      if (! add_macro (macro, false))
++      if (str_hash_insert (macro_hash, macro->name, macro, 0) != NULL)
+ 	error = _("Macro `%s' was already defined");
+     }
+ 
+-  if (error != NULL)
++  if (!error)
++    macro_defined = 1;
++  else
+     {
+       as_bad_where (macro->file, macro->line, error, macro->name);
+       free_macro (macro);
+@@ -794,25 +750,11 @@ get_apost_token (size_t idx, sb *in, sb *name, int kind)
+   return idx;
+ }
+ 
+-static const char *
+-macro_expand_body (sb *, sb *, formal_entry *, struct htab *,
+-		   const macro_entry *, unsigned int);
+-
+-/* Find the actual value for a formal parameter starting at START inside IN.
+-    Appends the value of parameter onto OUT.
+-   The hash table of formal parameters is provided by FORMAL_HASH.
+-   The character that indicated the presense of a formal parameter is passed
+-    in KIND.
+-   If COPYIFNOTTHERE is true and the parameter is not found in the hash table
+-    then it is appended as plain text onto OUT.
+-   The macro containing the formal parameters is passed in MACRO.
+-    This can be empty.
+-   Returns the offset inside IN after advanceing past the parameter.
+-   Also stores the parameter's name into T.  */
++/* Substitute the actual value for a formal parameter.  */
+ 
+ static size_t
+ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
+-	    int kind, sb *out, int copyifnotthere, const macro_entry * macro)
++	    int kind, sb *out, int copyifnotthere)
+ {
+   size_t src;
+   formal_entry *ptr;
+@@ -826,12 +768,16 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
+     ptr = NULL;
+   else
+     ptr = str_hash_find (formal_hash, sb_terminate (t));
+-  
+   if (ptr)
+     {
+-      sb * add = ptr->actual.len ? &ptr->actual : &ptr->def;
+-
+-      sb_add_sb (out, add);
++      if (ptr->actual.len)
++	{
++	  sb_add_sb (out, &ptr->actual);
++	}
++      else
++	{
++	  sb_add_sb (out, &ptr->def);
++	}
+     }
+   else if (kind == '&')
+     {
+@@ -845,55 +791,6 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
+     {
+       sb_add_sb (out, t);
+     }
+-  else if (!macro_strip_at
+-	   && macro_nesting_depth > 0
+-	   && macro != NULL
+-	   && macro->parent != NULL)
+-    {
+-      const macro_entry * orig_macro = macro;
+-      bool success = false;
+-
+-      /* We have failed to find T, but we are inside nested macros.  So check
+-	 the parent macros so see if they have a FORMAL that matches T.  */
+-      while (macro->parent != NULL)
+-	{
+-	  macro = macro->parent;
+-
+-	  ptr = str_hash_find (macro->formal_hash, t->ptr);
+-	  if (ptr == NULL)
+-	    continue;
+-
+-	  sb * add = ptr->actual.len ? &ptr->actual : &ptr->def;
+-
+-	  /* The parent's FORMALs might contain parameters that need further
+-	     substitution.  See gas/testsuite/gas/arm/macro-vld1.s for an
+-	     example of this.  */
+-	  if (strchr (add->ptr, '\\'))
+-	    {
+-	      sb newadd;
+-
+-	      sb_new (&newadd);
+-	      /* FIXME: Should we do something if the call to
+-		 macro_expand_body returns an error message ?  */
+-	      (void) macro_expand_body (add, &newadd, NULL, NULL,
+-					orig_macro, orig_macro->count);
+-	      sb_add_sb (out, &newadd);
+-	    }
+-	  else
+-	    {
+-	      sb_add_sb (out, add);
+-	    }
+-	  success = true;
+-	  break;
+-	}
+-      if (! success)
+-	{
+-	  /* We reached the outermost macro and failed to find T, so
+-	     just copy the entire parameter as is.  */
+-	  sb_add_char (out, '\\');
+-	  sb_add_sb (out, t);
+-	}
+-    }
+   else
+     {
+       sb_add_char (out, '\\');
+@@ -902,12 +799,7 @@ sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash,
+   return src;
+ }
+ 
+-/* Expands the body of a macro / block of text IN, copying it into OUT.
+-   Parameters for substitution are found in FORMALS and FORMAL_HASH or
+-   MACRO.
+-   The number of times that this macro / block of text have already been
+-   copied into the output is held in INSTANCE.
+-   Returns NULL upon success or an error message otherwise.  */
++/* Expand the body of a macro.  */
+ 
+ static const char *
+ macro_expand_body (sb *in, sb *out, formal_entry *formals,
+@@ -919,38 +811,18 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
+   int inquote = 0, macro_line = 0;
+   formal_entry *loclist = NULL;
+   const char *err = NULL;
+-  int nesting = 0;
+ 
+-  if (formals == NULL && macro != NULL)
+-    formals = macro->formals;
+-
+-  if (formal_hash == NULL && macro != NULL)
+-    formal_hash = macro->formal_hash;
+-  
+   sb_new (&t);
+ 
+   while (src < in->len && !err)
+     {
+-      if (in->ptr[src] == '.')
+-	{
+-	  /* Check to see if we have encountered ".macro" or ".endm" */
+-	  if (in->len > src + 5
+-	      && strncmp (in->ptr + src, ".macro", 6) == 0)
+-	    ++ nesting;
+-
+-	  else if (in->len > src + 4
+-		   && strncmp (in->ptr + src, ".endm", 5) == 0)
+-	    -- nesting;
+-	}
+-
+       if (in->ptr[src] == '&')
+ 	{
+ 	  sb_reset (&t);
+ 	  if (flag_mri)
+ 	    {
+ 	      if (src + 1 < in->len && in->ptr[src + 1] == '&')
+-		src = sub_actual (src + 2, in, &t, formal_hash,
+-				  '\'', out, 1, macro);
++		src = sub_actual (src + 2, in, &t, formal_hash, '\'', out, 1);
+ 	      else
+ 		sb_add_char (out, in->ptr[src++]);
+ 	    }
+@@ -958,8 +830,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
+ 	    {
+ 	      /* Permit macro parameter substitution delineated with
+ 		 an '&' prefix and optional '&' suffix.  */
+-	      src = sub_actual (src + 1, in, &t, formal_hash,
+-				'&', out, 0, macro);
++	      src = sub_actual (src + 1, in, &t, formal_hash, '&', out, 0);
+ 	    }
+ 	}
+       else if (in->ptr[src] == '\\')
+@@ -980,12 +851,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
+ 	      else
+ 		as_bad_where (macro->file, macro->line + macro_line, _("missing `)'"));
+ 	    }
+-	  else if (src < in->len
+-		   && in->ptr[src] == '@'
+-		   /* PR 32391: Do not perform the substition inside nested
+-		      macros.  Instead wait until they are re-evaluated and
+-		      perform the substition then.  */
+-		   && ! nesting)
++	  else if (src < in->len && in->ptr[src] == '@')
+ 	    {
+ 	      /* Sub in the total macro invocation number.  */
+ 
+@@ -994,12 +860,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
+ 	      sprintf (buffer, "%u", macro_number);
+ 	      sb_add_string (out, buffer);
+ 	    }
+-	  else if (src < in->len
+-		   && in->ptr[src] == '+'
+-		   /* PR 32391: Do not perform the substition inside nested
+-		      macros.  Instead wait until they are re-evaluated and
+-		      perform the substition then.  */
+-		   && ! nesting)
++	  else if (src < in->len && in->ptr[src] == '+')
+ 	    {
+ 	      /* Sub in the current macro invocation number.  */
+ 
+@@ -1043,18 +904,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
+ 	  else
+ 	    {
+ 	      sb_reset (&t);
+-
+-	      if (nesting)
+-		{
+-		  src = get_apost_token (src, in, &t, '\'');
+-		  sb_add_char (out, '\\');
+-		  sb_add_sb (out, &t);
+-		}
+-	      else
+-		{
+-		  src = sub_actual (src, in, &t, formal_hash,
+-				    '\'', out, 0, macro);
+-		}
++	      src = sub_actual (src, in, &t, formal_hash, '\'', out, 0);
+ 	    }
+ 	}
+       else if ((flag_macro_alternate || flag_mri)
+@@ -1073,7 +923,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
+ 	      sb_reset (&t);
+ 	      src = sub_actual (src, in, &t, formal_hash,
+ 				(macro_strip_at && inquote) ? '@' : '\'',
+-				out, 1, macro);
++				out, 1);
+ 	    }
+ 	  else
+ 	    {
+@@ -1185,7 +1035,6 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
+ 
+   if (!err && (out->len == 0 || out->ptr[out->len - 1] != '\n'))
+     sb_add_char (out, '\n');
+-
+   return err;
+ }
+ 
+@@ -1370,7 +1219,8 @@ macro_expand (size_t idx, sb *in, macro_entry *m, sb *out)
+ 	    }
+ 	}
+ 
+-      err = macro_expand_body (&m->sub, out, NULL, NULL, m, m->count);
++      err = macro_expand_body (&m->sub, out, m->formals, m->formal_hash, m,
++			       m->count);
+     }
+ 
+   /* Discard any unnamed formal arguments.  */
+@@ -1403,9 +1253,9 @@ macro_expand (size_t idx, sb *in, macro_entry *m, sb *out)
+ }
+ 
+ /* Check for a macro.  If one is found, put the expansion into
+-   *EXPAND.  Return TRUE if a macro is found, FALSE otherwise.  */
++   *EXPAND.  Return 1 if a macro is found, 0 otherwise.  */
+ 
+-bool
++int
+ check_macro (const char *line, sb *expand,
+ 	     const char **error, macro_entry **info)
+ {
+@@ -1414,12 +1264,9 @@ check_macro (const char *line, sb *expand,
+   macro_entry *macro;
+   sb line_sb;
+ 
+-  if (! macros_defined)
+-    return false;
+-
+   if (! is_name_beginner (*line)
+       && (! flag_mri || *line != '.'))
+-    return false;
++    return 0;
+ 
+   s = line + 1;
+   while (is_part_of_name (*s))
+@@ -1431,17 +1278,11 @@ check_macro (const char *line, sb *expand,
+   for (cls = copy; *cls != '\0'; cls ++)
+     *cls = TOLOWER (*cls);
+ 
+-  int i;
+-  for (i = macro_nesting_depth; i >= 0; i--)
+-    {
+-      macro = str_hash_find (macro_hash[i], copy);
+-      if (macro != NULL)
+-	break;
+-    }
++  macro = str_hash_find (macro_hash, copy);
+   free (copy);
+ 
+   if (macro == NULL)
+-    return false;
++    return 0;
+ 
+   /* Wrap the line up in an sb.  */
+   sb_new (&line_sb);
+@@ -1457,7 +1298,7 @@ check_macro (const char *line, sb *expand,
+   if (info)
+     *info = macro;
+ 
+-  return true;
++  return 1;
+ }
+ 
+ /* Delete a macro.  */
+@@ -1475,20 +1316,11 @@ delete_macro (const char *name)
+     copy[i] = TOLOWER (name[i]);
+   copy[i] = '\0';
+ 
+-  int j;
+-  for (j = macro_nesting_depth; j >= 0; j--)
+-    {
+-      macro = str_hash_find (macro_hash [j], copy);
+-      if (macro != NULL)
+-	{
+-	  str_hash_delete (macro_hash[j], copy);
+-	  break;
+-	}
+-    }
+-
+-  if (macro == NULL)
++  macro = str_hash_find (macro_hash, copy);
++  if (macro != NULL)
++    str_hash_delete (macro_hash, copy);
++  else
+     as_warn (_("Attempt to purge non-existing macro `%s'"), copy);
+-
+   free (copy);
+ }
+ 
+@@ -1590,25 +1422,3 @@ expand_irp (int irpc, size_t idx, sb *in, sb *out, size_t (*get_line) (sb *))
+ 
+   return err;
+ }
+-
+-void
+-increment_macro_nesting_depth (void)
+-{
+- if (macro_nesting_depth >= (MAX_MACRO_DEPTH - 1))
+-    as_fatal (_("macros nested too deeply"));
+-  else
+-    ++macro_nesting_depth;
+-}
+-
+-void
+-decrement_macro_nesting_depth (void)
+-{
+-  if (macro_nesting_depth == 0)
+-    as_fatal (_("too much macro un-nesting"));
+-  else
+-    {
+-      /* FIXME: Potential memory leak here.  */
+-      htab_empty (macro_hash [macro_nesting_depth]);
+-      --macro_nesting_depth;
+-    }
+-}
+diff --git a/gas/macro.h b/gas/macro.h
+index 97f2a5a4066..e87f64e70ca 100644
+--- a/gas/macro.h
++++ b/gas/macro.h
+@@ -64,28 +64,31 @@ typedef struct macro_struct
+   int             formal_count;		/* Number of formal args.  */
+   formal_entry *  formals;		/* List of formal_structs.  */
+   htab_t          formal_hash;		/* Hash table of formals.  */
+-  struct macro_struct * parent;         /* Parent of nested macros.  */
+   const char *    name;			/* Macro name.  */
+   const char *    file;			/* File the macro was defined in.  */
+   unsigned int    line;			/* Line number of definition.  */
+   unsigned int    count;                /* Invocation count.  */
+ } macro_entry;
+ 
+-/* The macro/text block nesting level.  */
++/* Whether any macros have been defined.  */
++
++extern int macro_defined;
++
++/* The macro nesting level.  */
+ 
+ extern int macro_nest;
+ 
++/* The macro hash table.  */
++
++extern htab_t macro_hash;
++
+ extern int buffer_and_nest (const char *, const char *, sb *,
+ 			    size_t (*) (sb *));
+ extern void macro_init (void);
+ extern void macro_end (void);
+ extern macro_entry *define_macro (sb *, sb *, size_t (*) (sb *));
+-extern bool check_macro (const char *, sb *, const char **, macro_entry **);
++extern int check_macro (const char *, sb *, const char **, macro_entry **);
+ extern void delete_macro (const char *);
+ extern const char *expand_irp (int, size_t, sb *, sb *, size_t (*) (sb *));
+-extern void increment_macro_nesting_depth (void);
+-extern void decrement_macro_nesting_depth (void);
+-extern void macro_record_invocation (macro_entry *);
+-extern bool add_macro (macro_entry *, bool);
+ 
+ #endif
+diff --git a/gas/read.c b/gas/read.c
+index e5185f4ba26..589c7b080c2 100644
+--- a/gas/read.c
++++ b/gas/read.c
+@@ -655,8 +655,7 @@ poend (void)
+     }
+ 
+ /* Helper function of read_a_source_file, which tries to expand a macro.  */
+-
+-static bool
++static int
+ try_macro (char term, const char *line)
+ {
+   sb out;
+@@ -673,14 +672,12 @@ try_macro (char term, const char *line)
+       sb_kill (&out);
+       buffer_limit =
+ 	input_scrub_next_buffer (&input_line_pointer);
+-
+-      macro_record_invocation (macro);
+ #ifdef md_macro_info
+       md_macro_info (macro);
+ #endif
+-      return true;
++      return 1;
+     }
+-  return false;
++  return 0;
+ }
+ 
+ #ifdef HANDLE_BUNDLE
+@@ -1272,7 +1269,7 @@ read_a_source_file (const char *name)
+ 			  s_ignore (0);
+ 			  nul_char = next_char = *--input_line_pointer;
+ 			  *input_line_pointer = '\0';
+-			  if (! try_macro (next_char, s))
++			  if (! macro_defined || ! try_macro (next_char, s))
+ 			    {
+ 			      *end = '\0';
+ 			      as_bad (_("unknown pseudo-op: `%s'"), s);
+@@ -1309,7 +1306,7 @@ read_a_source_file (const char *name)
+ 
+ 		      generate_lineno_debug ();
+ 
+-		      if (try_macro (next_char, s))
++		      if (macro_defined && try_macro (next_char, s))
+ 			continue;
+ 
+ 		      if (mri_pending_align)
+@@ -2819,7 +2816,7 @@ s_macro (int ignore ATTRIBUTE_UNUSED)
+ 	  as_warn_where (macro->file, macro->line,
+ 			 _("attempt to redefine pseudo-op `%s' ignored"),
+ 			 macro->name);
+-	  delete_macro (macro->name);
++	  str_hash_delete (macro_hash, macro->name);
+ 	}
+     }
+ 
+diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp
+index 94ac37cdb8b..3ac199feaa5 100644
+--- a/gas/testsuite/gas/macros/macros.exp
++++ b/gas/testsuite/gas/macros/macros.exp
+@@ -112,4 +112,3 @@ run_list_test count
+ run_list_test irp-count
+ run_list_test irpc-quote
+ run_list_test rept-count
+-run_dump_test nesting
+diff --git a/gas/testsuite/gas/macros/nesting.d b/gas/testsuite/gas/macros/nesting.d
+deleted file mode 100644
+index 2f44aedb2dc..00000000000
+--- a/gas/testsuite/gas/macros/nesting.d
++++ /dev/null
+@@ -1,28 +0,0 @@
+-#nm: -j 
+-#name: Nested macros (PR 32391)
+-# Sone targets do not support macros used like this.
+-#skip: tic*-*-* mmix-*
+-
+-#...
+-_m7_
+-_m8_
+-after_at_0
+-after_at_3
+-after_plus_0
+-after_plus_1
+-before_at_0
+-before_at_3
+-before_plus_0
+-before_plus_1
+-bert
+-harryfred
+-i3_bar
+-inside_at_1
+-inside_at_2
+-inside_at_4
+-inside_at_5
+-inside_plus_0
+-inside_plus_1
+-jim
+-o3_foo
+-other_inner_6
+diff --git a/gas/testsuite/gas/macros/nesting.s b/gas/testsuite/gas/macros/nesting.s
+deleted file mode 100644
+index 438d5af8d00..00000000000
+--- a/gas/testsuite/gas/macros/nesting.s
++++ /dev/null
+@@ -1,104 +0,0 @@
+-
+-	.text
+-/* PR 32391: Automatic counters inside macros should increment when nested
+-	macros finish execution.  */
+-.macro o1
+-.global before_at_\@
+-before_at_\@:
+-.global before_plus_\+
+-before_plus_\+:
+-
+-	.macro i1
+-.global inside_at_\@
+-inside_at_\@:
+-.global inside_plus_\+
+-inside_plus_\+:
+-	.endm
+-
+-	i1
+-	i1
+-
+-.global after_at_\@
+-after_at_\@:
+-.global after_plus_\+
+-after_plus_\+:
+-
+-.endm
+-
+-/* Invoking o1 should produce these symbols in this order:
+-
+-	before_at_0
+-	before_plus_0
+-	inside_at_1
+-	inside_plus_0
+-	inside_at_2
+-	inside_plus_1
+-	after_at_0
+-	after_plus_0  */
+-o1
+-	
+-/* A second invocation of o1 should not produce any errors about
+-	symbols or macros being redefined.  */
+-o1
+-	
+-/* This definition should not collide with the definition inside o1.  */
+-.macro i1
+-.global other_inner_\@
+-other_inner_\@:
+-.endm 
+-
+-/* And invoking it should invoke the second defintion of i1, not the first.  */	
+-i1
+-		
+-.macro o2
+-.global _m\@_
+-_m\@_:
+-.macro i2
+-.global _m\@_
+-_m\@_:
+-.endm
+-i2
+-.endm
+-
+-/* This should not generate conflicting symbols because the assembler
+-   inserts the contents of o2 into the input buffer as pure text (ie
+-   without evaluating i2).  The first use of \@ is evaluated at this
+-   time, creating _m4_.  But the second use is not evaluated because
+-   it is inside a .macro definition.
+-	
+-   This finishes the evaluation of o2, so the \@ counter is incremented.
+-	
+-   Next the input buffer is re-evaluated and the i2 macro definition
+-   and invocation are encounterd.  The text from i2 are inserted into
+-   the input buffer and at this point the second use of \@ is evaluated
+-   resulting in the creation of a symbol called _m5_.  */
+-o2
+-
+-/* Macro arguments should be independent of nesting.  */
+-.macro O3 arg
+-.global o3_\arg
+-o3_\arg:
+-
+-	.macro I3 arg
+-.global i3_\arg
+-i3_\arg:
+-       .endm
+-
+-	i3 bar		/* Macro names are case insensitive.  */
+-.endm
+-
+-o3 foo	/* Should produce two labels: o3_foo and i3_bar.  */
+-
+-/* Nested macros can access the arguments of their parents.
+-   In addition their arguments can be substituted into the arguments
+-   that are substited from their parents:  */
+-.macro OUTER arg1, arg2, arg3:vararg
+-     .macro INNER arg4 arg2
+-        .dc.a \arg2
+-	.dc.a \arg3
+-     .endm
+-     INNER \arg1 bert
+-	.dc.a \arg2
+-.endm
+-
+-OUTER fred, jim, harry\arg4 /* This produces references to "jim", "bert" and "harryfred".  */
+
+base-commit: 14848fc2b22e6e718abadcfbcc0491688df19a8e
+-- 
+2.47.1
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2024-08-03 22:43 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2024-08-03 22:43 UTC (permalink / raw
  To: gentoo-commits

commit:     ec95ccad4a4802e2b375af024d901863444b8ecc
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  3 22:43:00 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Aug  3 22:43:00 2024 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=ec95ccad

Trivial rebase

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 9999/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch | 4 ++--
 9999/0002-Gentoo-add-with-extra-soversion-suffix-option.patch       | 6 +++---
 .../0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch | 4 ++--
 9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch                | 4 ++--
 .../0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch | 6 +++---
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/9999/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index a36bb51..34afb9b 100644
--- a/9999/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,7 +1,7 @@
-From 1594a93229b13d3c34c679e5991e64663cace1b9 Mon Sep 17 00:00:00 2001
+From a40f75efe4a34fbb447a026a52202b415013a984 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
-Subject: [PATCH 2/7] Gentoo: libiberty: install PIC version of libiberty.a
+Subject: [PATCH 1/5] Gentoo: libiberty: install PIC version of libiberty.a
 
 This will install a PIC version of libiberty.a by overwriting the non-PIC
 version of libiberty.a while compiling.  We do this because there is no

diff --git a/9999/0002-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0002-Gentoo-add-with-extra-soversion-suffix-option.patch
index 3694049..e7e4ae8 100644
--- a/9999/0002-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0002-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,7 +1,7 @@
-From 6d6cbf2ede96fd65bd7a9382c3364aaa9d0ac3bb Mon Sep 17 00:00:00 2001
+From 87a5dd82a8e08967694943e866aa9b26c4fc6a63 Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Tue, 20 Jul 2021 21:12:38 +0200
-Subject: [PATCH 3/7] Gentoo: add --with-extra-soversion-suffix= option
+Subject: [PATCH 2/5] Gentoo: add --with-extra-soversion-suffix= option
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -79,7 +79,7 @@ index b3d97d478ea..38209d1b234 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index 6458974951e..b43789851cd 100755
+index 83cb19c7015..a60c76319b9 100755
 --- a/bfd/configure
 +++ b/bfd/configure
 @@ -701,6 +701,7 @@ WARN_CFLAGS

diff --git a/9999/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/9999/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
index 6964aab..70c605a 100644
--- a/9999/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
+++ b/9999/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
@@ -1,7 +1,7 @@
-From a8cf14f5ea0a210928250fd1c47b4e45c39974c5 Mon Sep 17 00:00:00 2001
+From 225a5f5b9f40c1f335146ec882bd5517e4573f62 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 24 Jul 2021 15:20:16 +0200
-Subject: [PATCH 5/7] Gentoo: Give also libctf optionally a gentoo-specific
+Subject: [PATCH 3/5] Gentoo: Give also libctf optionally a gentoo-specific
  soversion
 
 ---

diff --git a/9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
index fe6da95..943d079 100644
--- a/9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
+++ b/9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
@@ -1,7 +1,7 @@
-From d826b80fe902aefd77465be3650ab2d62af5e099 Mon Sep 17 00:00:00 2001
+From 942b4489226184460d46eb9e7450eb63a1885621 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 31 Jul 2021 01:18:18 +0200
-Subject: [PATCH 6/7] Gentoo: XFAIL 15 broken ld.gold tests
+Subject: [PATCH 4/5] Gentoo: XFAIL 15 broken ld.gold tests
 
 It seems like either the tests or ld.gold in general cannot handle
 compilers built with --enable-default-pie. No fix yet, so let's ignore

diff --git a/9999/0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch b/9999/0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
index 6eebb98..54c7ba8 100644
--- a/9999/0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
+++ b/9999/0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
@@ -1,7 +1,7 @@
-From bbaa9fafb08385e5ad836bc30a2db3af47d1cc5a Mon Sep 17 00:00:00 2001
+From 24694fe84ea1ac172f709bd1b079ebb996e4feb9 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Wed, 22 Feb 2023 20:05:35 +0100
-Subject: [PATCH 7/7] Apply a similar libiberty fix as in 7d53105d for
+Subject: [PATCH 5/5] Apply a similar libiberty fix as in 7d53105d for
  libopcodes and libgprofng
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
@@ -46,7 +46,7 @@ index cef4b275305..295fd3ee2df 100644
  	$(GPROFNG_LIBADD) \
  	-lpthread -ldl
 diff --git a/opcodes/configure b/opcodes/configure
-index 050fd5ff0ff..4b68211dea6 100755
+index 0075b6dc0ef..76fca3e9246 100755
 --- a/opcodes/configure
 +++ b/opcodes/configure
 @@ -14379,10 +14379,10 @@ if test "$enable_shared" = "yes"; then


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2024-06-29 17:05 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2024-06-29 17:05 UTC (permalink / raw
  To: gentoo-commits

commit:     1fec9188faca01b3a679ec42cf74c638d4b34ebd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 29 17:05:16 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jun 29 17:05:16 2024 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=1fec9188

Renumber patches

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...tch => 0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch} | 0
 ...ion.patch => 0002-Gentoo-add-with-extra-soversion-suffix-option.patch} | 0
 ...ch => 0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch} | 0
 ...d.gold-tests.patch => 0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch} | 0
 ...ch => 0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch} | 0
 5 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
similarity index 100%
rename from 9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
rename to 9999/0001-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch

diff --git a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0002-Gentoo-add-with-extra-soversion-suffix-option.patch
similarity index 100%
rename from 9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
rename to 9999/0002-Gentoo-add-with-extra-soversion-suffix-option.patch

diff --git a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/9999/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
similarity index 100%
rename from 9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
rename to 9999/0003-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch

diff --git a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
similarity index 100%
rename from 9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
rename to 9999/0004-Gentoo-XFAIL-15-broken-ld.gold-tests.patch

diff --git a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch b/9999/0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
similarity index 100%
rename from 9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
rename to 9999/0005-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch


^ permalink raw reply	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2024-06-29 16:32 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2024-06-29 16:32 UTC (permalink / raw
  To: gentoo-commits

commit:     1c1fe5a0f79546d17321568bcb07825552c53979
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 29 16:31:59 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jun 29 16:31:59 2024 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=1c1fe5a0

Let's try without poison

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch | 338 ---------------------
 1 file changed, 338 deletions(-)

diff --git a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
deleted file mode 100644
index f11678e..0000000
--- a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ /dev/null
@@ -1,338 +0,0 @@
-From 68b26b5bf2047d71fac89ee321c0f9231c85903e Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Tue, 20 Jul 2021 21:08:31 +0200
-Subject: [PATCH 1/7] Gentoo: gold/ld: add support for poisoned system
- directories
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This is based on the old CodeSourcery patch written by Joseph Myers to add
-support to the link for detecting & rejecting bad -L paths when using a
-cross-compiler.  The differences here:
-* The command line flags are always available.
-* We can turn on & off the warning via the command line.
-* The configure option controls the default warning behavior.
-* Add support for gold.
-
-It is not currently upstream, nor has it been submitted at all.  There are
-no plans to do so currently either.
-
-BUG=chromium:488360
-TEST=`cbuildbot chromiumos-sdk` passes  # tests arm/amd64/mipsel/x86
-TEST=`cbuildbot panther_moblab-full whirlwind-release` pass
-TEST=`cbuildbot {x32,arm64}-generic-full` has no new failures
-TEST=x86_64-cros-linux-gnu-ld throws warnings when using -L/lib (gold & bfd)
-
-Reviewed-on: https://chromium-review.googlesource.com/272083
-(cherry picked from commit f92dbf35c00ab13cee36f6be8ae5ca46454d9000)
-
-Ported to binutils 2.37 by Andreas K. Hüttel <dilfridge@gentoo.org>
-Ported to binutils 2.39 by WANG Xuerui <xen0n@gentoo.org>
----
- gold/options.cc | 33 +++++++++++++++++++++++++++++++++
- gold/options.h  |  7 +++++++
- ld/config.in    |  3 +++
- ld/configure    | 16 ++++++++++++++++
- ld/configure.ac | 10 ++++++++++
- ld/ld.h         |  7 +++++++
- ld/ld.texi      | 18 ++++++++++++++++++
- ld/ldfile.c     | 20 ++++++++++++++++++++
- ld/ldlex.h      |  3 +++
- ld/ldmain.c     |  7 +++++++
- ld/lexsup.c     | 24 ++++++++++++++++++++++++
- 11 files changed, 148 insertions(+)
-
-diff --git a/gold/options.cc b/gold/options.cc
-index 46f067fa72f..a07ba1c82ed 100644
---- a/gold/options.cc
-+++ b/gold/options.cc
-@@ -1355,6 +1355,39 @@ General_options::finalize()
-   // in the path, as appropriate.
-   this->add_sysroot();
- 
-+  // Now check if library_path is poisoned.
-+  if (this->warn_poison_system_directories())
-+    {
-+      std::vector<std::string> bad_paths;
-+
-+      bad_paths.push_back("/lib");
-+      // TODO: This check is disabled for now due to a bunch of packages that
-+      // use libtool and relink with -L/usr/lib paths (albeit after the right
-+      // sysroot path).  Once those are fixed we can enable.
-+      // We also need to adjust it so it only rejects one or two levels deep.
-+      // Gcc's internal paths also live below /usr/lib.
-+      // http://crbug.com/488360
-+      // bad_paths.push_back("/usr/lib");
-+      bad_paths.push_back("/usr/local/lib");
-+      bad_paths.push_back("/usr/X11R6/lib");
-+
-+      for (std::vector<std::string>::const_iterator b = bad_paths.begin();
-+	   b != bad_paths.end();
-+	   ++b)
-+	for (Dir_list::iterator p = this->library_path_.value.begin();
-+	     p != this->library_path_.value.end();
-+	     ++p)
-+	  if (!p->name().compare(0, b->size(), *b))
-+	    {
-+	      if (this->error_poison_system_directories())
-+		gold_fatal(_("library search path \"%s\" is unsafe for "
-+			     "cross-compilation"), p->name().c_str());
-+	      else
-+		gold_warning(_("library search path \"%s\" is unsafe for "
-+			       "cross-compilation"), p->name().c_str());
-+	    }
-+    }
-+
-   // Now that we've normalized the options, check for contradictory ones.
-   if (this->shared() && this->is_static())
-     gold_fatal(_("-shared and -static are incompatible"));
-diff --git a/gold/options.h b/gold/options.h
-index 446e8d42614..464863b45fa 100644
---- a/gold/options.h
-+++ b/gold/options.h
-@@ -1402,6 +1402,13 @@ class General_options
-   DEFINE_bool(warn_multiple_gp, options::TWO_DASHES, '\0', false,
- 	      N_("Ignored"), NULL);
- 
-+  DEFINE_bool(warn_poison_system_directories, options::TWO_DASHES, '\0', false,
-+	      N_("Warn for -L options using system directories"),
-+	      N_("Do not warn for -L options using system directories"));
-+  DEFINE_bool(error_poison_system_directories, options::TWO_DASHES, '\0', false,
-+	      N_("Give an error for -L options using system directories"),
-+	      NULL);
-+
-   DEFINE_bool(warn_search_mismatch, options::TWO_DASHES, '\0', true,
- 	      N_("Warn when skipping an incompatible library"),
- 	      N_("Don't warn when skipping an incompatible library"));
-diff --git a/ld/config.in b/ld/config.in
-index f7c9da3d02a..e4fdbf6db5b 100644
---- a/ld/config.in
-+++ b/ld/config.in
-@@ -74,6 +74,9 @@
-    language is requested. */
- #undef ENABLE_NLS
- 
-+/* Define to warn for use of native system library directories */
-+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
-+
- /* Additional extension a shared object might have. */
- #undef EXTRA_SHLIB_EXTENSION
- 
-diff --git a/ld/configure b/ld/configure
-index 4e8de840418..f6d3069133e 100755
---- a/ld/configure
-+++ b/ld/configure
-@@ -844,6 +844,7 @@ with_lib_path
- enable_targets
- enable_64_bit_bfd
- with_sysroot
-+enable_poison_system_directories
- enable_gold
- enable_got
- enable_compressed_debug_sections
-@@ -1535,6 +1536,8 @@ Optional Features:
-   --enable-checking       enable run-time checks
-   --enable-targets        alternative target configurations
-   --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
-+  --enable-poison-system-directories
-+                          warn for use of native system library directories
-   --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
-   --enable-got=<type>     GOT handling scheme (target, single, negative,
-                           multigot)
-@@ -15566,6 +15569,19 @@ fi
- 
- 
- 
-+# Check whether --enable-poison-system-directories was given.
-+if test "${enable_poison_system_directories+set}" = set; then :
-+  enableval=$enable_poison_system_directories;
-+else
-+  enable_poison_system_directories=no
-+fi
-+
-+if test "x${enable_poison_system_directories}" = "xyes"; then
-+
-+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
-+
-+fi
-+
- # Check whether --enable-gold was given.
- if test "${enable_gold+set}" = set; then :
-   enableval=$enable_gold; case "${enableval}" in
-diff --git a/ld/configure.ac b/ld/configure.ac
-index bdf51a062fa..3d370ff92ce 100644
---- a/ld/configure.ac
-+++ b/ld/configure.ac
-@@ -102,6 +102,16 @@ AC_SUBST(use_sysroot)
- AC_SUBST(TARGET_SYSTEM_ROOT)
- AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
- 
-+AC_ARG_ENABLE([poison-system-directories],
-+         AS_HELP_STRING([--enable-poison-system-directories],
-+                [warn for use of native system library directories]),,
-+         [enable_poison_system_directories=no])
-+if test "x${enable_poison_system_directories}" = "xyes"; then
-+  AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
-+       [1],
-+       [Define to warn for use of native system library directories])
-+fi
-+
- dnl Use --enable-gold to decide if this linker should be the default.
- dnl "install_as_default" is set to false if gold is the default linker.
- dnl "installed_linker" is the installed BFD linker name.
-diff --git a/ld/ld.h b/ld/ld.h
-index 0dee944cf2a..a2bb9a10993 100644
---- a/ld/ld.h
-+++ b/ld/ld.h
-@@ -166,6 +166,13 @@ typedef struct
-      in the linker script.  */
-   bool force_group_allocation;
- 
-+  /* If true warn for uses of system directories when cross linking.  */
-+  bool warn_poison_system_directories;
-+
-+  /* If true (default false) give an error for uses of system
-+     directories when cross linking instead of a warning.  */
-+  bool error_poison_system_directories;
-+
-   /* Big or little endian as set on command line.  */
-   enum endian_enum endian;
- 
-diff --git a/ld/ld.texi b/ld/ld.texi
-index 89e3913317a..cd16eb9685e 100644
---- a/ld/ld.texi
-+++ b/ld/ld.texi
-@@ -3245,6 +3245,24 @@ creation of the metadata note, if one had been enabled by an earlier
- occurrence of the --package-metadata option.
- If the linker has been built with libjansson, then the JSON string
- will be validated.
-+
-+@kindex --warn-poison-system-directories
-+@item --warn-poison-system-directories
-+Warn for @option{-L} options using system directories such as
-+@file{/usr/lib} when cross linking.  This option is intended for use
-+in environments that want to detect and reject incorrect link settings.
-+
-+@kindex --no-warn-poison-system-directories
-+@item --no-warn-poison-system-directories
-+Do not warn for @option{-L} options using system directories such as
-+@file{/usr/lib} when cross linking.  This option is intended for use
-+in chroot environments when such directories contain the correct
-+libraries for the target system rather than the host.
-+
-+@kindex --error-poison-system-directories
-+@item --error-poison-system-directories
-+Give an error instead of a warning for @option{-L} options using
-+system directories when cross linking.
- @end table
- 
- @c man end
-diff --git a/ld/ldfile.c b/ld/ldfile.c
-index 87be885d31a..469ab52f985 100644
---- a/ld/ldfile.c
-+++ b/ld/ldfile.c
-@@ -344,6 +344,26 @@ ldfile_add_library_path (const char *name, enum search_dir_source source)
-       search_tail_ptr = &new_dirs->next;
-     }
- 
-+ if (command_line.warn_poison_system_directories
-+      && (!strncmp (name, "/lib", 4)
-+      /* TODO: This check is disabled for now due to a bunch of packages that
-+       * use libtool and relink with -L/usr/lib paths (albeit after the right
-+       * sysroot path).  Once those are fixed we can enable.
-+       * We also need to adjust it so it only rejects one or two levels deep.
-+       * Gcc's internal paths also live below /usr/lib.
-+       * http://crbug.com/488360  */
-+       /* || !strncmp (name, "/usr/lib", 8) */
-+          || !strncmp (name, "/usr/local/lib", 14)
-+          || !strncmp (name, "/usr/X11R6/lib", 14)))
-+    {
-+      if (command_line.error_poison_system_directories)
-+        einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
-+                 "cross-compilation\n"), name);
-+      else
-+        einfo (_("%P: warning: library search path \"%s\" is unsafe for "
-+                 "cross-compilation\n"), name);
-+    }
-+
-   return new_dirs;
- }
- 
-diff --git a/ld/ldlex.h b/ld/ldlex.h
-index defe3fcbbb9..ab94487edc6 100644
---- a/ld/ldlex.h
-+++ b/ld/ldlex.h
-@@ -153,6 +153,9 @@ enum option_values
-   OPTION_PRINT_OUTPUT_FORMAT,
-   OPTION_PRINT_SYSROOT,
-   OPTION_IGNORE_UNRESOLVED_SYMBOL,
-+  OPTION_WARN_POISON_SYSTEM_DIRECTORIES,
-+  OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES,
-+  OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
-   OPTION_PUSH_STATE,
-   OPTION_POP_STATE,
-   OPTION_DISABLE_MULTIPLE_DEFS_ABS,
-diff --git a/ld/ldmain.c b/ld/ldmain.c
-index 037099b9d37..552a191a857 100644
---- a/ld/ldmain.c
-+++ b/ld/ldmain.c
-@@ -347,6 +347,13 @@ main (int argc, char **argv)
-   command_line.warn_mismatch = true;
-   command_line.warn_search_mismatch = true;
-   command_line.check_section_addresses = -1;
-+  command_line.warn_poison_system_directories =
-+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
-+    true;
-+#else
-+    false;
-+#endif
-+  command_line.error_poison_system_directories = false;
- 
-   /* We initialize DEMANGLING based on the environment variable
-      COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
-diff --git a/ld/lexsup.c b/ld/lexsup.c
-index 4aa0124ce2f..e8e28ac7ea4 100644
---- a/ld/lexsup.c
-+++ b/ld/lexsup.c
-@@ -613,6 +613,18 @@ static const struct ld_option ld_options[] =
-     OPTION_IGNORE_UNRESOLVED_SYMBOL},
-     '\0', N_("SYMBOL"),
-     N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
-+  { {"warn-poison-system-directories", no_argument, NULL,
-+     OPTION_WARN_POISON_SYSTEM_DIRECTORIES},
-+    '\0', NULL, N_("Warn for -L options using system directories"),
-+    TWO_DASHES },
-+  { {"no-warn-poison-system-directories", no_argument, NULL,
-+     OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES},
-+    '\0', NULL, N_("Do not warn for -L options using system directories"),
-+    TWO_DASHES },
-+  { {"error-poison-system-directories", no_argument, NULL,
-+     OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
-+    '\0', NULL, N_("Give an error for -L options using system directories"),
-+    TWO_DASHES },
-   { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
-     '\0', NULL, N_("Push state of flags governing input file handling"),
-     TWO_DASHES },
-@@ -1785,6 +1797,18 @@ parse_args (unsigned argc, char **argv)
- 	  }
- 	  break;
- 
-+   case OPTION_WARN_POISON_SYSTEM_DIRECTORIES:
-+     command_line.warn_poison_system_directories = true;
-+     break;
-+
-+   case OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES:
-+     command_line.warn_poison_system_directories = false;
-+     break;
-+
-+   case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
-+     command_line.error_poison_system_directories = true;
-+     break;
-+
- 	case OPTION_PUSH_STATE:
- 	  input_flags.pushed = xmemdup (&input_flags,
- 					sizeof (input_flags),
--- 
-2.44.2
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2024-06-29 16:32 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2024-06-29 16:32 UTC (permalink / raw
  To: gentoo-commits

commit:     ef75bb26c983c91db82996224bf38e0feefd94c3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 29 16:31:33 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jun 29 16:31:33 2024 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=ef75bb26

Not needed anymore

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...ss-hash-style-sysv-to-ld-in-the-testsuite.patch | 61 ----------------------
 1 file changed, 61 deletions(-)

diff --git a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
deleted file mode 100644
index 4cfd1da..0000000
--- a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From b706ce22cbea4edb8ba06ef1b64f6b20f3502d0c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Tue, 20 Jul 2021 21:15:24 +0200
-Subject: [PATCH 4/7] Gentoo: Pass --hash-style=sysv to ld in the testsuite
-
----
- binutils/testsuite/lib/binutils-common.exp |  2 +-
- ld/testsuite/lib/ld-lib.exp                | 16 ++++++++++++++--
- 2 files changed, 15 insertions(+), 3 deletions(-)
-
-diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
-index f0136577b6c..afb6f7cc9c3 100644
---- a/binutils/testsuite/lib/binutils-common.exp
-+++ b/binutils/testsuite/lib/binutils-common.exp
-@@ -1394,7 +1394,7 @@ proc run_dump_test { name {extra_options {}} } {
- 
- 	    # Add -L$srcdir/$subdir so that the linker command can use
- 	    # linker scripts in the source directory.
--	    set cmd "$LD $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
-+	    set cmd "$LD --hash-style=sysv $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
- 		   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
- 
- 	    # If needed then check for, or add a -Map option.
-diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index e6e643ca3ca..b1164e9a96f 100644
---- a/ld/testsuite/lib/ld-lib.exp
-+++ b/ld/testsuite/lib/ld-lib.exp
-@@ -171,7 +171,7 @@ proc default_ld_relocate { ld target objects } {
-     global HOSTING_EMU
- 
-     remote_file host delete $target
--    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
-+    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv -o $target -r $objects"]
- }
- 
- # Check to see if ld is being invoked with a non-endian output format
-@@ -202,8 +202,20 @@ proc default_ld_link { ld target objects } {
- 	set flags [big_or_little_endian]
-     }
- 
-+    # Hilariously, this procedure is called sometimes with $CC and sometimes
-+    # with $ld as parameter. If we want to change the default behaviour, we
-+    # need to take the different option formats into account.
-+    # We check the $ld parameter for
-+    # - ld-new         -> we're working with the new linker
-+    # - otherwise      -> we're likely working with the system compiler
-+    if {[regexp {ld-new$} $ld]} {
-+      set gentoosysv "--hash-style=sysv"
-+    } else {
-+      set gentoosysv "-Wl,--hash-style=sysv"
-+    }
-+
-     remote_file host delete $target
--    set exec_output [run_host_cmd "$ld" "$flags -o $target $objects"]
-+    set exec_output [run_host_cmd "$ld" "$gentoosysv $flags -o $target $objects"]
-     set exec_output [prune_warnings $exec_output]
- 
-     # We don't care if we get a warning about a non-existent start
--- 
-2.44.2
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2024-06-28 21:48 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2024-06-28 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     cf4082117e6e8e456dd2e4d92b3d1a50d38ce2c5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 28 21:48:16 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jun 28 21:48:16 2024 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=cf408211

Rebase patches for master

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch | 76 +++++++++++-----------
 ...iberty-install-PIC-version-of-libiberty.a.patch |  6 +-
 ...oo-add-with-extra-soversion-suffix-option.patch | 28 ++++----
 ...ss-hash-style-sysv-to-ld-in-the-testsuite.patch | 10 +--
 ...-also-libctf-optionally-a-gentoo-specific.patch | 32 ++++-----
 ...0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch | 10 +--
 ...ilar-libiberty-fix-as-in-7d53105d-for-lib.patch | 16 ++---
 7 files changed, 89 insertions(+), 89 deletions(-)

diff --git a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index e054415..f11678e 100644
--- a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,4 +1,4 @@
-From 7b47d0be518ef97bb5259a5dbb70d6b3f22011f6 Mon Sep 17 00:00:00 2001
+From 68b26b5bf2047d71fac89ee321c0f9231c85903e Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 20 Jul 2021 21:08:31 +0200
 Subject: [PATCH 1/7] Gentoo: gold/ld: add support for poisoned system
@@ -44,7 +44,7 @@ Ported to binutils 2.39 by WANG Xuerui <xen0n@gentoo.org>
  11 files changed, 148 insertions(+)
 
 diff --git a/gold/options.cc b/gold/options.cc
-index c9834b66159..bd3e948a61b 100644
+index 46f067fa72f..a07ba1c82ed 100644
 --- a/gold/options.cc
 +++ b/gold/options.cc
 @@ -1355,6 +1355,39 @@ General_options::finalize()
@@ -88,7 +88,7 @@ index c9834b66159..bd3e948a61b 100644
    if (this->shared() && this->is_static())
      gold_fatal(_("-shared and -static are incompatible"));
 diff --git a/gold/options.h b/gold/options.h
-index 46f658f23ea..8f9b8c177ad 100644
+index 446e8d42614..464863b45fa 100644
 --- a/gold/options.h
 +++ b/gold/options.h
 @@ -1402,6 +1402,13 @@ class General_options
@@ -106,10 +106,10 @@ index 46f658f23ea..8f9b8c177ad 100644
  	      N_("Warn when skipping an incompatible library"),
  	      N_("Don't warn when skipping an incompatible library"));
 diff --git a/ld/config.in b/ld/config.in
-index a453c7f7241..a0bc2a56013 100644
+index f7c9da3d02a..e4fdbf6db5b 100644
 --- a/ld/config.in
 +++ b/ld/config.in
-@@ -58,6 +58,9 @@
+@@ -74,6 +74,9 @@
     language is requested. */
  #undef ENABLE_NLS
  
@@ -120,10 +120,10 @@ index a453c7f7241..a0bc2a56013 100644
  #undef EXTRA_SHLIB_EXTENSION
  
 diff --git a/ld/configure b/ld/configure
-index d2cdf256b89..0f32e98bc34 100755
+index 4e8de840418..f6d3069133e 100755
 --- a/ld/configure
 +++ b/ld/configure
-@@ -838,6 +838,7 @@ with_lib_path
+@@ -844,6 +844,7 @@ with_lib_path
  enable_targets
  enable_64_bit_bfd
  with_sysroot
@@ -131,7 +131,7 @@ index d2cdf256b89..0f32e98bc34 100755
  enable_gold
  enable_got
  enable_compressed_debug_sections
-@@ -1520,6 +1521,8 @@ Optional Features:
+@@ -1535,6 +1536,8 @@ Optional Features:
    --enable-checking       enable run-time checks
    --enable-targets        alternative target configurations
    --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
@@ -140,7 +140,7 @@ index d2cdf256b89..0f32e98bc34 100755
    --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
    --enable-got=<type>     GOT handling scheme (target, single, negative,
                            multigot)
-@@ -15538,6 +15541,19 @@ fi
+@@ -15566,6 +15569,19 @@ fi
  
  
  
@@ -161,10 +161,10 @@ index d2cdf256b89..0f32e98bc34 100755
  if test "${enable_gold+set}" = set; then :
    enableval=$enable_gold; case "${enableval}" in
 diff --git a/ld/configure.ac b/ld/configure.ac
-index c3ebd3ec7e4..71790d7640f 100644
+index bdf51a062fa..3d370ff92ce 100644
 --- a/ld/configure.ac
 +++ b/ld/configure.ac
-@@ -103,6 +103,16 @@ AC_SUBST(use_sysroot)
+@@ -102,6 +102,16 @@ AC_SUBST(use_sysroot)
  AC_SUBST(TARGET_SYSTEM_ROOT)
  AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
  
@@ -182,10 +182,10 @@ index c3ebd3ec7e4..71790d7640f 100644
  dnl "install_as_default" is set to false if gold is the default linker.
  dnl "installed_linker" is the installed BFD linker name.
 diff --git a/ld/ld.h b/ld/ld.h
-index a0f8a15c7a9..69420b6673a 100644
+index 0dee944cf2a..a2bb9a10993 100644
 --- a/ld/ld.h
 +++ b/ld/ld.h
-@@ -163,6 +163,13 @@ typedef struct
+@@ -166,6 +166,13 @@ typedef struct
       in the linker script.  */
    bool force_group_allocation;
  
@@ -200,10 +200,10 @@ index a0f8a15c7a9..69420b6673a 100644
    enum endian_enum endian;
  
 diff --git a/ld/ld.texi b/ld/ld.texi
-index 1f56ded1041..1fa6bf7b225 100644
+index 89e3913317a..cd16eb9685e 100644
 --- a/ld/ld.texi
 +++ b/ld/ld.texi
-@@ -3070,6 +3070,24 @@ creation of the metadata note, if one had been enabled by an earlier
+@@ -3245,6 +3245,24 @@ creation of the metadata note, if one had been enabled by an earlier
  occurrence of the --package-metadata option.
  If the linker has been built with libjansson, then the JSON string
  will be validated.
@@ -229,15 +229,14 @@ index 1f56ded1041..1fa6bf7b225 100644
  
  @c man end
 diff --git a/ld/ldfile.c b/ld/ldfile.c
-index 8f869c1f19e..ee9d4bccee2 100644
+index 87be885d31a..469ab52f985 100644
 --- a/ld/ldfile.c
 +++ b/ld/ldfile.c
-@@ -327,6 +327,26 @@ ldfile_add_library_path (const char *name, bool cmdline)
-     new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
-   else
-     new_dirs->name = xstrdup (name);
-+
-+  if (command_line.warn_poison_system_directories
+@@ -344,6 +344,26 @@ ldfile_add_library_path (const char *name, enum search_dir_source source)
+       search_tail_ptr = &new_dirs->next;
+     }
+ 
++ if (command_line.warn_poison_system_directories
 +      && (!strncmp (name, "/lib", 4)
 +      /* TODO: This check is disabled for now due to a bunch of packages that
 +       * use libtool and relink with -L/usr/lib paths (albeit after the right
@@ -245,25 +244,26 @@ index 8f869c1f19e..ee9d4bccee2 100644
 +       * We also need to adjust it so it only rejects one or two levels deep.
 +       * Gcc's internal paths also live below /usr/lib.
 +       * http://crbug.com/488360  */
-+	  /* || !strncmp (name, "/usr/lib", 8) */
-+	  || !strncmp (name, "/usr/local/lib", 14)
-+	  || !strncmp (name, "/usr/X11R6/lib", 14)))
++       /* || !strncmp (name, "/usr/lib", 8) */
++          || !strncmp (name, "/usr/local/lib", 14)
++          || !strncmp (name, "/usr/X11R6/lib", 14)))
 +    {
 +      if (command_line.error_poison_system_directories)
-+	einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
-+	         "cross-compilation\n"), name);
++        einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
++                 "cross-compilation\n"), name);
 +      else
-+	einfo (_("%P: warning: library search path \"%s\" is unsafe for "
-+	         "cross-compilation\n"), name);
++        einfo (_("%P: warning: library search path \"%s\" is unsafe for "
++                 "cross-compilation\n"), name);
 +    }
++
+   return new_dirs;
  }
  
- /* Try to open a BFD for a lang_input_statement.  */
 diff --git a/ld/ldlex.h b/ld/ldlex.h
-index 87cac02141d..d79ec8faa15 100644
+index defe3fcbbb9..ab94487edc6 100644
 --- a/ld/ldlex.h
 +++ b/ld/ldlex.h
-@@ -151,6 +151,9 @@ enum option_values
+@@ -153,6 +153,9 @@ enum option_values
    OPTION_PRINT_OUTPUT_FORMAT,
    OPTION_PRINT_SYSROOT,
    OPTION_IGNORE_UNRESOLVED_SYMBOL,
@@ -274,10 +274,10 @@ index 87cac02141d..d79ec8faa15 100644
    OPTION_POP_STATE,
    OPTION_DISABLE_MULTIPLE_DEFS_ABS,
 diff --git a/ld/ldmain.c b/ld/ldmain.c
-index 06ac2c64fa8..5ec931a0255 100644
+index 037099b9d37..552a191a857 100644
 --- a/ld/ldmain.c
 +++ b/ld/ldmain.c
-@@ -325,6 +325,13 @@ main (int argc, char **argv)
+@@ -347,6 +347,13 @@ main (int argc, char **argv)
    command_line.warn_mismatch = true;
    command_line.warn_search_mismatch = true;
    command_line.check_section_addresses = -1;
@@ -292,10 +292,10 @@ index 06ac2c64fa8..5ec931a0255 100644
    /* We initialize DEMANGLING based on the environment variable
       COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
 diff --git a/ld/lexsup.c b/ld/lexsup.c
-index 49dfc13382a..b2d1d967aa0 100644
+index 4aa0124ce2f..e8e28ac7ea4 100644
 --- a/ld/lexsup.c
 +++ b/ld/lexsup.c
-@@ -594,6 +594,18 @@ static const struct ld_option ld_options[] =
+@@ -613,6 +613,18 @@ static const struct ld_option ld_options[] =
      OPTION_IGNORE_UNRESOLVED_SYMBOL},
      '\0', N_("SYMBOL"),
      N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
@@ -314,7 +314,7 @@ index 49dfc13382a..b2d1d967aa0 100644
    { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
      '\0', NULL, N_("Push state of flags governing input file handling"),
      TWO_DASHES },
-@@ -1738,6 +1750,18 @@ parse_args (unsigned argc, char **argv)
+@@ -1785,6 +1797,18 @@ parse_args (unsigned argc, char **argv)
  	  }
  	  break;
  
@@ -334,5 +334,5 @@ index 49dfc13382a..b2d1d967aa0 100644
  	  input_flags.pushed = xmemdup (&input_flags,
  					sizeof (input_flags),
 -- 
-2.42.0
+2.44.2
 

diff --git a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index d428c20..a36bb51 100644
--- a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,4 +1,4 @@
-From 1156f7b2f690654cf5810ef1e34791d18d207a9f Mon Sep 17 00:00:00 2001
+From 1594a93229b13d3c34c679e5991e64663cace1b9 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
 Subject: [PATCH 2/7] Gentoo: libiberty: install PIC version of libiberty.a
@@ -18,7 +18,7 @@ general are fairly low, and we'd rather have things work for all of them.
  1 file changed, 1 insertion(+)
 
 diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
-index f9fbba23e2c..d37488d1bf8 100644
+index b77a41c781c..5e3725d16ff 100644
 --- a/libiberty/Makefile.in
 +++ b/libiberty/Makefile.in
 @@ -258,6 +258,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
@@ -30,5 +30,5 @@ index f9fbba23e2c..d37488d1bf8 100644
  	else true; fi; \
  	if [ x"$(NOASANFLAG)" != x ]; then \
 -- 
-2.42.0
+2.44.2
 

diff --git a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
index d4d4571..3694049 100644
--- a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,4 +1,4 @@
-From 411d52402227b6e1a9c779988f6f0fc1e17c6620 Mon Sep 17 00:00:00 2001
+From 6d6cbf2ede96fd65bd7a9382c3364aaa9d0ac3bb Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Tue, 20 Jul 2021 21:12:38 +0200
 Subject: [PATCH 3/7] Gentoo: add --with-extra-soversion-suffix= option
@@ -34,7 +34,7 @@ Ported to binutils 2.37 by Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 29 insertions(+)
 
 diff --git a/bfd/Makefile.am b/bfd/Makefile.am
-index 378c13198d6..e0fa379ca8e 100644
+index 0dc733eaba9..5bd636d931a 100644
 --- a/bfd/Makefile.am
 +++ b/bfd/Makefile.am
 @@ -64,6 +64,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
@@ -46,7 +46,7 @@ index 378c13198d6..e0fa379ca8e 100644
  # bfd.h goes here, for now
  BFD_H = bfd.h
  
-@@ -991,6 +993,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -999,6 +1001,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -57,10 +57,10 @@ index 378c13198d6..e0fa379ca8e 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/Makefile.in b/bfd/Makefile.in
-index 8d09f6fa4af..d397502bb4d 100644
+index b3d97d478ea..38209d1b234 100644
 --- a/bfd/Makefile.in
 +++ b/bfd/Makefile.in
-@@ -342,6 +342,7 @@ ECHO_T = @ECHO_T@
+@@ -348,6 +348,7 @@ ECHO_T = @ECHO_T@
  EGREP = @EGREP@
  EXEEXT = @EXEEXT@
  EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
@@ -68,7 +68,7 @@ index 8d09f6fa4af..d397502bb4d 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -2454,6 +2455,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -2471,6 +2472,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -79,10 +79,10 @@ index 8d09f6fa4af..d397502bb4d 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index f0a07ff675f..2322e9b61cf 100755
+index 6458974951e..b43789851cd 100755
 --- a/bfd/configure
 +++ b/bfd/configure
-@@ -695,6 +695,7 @@ WARN_CFLAGS
+@@ -701,6 +701,7 @@ WARN_CFLAGS
  REPORT_BUGS_TEXI
  REPORT_BUGS_TO
  PKGVERSION
@@ -90,7 +90,7 @@ index f0a07ff675f..2322e9b61cf 100755
  DEBUGDIR
  ENABLE_BFD_64_BIT_FALSE
  ENABLE_BFD_64_BIT_TRUE
-@@ -836,6 +837,7 @@ enable_secureplt
+@@ -842,6 +843,7 @@ enable_secureplt
  enable_separate_code
  enable_leading_mingw64_underscores
  with_separate_debug_dir
@@ -98,7 +98,7 @@ index f0a07ff675f..2322e9b61cf 100755
  with_pkgversion
  with_bugurl
  enable_werror
-@@ -1518,6 +1520,8 @@ Optional Packages:
+@@ -1530,6 +1532,8 @@ Optional Packages:
    --with-separate-debug-dir=DIR
                            Look for global separate debug info in DIR
                            [[default=LIBDIR/debug]]
@@ -107,7 +107,7 @@ index f0a07ff675f..2322e9b61cf 100755
    --with-pkgversion=PKG   Use PKG in the version string in place of "GNU
                            Binutils"
    --with-bugurl=URL       Direct users to URL to report a bug
-@@ -12064,6 +12068,15 @@ fi
+@@ -12082,6 +12086,15 @@ fi
  
  
  
@@ -124,10 +124,10 @@ index f0a07ff675f..2322e9b61cf 100755
  
  # Check whether --with-pkgversion was given.
 diff --git a/bfd/configure.ac b/bfd/configure.ac
-index d1e7e3a4bf3..48f2d69991c 100644
+index 6bcfd1b7368..dde0a3af03e 100644
 --- a/bfd/configure.ac
 +++ b/bfd/configure.ac
-@@ -168,6 +168,13 @@ AC_ARG_WITH(separate-debug-dir,
+@@ -167,6 +167,13 @@ AC_ARG_WITH(separate-debug-dir,
  [DEBUGDIR="${withval}"])
  AC_SUBST(DEBUGDIR)
  
@@ -142,5 +142,5 @@ index d1e7e3a4bf3..48f2d69991c 100644
  ACX_BUGURL([https://sourceware.org/bugzilla/])
  
 -- 
-2.42.0
+2.44.2
 

diff --git a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
index 6d820fe..4cfd1da 100644
--- a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
+++ b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
@@ -1,4 +1,4 @@
-From 722482c5057cc921d1ab96266da29be4dc7d1354 Mon Sep 17 00:00:00 2001
+From b706ce22cbea4edb8ba06ef1b64f6b20f3502d0c Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Tue, 20 Jul 2021 21:15:24 +0200
 Subject: [PATCH 4/7] Gentoo: Pass --hash-style=sysv to ld in the testsuite
@@ -9,10 +9,10 @@ Subject: [PATCH 4/7] Gentoo: Pass --hash-style=sysv to ld in the testsuite
  2 files changed, 15 insertions(+), 3 deletions(-)
 
 diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
-index f89ac8a6108..2be9383b49e 100644
+index f0136577b6c..afb6f7cc9c3 100644
 --- a/binutils/testsuite/lib/binutils-common.exp
 +++ b/binutils/testsuite/lib/binutils-common.exp
-@@ -1340,7 +1340,7 @@ proc run_dump_test { name {extra_options {}} } {
+@@ -1394,7 +1394,7 @@ proc run_dump_test { name {extra_options {}} } {
  
  	    # Add -L$srcdir/$subdir so that the linker command can use
  	    # linker scripts in the source directory.
@@ -22,7 +22,7 @@ index f89ac8a6108..2be9383b49e 100644
  
  	    # If needed then check for, or add a -Map option.
 diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index aca303e0728..44f2865116f 100644
+index e6e643ca3ca..b1164e9a96f 100644
 --- a/ld/testsuite/lib/ld-lib.exp
 +++ b/ld/testsuite/lib/ld-lib.exp
 @@ -171,7 +171,7 @@ proc default_ld_relocate { ld target objects } {
@@ -57,5 +57,5 @@ index aca303e0728..44f2865116f 100644
  
      # We don't care if we get a warning about a non-existent start
 -- 
-2.42.0
+2.44.2
 

diff --git a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
index ab34ef9..6964aab 100644
--- a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
+++ b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
@@ -1,4 +1,4 @@
-From a0e9a882db04d45bf878b746a8a30c5e51619d8b Mon Sep 17 00:00:00 2001
+From a8cf14f5ea0a210928250fd1c47b4e45c39974c5 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 24 Jul 2021 15:20:16 +0200
 Subject: [PATCH 5/7] Gentoo: Give also libctf optionally a gentoo-specific
@@ -12,10 +12,10 @@ Subject: [PATCH 5/7] Gentoo: Give also libctf optionally a gentoo-specific
  4 files changed, 62 insertions(+), 2 deletions(-)
 
 diff --git a/libctf/Makefile.am b/libctf/Makefile.am
-index b1dbc2f6ba4..d282ceb619a 100644
+index fb1a306c888..5fcc73bd04e 100644
 --- a/libctf/Makefile.am
 +++ b/libctf/Makefile.am
-@@ -26,6 +26,9 @@ info_TEXINFOS =
+@@ -31,6 +31,9 @@ info_TEXINFOS =
  DISTCLEANFILES =
  MAINTAINERCLEANFILES =
  
@@ -25,7 +25,7 @@ index b1dbc2f6ba4..d282ceb619a 100644
  # This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
  # -I../zlib, unless we were configured with --with-system-zlib, in which
  # case both are empty.
-@@ -46,8 +49,17 @@ include_HEADERS =
+@@ -51,8 +54,17 @@ include_HEADERS =
  noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
  endif
  
@@ -45,10 +45,10 @@ index b1dbc2f6ba4..d282ceb619a 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
 diff --git a/libctf/Makefile.in b/libctf/Makefile.in
-index 3d2696bcc47..664d6360c47 100644
+index 54f5daa79ee..b7a80edfab6 100644
 --- a/libctf/Makefile.in
 +++ b/libctf/Makefile.in
-@@ -380,6 +380,7 @@ AUTOCONF = @AUTOCONF@
+@@ -430,6 +430,7 @@ AUTOCONF = @AUTOCONF@
  AUTOHEADER = @AUTOHEADER@
  AUTOMAKE = @AUTOMAKE@
  AWK = @AWK@
@@ -56,7 +56,7 @@ index 3d2696bcc47..664d6360c47 100644
  CATALOGS = @CATALOGS@
  CATOBJEXT = @CATOBJEXT@
  CC = @CC@
-@@ -402,6 +403,7 @@ EXEEXT = @EXEEXT@
+@@ -452,6 +453,7 @@ EXEEXT = @EXEEXT@
  
  # Setup the testing framework, if you have one
  EXPECT = expect
@@ -64,7 +64,7 @@ index 3d2696bcc47..664d6360c47 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -540,8 +542,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
+@@ -603,8 +605,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
  @INSTALL_LIBBFD_FALSE@include_HEADERS = 
  @INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
  @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
@@ -80,10 +80,10 @@ index 3d2696bcc47..664d6360c47 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
 diff --git a/libctf/configure b/libctf/configure
-index 4c01c022837..07778d52be4 100755
+index 7466d56a18b..54c86592b70 100755
 --- a/libctf/configure
 +++ b/libctf/configure
-@@ -645,6 +645,10 @@ BUILD_INFO_FALSE
+@@ -646,6 +646,10 @@ BUILD_INFO_FALSE
  BUILD_INFO_TRUE
  NEED_CTF_QSORT_R_FALSE
  NEED_CTF_QSORT_R_TRUE
@@ -94,7 +94,7 @@ index 4c01c022837..07778d52be4 100755
  ENABLE_LIBCTF_HASH_DEBUGGING_FALSE
  ENABLE_LIBCTF_HASH_DEBUGGING_TRUE
  zlibinc
-@@ -806,6 +810,7 @@ enable_maintainer_mode
+@@ -821,6 +825,7 @@ enable_maintainer_mode
  enable_install_libbfd
  with_system_zlib
  enable_libctf_hash_debugging
@@ -102,7 +102,7 @@ index 4c01c022837..07778d52be4 100755
  '
        ac_precious_vars='build_alias
  host_alias
-@@ -1463,6 +1468,8 @@ Optional Packages:
+@@ -1487,6 +1492,8 @@ Optional Packages:
                            both]
    --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
    --with-system-zlib      use installed libz
@@ -111,7 +111,7 @@ index 4c01c022837..07778d52be4 100755
  
  Some influential environment variables:
    CC          C compiler command
-@@ -14335,6 +14342,26 @@ else
+@@ -16274,6 +16281,26 @@ else
  fi
  
  
@@ -138,7 +138,7 @@ index 4c01c022837..07778d52be4 100755
  # Similar to GDB_AC_CHECK_BFD.
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
-@@ -15227,6 +15254,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
+@@ -17177,6 +17204,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
    as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined.
  Usually this means the macro was only invoked conditionally." "$LINENO" 5
  fi
@@ -150,7 +150,7 @@ index 4c01c022837..07778d52be4 100755
  if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; then
    as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined.
 diff --git a/libctf/configure.ac b/libctf/configure.ac
-index 6a5eade1855..a0e65a4aeda 100644
+index 64544b83a9f..1ce43327c25 100644
 --- a/libctf/configure.ac
 +++ b/libctf/configure.ac
 @@ -76,6 +76,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then
@@ -171,5 +171,5 @@ index 6a5eade1855..a0e65a4aeda 100644
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
 -- 
-2.42.0
+2.44.2
 

diff --git a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
index 2934cd3..fe6da95 100644
--- a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
+++ b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
@@ -1,4 +1,4 @@
-From 9bf3571ddf788d8986d1e45d54df356867bd23d9 Mon Sep 17 00:00:00 2001
+From d826b80fe902aefd77465be3650ab2d62af5e099 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 31 Jul 2021 01:18:18 +0200
 Subject: [PATCH 6/7] Gentoo: XFAIL 15 broken ld.gold tests
@@ -16,7 +16,7 @@ Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27303
  2 files changed, 18 insertions(+), 4 deletions(-)
 
 diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
-index df9405c1aac..749921633b2 100644
+index 2f1348fd6e2..1206460f191 100644
 --- a/gold/testsuite/Makefile.am
 +++ b/gold/testsuite/Makefile.am
 @@ -1,5 +1,11 @@
@@ -32,7 +32,7 @@ index df9405c1aac..749921633b2 100644
  # system and the host system are the same.  So these tests will not
  # work when building with a cross-compiler.
 diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
-index fb0eb12553b..b506a7f8da7 100644
+index 9cf21df8d7d..df14333c558 100644
 --- a/gold/testsuite/Makefile.in
 +++ b/gold/testsuite/Makefile.in
 @@ -15,10 +15,6 @@
@@ -61,7 +61,7 @@ index fb0eb12553b..b506a7f8da7 100644
  check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
  	$(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
  	$(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \
-@@ -2759,6 +2763,10 @@ top_srcdir = @top_srcdir@
+@@ -2782,6 +2786,10 @@ top_srcdir = @top_srcdir@
  zlibdir = @zlibdir@
  zlibinc = @zlibinc@
  
@@ -73,5 +73,5 @@ index fb0eb12553b..b506a7f8da7 100644
  AUTOMAKE_OPTIONS = foreign -Wno-portability
  
 -- 
-2.42.0
+2.44.2
 

diff --git a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
index 2331b5c..6eebb98 100644
--- a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
+++ b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
@@ -1,4 +1,4 @@
-From 51b418fda84420da6d2c0e830435ad61409daffb Mon Sep 17 00:00:00 2001
+From bbaa9fafb08385e5ad836bc30a2db3af47d1cc5a Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Wed, 22 Feb 2023 20:05:35 +0100
 Subject: [PATCH 7/7] Apply a similar libiberty fix as in 7d53105d for
@@ -18,7 +18,7 @@ Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 8 insertions(+), 6 deletions(-)
 
 diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
-index 20c8b0022e4..96dbc8e0e94 100644
+index fb4b8a0fafa..3d7cb18ff71 100644
 --- a/gprofng/src/Makefile.am
 +++ b/gprofng/src/Makefile.am
 @@ -144,7 +144,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
@@ -32,7 +32,7 @@ index 20c8b0022e4..96dbc8e0e94 100644
  	$(GPROFNG_LIBADD) \
  	-lpthread -ldl
 diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
-index 47da873b80c..52a22279cf7 100644
+index cef4b275305..295fd3ee2df 100644
 --- a/gprofng/src/Makefile.in
 +++ b/gprofng/src/Makefile.in
 @@ -552,7 +552,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
@@ -46,10 +46,10 @@ index 47da873b80c..52a22279cf7 100644
  	$(GPROFNG_LIBADD) \
  	-lpthread -ldl
 diff --git a/opcodes/configure b/opcodes/configure
-index a65b0a2f95b..f412c1a6c96 100755
+index 050fd5ff0ff..4b68211dea6 100755
 --- a/opcodes/configure
 +++ b/opcodes/configure
-@@ -12479,10 +12479,10 @@ if test "$enable_shared" = "yes"; then
+@@ -14379,10 +14379,10 @@ if test "$enable_shared" = "yes"; then
    case "${host}" in
      *-*-cygwin*)
        SHARED_LDFLAGS="-no-undefined"
@@ -63,10 +63,10 @@ index a65b0a2f95b..f412c1a6c96 100755
        ;;
    esac
 diff --git a/opcodes/configure.ac b/opcodes/configure.ac
-index cae2a67ff10..5cb194779e9 100644
+index 4d918e3ef9b..9692e69693e 100644
 --- a/opcodes/configure.ac
 +++ b/opcodes/configure.ac
-@@ -196,10 +196,10 @@ if test "$enable_shared" = "yes"; then
+@@ -195,10 +195,10 @@ if test "$enable_shared" = "yes"; then
    case "${host}" in
      *-*-cygwin*)
        SHARED_LDFLAGS="-no-undefined"
@@ -80,5 +80,5 @@ index cae2a67ff10..5cb194779e9 100644
        ;;
    esac
 -- 
-2.42.0
+2.44.2
 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-10-27  0:44 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2023-10-27  0:44 UTC (permalink / raw
  To: gentoo-commits

commit:     b7d242c5f8087d074f9caceb71d463cb6be264b3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  7 23:28:19 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug  7 23:28:36 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=b7d242c5

9999: Add various test suite patches, as well as an LTO warning fix

All of these are upstream and will be in 2.42.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 9999/0009-tests-objcopy-keep-debug.patch |  36 +++++++
 9999/0010-tests-pr23169b.patch           |  21 ++++
 9999/0011-tests-gprofng.patch            | 164 +++++++++++++++++++++++++++++++
 9999/0012-lto-type-mismatch.patch        |  20 ++++
 4 files changed, 241 insertions(+)

diff --git a/9999/0009-tests-objcopy-keep-debug.patch b/9999/0009-tests-objcopy-keep-debug.patch
new file mode 100644
index 0000000..dbe2a63
--- /dev/null
+++ b/9999/0009-tests-objcopy-keep-debug.patch
@@ -0,0 +1,36 @@
+https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=b99a9693430a9f04165b1b868f890b622bb1b46c
+https://sourceware.org/PR30699
+
+From b99a9693430a9f04165b1b868f890b622bb1b46c Mon Sep 17 00:00:00 2001
+From: Nick Clifton <nickc@redhat.com>
+Date: Tue, 1 Aug 2023 14:37:04 +0100
+Subject: [PATCH] Fix "--only-keep-debug for ELF relocatables" binutils test
+ for compilers which add .debug_macro sections to object files.
+
+  PR 30699
+  * binutils/testsuite/binutils-all/objcopy.exp (keep_debug_symbols_for_elf_relocatable): Do not add sections containing the string "debug_" to the list of non-debug sections.
+--- a/binutils/testsuite/binutils-all/objcopy.exp
++++ b/binutils/testsuite/binutils-all/objcopy.exp
+@@ -1028,7 +1028,11 @@ proc keep_debug_symbols_for_elf_relocatable { prog flags test } {
+ 	    {[^a-zA-Z]+([a-zA-Z0-9_\.]+)[ \t]+([A-Z]+)[ \t]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9]+[ \t]+([A-Z]*)[ \t]+[0-9]+(.*)} \
+ 	    $got all name type flag rest] } {
+ 	if { $type != "NOTE" && [regexp {[AG]} $flag] } {
+-	    lappend non_debug_sections $name
++	    # PR 30699: Some debug sections can be in a group, so
++	    # exclude sections whose name includes "debug_"
++	    if { ! [regexp {debug_} $name] } {
++		lappend non_debug_sections $name
++	    }
+ 	}
+ 	set got $rest
+     }
+@@ -1086,6 +1090,7 @@ switch [copy_setup] {
+ 	untested $test5
+ 	if [is_elf_format] {
+ 	    untested $test6
++	    untested $test7
+ 	}
+     }
+     "3" {
+-- 
+2.39.3

diff --git a/9999/0010-tests-pr23169b.patch b/9999/0010-tests-pr23169b.patch
new file mode 100644
index 0000000..5f75b02
--- /dev/null
+++ b/9999/0010-tests-pr23169b.patch
@@ -0,0 +1,21 @@
+https://sourceware.org/PR30698
+--- a/ld/testsuite/ld-ifunc/ifunc.exp
++++ b/ld/testsuite/ld-ifunc/ifunc.exp
+@@ -604,7 +604,7 @@ run_cc_link_tests [list \
+     ] \
+     [list \
+ 	"Build libpr23169a.so" \
+-	"-shared" \
++	"-shared -Wl,-z,lazy" \
+ 	"-fPIC -O2 -g" \
+ 	{ pr23169a.c } \
+ 	{} \
+@@ -751,7 +751,7 @@ run_ld_link_exec_tests [list \
+     ] \
+     [list \
+ 	"Run pr23169b" \
+-	"-pie -Wl,--no-as-needed tmpdir/libpr23169a.so" \
++	"-pie -Wl,--no-as-needed,-z,lazy tmpdir/libpr23169a.so" \
+ 	"" \
+ 	{ pr23169b.c pr23169c.c } \
+ 	"pr23169b" \

diff --git a/9999/0011-tests-gprofng.patch b/9999/0011-tests-gprofng.patch
new file mode 100644
index 0000000..b95afda
--- /dev/null
+++ b/9999/0011-tests-gprofng.patch
@@ -0,0 +1,164 @@
+https://inbox.sourceware.org/binutils/20230803203339.822435-1-vladimir.mezentsev@oracle.com/
+https://sourceware.org/PR30700
+
+From mboxrd@z Thu Jan  1 00:00:00 1970
+Return-Path: <SRS0=V8/R=DU=oracle.com=vladimir.mezentsev@sourceware.org>
+Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
+	by sourceware.org (Postfix) with ESMTPS id 7F83B3858D38
+	for <binutils@sourceware.org>; Thu,  3 Aug 2023 20:33:54 +0000 (GMT)
+DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F83B3858D38
+Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com
+Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com
+Received: from pps.filterd (m0246632.ppops.net [127.0.0.1])
+	by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 373JJDB5001450
+	for <binutils@sourceware.org>; Thu, 3 Aug 2023 20:33:54 GMT
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc :
+ subject : date : message-id : content-transfer-encoding : content-type :
+ mime-version; s=corp-2023-03-30;
+ bh=aBWH9303Y8NcOBnrwOK3V46ZpHc2uMbEHRXIxE2Mg8U=;
+ b=QXr05CxWU/hJ4gUV/hT+wrN4h0vjtTB48pepEU1M7MHli0ttn5Skv54tilAVfVKI/4cd
+ 1XlcEgN90YOHmnidsmH50z0NQ4NlFvezd1MYrs2+24ay2kIbeHKrOhDQ/EVJIvNLfpt7
+ pdZHkHpNkxl+glRpf9puwFHCFLe5Gqx6sSoz7C28I+5FMDB9/Rc3EQXtovTz90vIYSmO
+ A1PsW5C3AJG373lrpoUVxpbcxbOsH1fygEdsB4le8DRv2Pgya2WMWz3T2zL7t2gEtFCZ
+ XRbuIv+y4xYE2Q+aOJ4p5uxMbc4z3akRNes4LMwZ5U6NPRpwpOM3WFQw5x5jL6Wr6UXw zA== 
+Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20])
+	by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4tcu2fek-1
+	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
+	for <binutils@sourceware.org>; Thu, 03 Aug 2023 20:33:53 +0000
+Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
+	by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 373K58qp003980
+	for <binutils@sourceware.org>; Thu, 3 Aug 2023 20:33:51 GMT
+Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170])
+	by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s856rypc5-1
+	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
+	for <binutils@sourceware.org>; Thu, 03 Aug 2023 20:33:51 +0000
+ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
+ b=kZLU5BLuqIUtYWeeq/p3fogSPj1DwGv5PNeVj8xjEepBlQWfzC0ad+4n0znV8bSy0v8FqBxF1sCEZFns3lhzblg1Go5psyG/nJAvlrJ7BZQFBvNmPGwAuX2cxp49Ea7lxFwwhGUmGE1BkxanejSE0fy1gnQqGZzgbiuJfYt6lUnejJOnNTmqxI34DIAaJibRkTj/gD+rLI0k7qwgZGMslll/9ZfKz+Bpzs/oQFGA9ZY9q9xkBVGgRPVIzHHC+9V2Y2vJvbOoHa6njxS0RHCmLL9gXh0kK4rJruYUesbu3T+jOy7Kno/6uqG08NdwBrUIFaPEQUoxVXVOijvXQHr5Zw==
+ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
+ s=arcselector9901;
+ h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
+ bh=aBWH9303Y8NcOBnrwOK3V46ZpHc2uMbEHRXIxE2Mg8U=;
+ b=ejmYk7X1Z7pY0al9fEFi1vg5hSm/VA0h9l09UExzqmPiotIxFvI639eDwaNWiylM73bCWqtKbbROnZRB3rV1iDj/U2UqBWxfHxB2rGfK5CwLFcX+em4U8F9J1gNZyOAT5HcITq6SUTQ+X2qCh7l/xyQeCp1EEiDqr6Go9U5Fgm8rtFZGEC0LQ8XHKYm33P6FBXJCxpKYv69RPQFkTnZbOf1ZOdhnbOCYBslZIivjDMTsg5nqDZkNF6Hu0CxPPDafAKxoLzBiUSgf8Uf7Eu6hCs6zmDrKqeYvPfv1KqtmivuuTvsoaqks0xCCZko6Nd2GnU1sKTotkumAXfO6Zi5BOQ==
+ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
+ smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
+ dkim=pass header.d=oracle.com; arc=none
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
+ h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
+ bh=aBWH9303Y8NcOBnrwOK3V46ZpHc2uMbEHRXIxE2Mg8U=;
+ b=R6vVOn08a3k+gcCdUObb97WwvDSXIzBkR1ReaZ1dnUqS3ZyElhaRikL5Lyc3Q04w6vKd8PN7h2gkGnwA82Cm+hFEccHGB6blNJNEjOhvFX2Mg6XjMjwPNZ5xQ+rzTiGp2I765cpVdXH7qk0ObwPiTR2WhuXcK/dtWIdU4To6ADk=
+Received: from SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10)
+ by SN7PR10MB6473.namprd10.prod.outlook.com (2603:10b6:806:2a0::18) with
+ Microsoft SMTP Server (version=TLS1_2,
+ cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Thu, 3 Aug
+ 2023 20:33:49 +0000
+Received: from SA2PR10MB4636.namprd10.prod.outlook.com
+ ([fe80::a15b:c87d:10e3:5765]) by SA2PR10MB4636.namprd10.prod.outlook.com
+ ([fe80::a15b:c87d:10e3:5765%7]) with mapi id 15.20.6631.046; Thu, 3 Aug 2023
+ 20:33:49 +0000
+From: vladimir.mezentsev@oracle.com
+To: binutils@sourceware.org
+Cc: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
+Subject: [PATCH] gprofng: 30700 tmpdir/gp-collect-app_F test fails
+Date: Thu,  3 Aug 2023 13:33:39 -0700
+Message-Id: <20230803203339.822435-1-vladimir.mezentsev@oracle.com>
+X-Mailer: git-send-email 2.31.1
+Content-Transfer-Encoding: 8bit
+Content-Type: text/plain
+X-ClientProxiedBy: LO6P123CA0031.GBRP123.PROD.OUTLOOK.COM
+ (2603:10a6:600:2fe::11) To SA2PR10MB4636.namprd10.prod.outlook.com
+ (2603:10b6:806:11e::10)
+MIME-Version: 1.0
+X-MS-PublicTrafficType: Email
+X-MS-TrafficTypeDiagnostic: SA2PR10MB4636:EE_|SN7PR10MB6473:EE_
+X-MS-Office365-Filtering-Correlation-Id: 32d2aa61-d0f0-4bf7-c7e5-08db9460f18b
+X-MS-Exchange-SenderADCheck: 1
+X-MS-Exchange-AntiSpam-Relay: 0
+X-Microsoft-Antispam: BCL:0;
+X-Microsoft-Antispam-Message-Info: 
+	FtlSjDlfJ9H/HjBEUbcrniNfavhoIJJwMeiHr/7PhA98yEcoC1q9zylXvVp7m0JPVj/gnTmS4z69ouHzfKuVWqLENJB9dmRnMv+od0/AsNTwOXFrvlmWYd5TyqhBuIjoG+WuwwuwkVmmUPiKLKfNRwxTpG1gXLDhTN6Psviul8nKELjewe5C+S5mzpY5NhVwJVp4JxnsES3HmWgBTO8OvnLss+/Sr0bLQY4nYfOpHvUtWdRvrqw9S26LGlFE8Z65FJP9STwGKbuGMBerRcHqeCIXIhyGKBwV9H9CdXLn9gOkhlXmjhNzu4x8H4oSCzfo/67bC8JNYZxemIRfHR/MttqTtpBYGCgeTcVeA1rc5U89DUdc3eCf8CSP59iJgpEKWHjEsZlEeb7bcFM1MHgnOnXuWgV3Z9m5hESVpQS3AsXUVQLKvRBYny8REC27NXsUyAZ5/SJ04aJGaSQ9AIUORqw1Kky1OGzYGQocDr4CxduZ1hac+X+8bRiSCjv74qsIe6nb3TtA1AkITgFbX8gH7UOwDwRmS5b6YEARR6BshFys26Xn/ktn/opathwyrZhN
+X-Forefront-Antispam-Report: 
+	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA2PR10MB4636.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(376002)(136003)(396003)(39860400002)(451199021)(66476007)(66556008)(66946007)(2616005)(316002)(4326008)(6916009)(5660300002)(107886003)(41300700001)(186003)(6506007)(8676002)(1076003)(8936002)(86362001)(9686003)(6512007)(6666004)(478600001)(6486002)(38100700002)(2906002)(36756003)(83380400001);DIR:OUT;SFP:1101;
+X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
+X-MS-Exchange-AntiSpam-MessageData-0: 
+	=?us-ascii?Q?2vVQXnKygJyQd+tHtgSFfe014vrOKhj7QtnqPMa5sAkBUzF4FJTFNTsO/pC4?=
+ =?us-ascii?Q?gbe82wLSPsQ5xjf3KK41AKConilQU9fCfKMhaBEFVxH33ZS2DURmSf+gjSsJ?=
+ =?us-ascii?Q?UAf/zzFrAaUhLIdqP4Tkz6g+0SiqXyTlJOodWIvT3V6JMuKqQA9D1xHbZXF0?=
+ =?us-ascii?Q?0py1g7VYW0jYGcVzeCAq2lJsAHran5yjaHNDrR4SmoM4F9uNg2KNGw75ylRd?=
+ =?us-ascii?Q?6jbbaGKhUrlHyB9CeTNkvz71c7NH28AuAci6B5fzwuWJkcgNbLOIx41Bq/ZX?=
+ =?us-ascii?Q?Zgq4LF5BY80VuzfBGES1sjy2jFmuAsdvjYcBlnJGVcooG7qt9N6Fl/f8HUyu?=
+ =?us-ascii?Q?P1rRJB4pgLWC3egtg8vS5Lh4K0KQi0XKs7ks46aVjAiGY/IfHVIzb1L2nD+G?=
+ =?us-ascii?Q?RgCwy2Ubx//WcCBiTOQS5yjNxSFt4KZByQp99anrtZfJ8xiE6mghQyusbfWu?=
+ =?us-ascii?Q?g1AyKl5aCp8FHXW/vb906djTCM2opRpwR1GmBxXIaMpO/v8j9/eRSQ1R/niB?=
+ =?us-ascii?Q?YVZluKsc6R/xTJ2cZNeMJUcQafEYByOAik33U7t5Q9HNMWZ91jiWYsMWKVrj?=
+ =?us-ascii?Q?8fibDL3u05AmgiaNeXbYjK7ISPXHOjIRThWj+ILCkdR9Wfmlv5D1svssgxeL?=
+ =?us-ascii?Q?EFi3hdvD3shR2mvssmsOGWut6ZWbSEND49EhDnOS1nK6nvGRryfvIc8eAU9K?=
+ =?us-ascii?Q?tEujniv2fU6TygAo+5qcav55Dd1ng19ndQFZNMle7b/w9bEA9jXH7mqLpPyd?=
+ =?us-ascii?Q?nrNH8S3GeRmb9GCsePQApFOiwgv9gHDa18eSoOTBRlpltPb3HHmPCmaDZLWJ?=
+ =?us-ascii?Q?dXB+SI80yXLZCQhiR6u6wHplpH+d5GjZGjFxk3aNFtCb2EhaFq6OHz/f4R34?=
+ =?us-ascii?Q?FvutRMk+qKmCJ1/jop1nfn6tM6vFajL0AvOG6XVU9m24DxRAKd8AUDFVM/rO?=
+ =?us-ascii?Q?FI1KBQs7oEMN0dSzxl6C4pPmhQx6JXDgZoIN1e42hk2xt4bptYUZAzjKDSxw?=
+ =?us-ascii?Q?3CZ9+2dM0MjmLwaQkA9bmdGJNmK+UlBSIa2I+/iJeihktlMtgt0zQk+mUqCd?=
+ =?us-ascii?Q?+/IsDmOj9RMecwrIMFUhbUPzCUlns3ZrK9TbBxcqpK5Z1tNOF3lIlcUGnOSw?=
+ =?us-ascii?Q?I38m5CXSt4JAMsPpu379MT3JE+oVTrAjgPCOml29osBxGw/mPilKfqSfMJxi?=
+ =?us-ascii?Q?8ZesU2hceSc6WFr+kgfbZTDNqQIQKwNPVphs2w566wP8Ae66Gu9qLp6Bk5HQ?=
+ =?us-ascii?Q?cwZsfHa00oFB9vgkynYZ+mPu4dG9zV7WftOxsKEl59E/cORj3vQ24ZGMlUHG?=
+ =?us-ascii?Q?LB0jLAznZgOQmkUqVmmsqxvtD1/skR3r5CGlJ/K9FN82gYMuVRUT79ppg/r9?=
+ =?us-ascii?Q?e1JOgVXvnqlf4s2jYxQw3bi9QlyiFFy7MR9xMNLt7UdOV7+GdtALZXx+uOh3?=
+ =?us-ascii?Q?9/9DT7Pt4hWzZuKZc8kZGCrrZRBcpK753R/j7RlyFtGC9glPHkNaV5aQBJ6+?=
+ =?us-ascii?Q?Fwkt6CX12BvWW5krg2dy5ZCWkH+MBwS8/PxPbU5Z3bjW40j9fb2tTF8WUFVw?=
+ =?us-ascii?Q?NOkA45fBWCbMM84rbOEjN9VJElsbua90fGNcuLYEAxRCve6My1paBT4jV+k5?=
+ =?us-ascii?Q?pJraM4gq2jxgfMe/3re6+fc=3D?=
+X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
+X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 
+	5BKKV4T41EwJkqBWXCUBtKfSc0Kqk+2boYpd3LY1KKydGovf7vMEW8cZdK7DpnPReGtLMTe22G8WEdn+eueR59691BC3vrpoNVoYEMczhSi6Rf9TqO5yp8jgE/YufRIst16yC1oF14s88TE0rlftBH2NAVnB/7vKVBrmDa6SSwJyRcGyF1JIB8TKCuUj2m2a/aO9nNBSNZgl1xOBWfPKt3yBwe5hvrsmAQGm8H5Ms2bT4yhwxhA4M6f9bfj2BxBSHvDuCoJx4z7WCMycJJtY37+wT070rAkDGW6u7BTQfSdoup1NNo22gp74EJGxcn0jBDf6A0Oa6mVTe8SBy8SHFkhTwShvYYuj3R6PqqcUV8d0fvtXsNWbCydtFkZSwOugpE1y3RNtvvgtVHLdRSziiPl3CsW0cQEA0aQNdDec9xQV9uYmnQAQvHYQdMB8tGyV0viNsuIae7PaDF4fl0RJsz2Cj2EeuVwQP7txJ7YoU/qLVZLeVL9kk1F7ZCFD4L7tTjxH4/DN/AUWwpMq1U6yAiL6/ByELdB+ttlOTnbtHMN7HuNlJUosjFm59yldZZgz0nM8aiK8uZbcObBcmaHok0j11xKEKl/z3BjVuqKqtOfZs4HmKOCdLSr1cmf1JcnvvCFhjW5XCZySIqechbKUidMlivSQcIPvibERILfG3c+uU26pPEAZLwos3BWiBXFdBaN+nn2bjbrD85QjpnNUg7TF5YJOEXnodgzSvwrp9vD1SiT8sx3g4YD7kKy0E7YO
+X-OriginatorOrg: oracle.com
+X-MS-Exchange-CrossTenant-Network-Message-Id: 32d2aa61-d0f0-4bf7-c7e5-08db9460f18b
+X-MS-Exchange-CrossTenant-AuthSource: SA2PR10MB4636.namprd10.prod.outlook.com
+X-MS-Exchange-CrossTenant-AuthAs: Internal
+X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2023 20:33:49.4380
+ (UTC)
+X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
+X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
+X-MS-Exchange-CrossTenant-MailboxType: HOSTED
+X-MS-Exchange-CrossTenant-UserPrincipalName: mt6TZSKYv+lnLPXlQj7hP3NQSiJDZFEbIztaEFvS4u/Ey+jTQS21+Nywl1vdY7TPbl8qS+F2xjqerIF6YU3aJrJY+tEZOUTu7AfUUD4pUl8=
+X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6473
+X-Proofpoint-Virus-Version: vendor=baseguard
+ engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26
+ definitions=2023-08-03_22,2023-08-03_01,2023-05-22_02
+X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 spamscore=0
+ adultscore=0 malwarescore=0 suspectscore=0 mlxscore=0 mlxlogscore=999
+ classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000
+ definitions=main-2308030184
+X-Proofpoint-GUID: Ai1oZyaQBQimnED3Xzjh2Aq6NHTga79T
+X-Proofpoint-ORIG-GUID: Ai1oZyaQBQimnED3Xzjh2Aq6NHTga79T
+X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
+X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org
+List-Id: <binutils.sourceware.org>
+
+From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
+
+gprofng/ChangeLog
+2023-08-03  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
+
+	PR gprofng/30700
+	* testsuite/gprofng.display/gp-collect-app_F.exp: Fix -name argument
+	for sub-experiment filtering.
+--- a/gprofng/testsuite/gprofng.display/gp-collect-app_F.exp
++++ b/gprofng/testsuite/gprofng.display/gp-collect-app_F.exp
+@@ -46,11 +46,11 @@ proc run_gp_collect_app { subExpCnt F_opt } {
+     return -code break
+   }
+ 
+-  set output [run_native_host_cmd "find $tdir -name '*x1.er' | wc -l"]
++  set output [run_native_host_cmd "find $tdir -name '*_x?.er' | wc -l"]
+   set subExp [lindex $output 1]
+   if { $subExp != $subExpCnt } then {
+     set out [lindex $output 1]
+-    send_log "Test failed for -F $F_opt. subExp=$subExp. Shold be $subExpCnt\n"
++    send_log "Test failed for -F $F_opt. subExp=$subExp. Should be $subExpCnt\n"
+     fail $tdir
+     return -code break
+   }
+-- 
+2.31.1

diff --git a/9999/0012-lto-type-mismatch.patch b/9999/0012-lto-type-mismatch.patch
new file mode 100644
index 0000000..dbb6958
--- /dev/null
+++ b/9999/0012-lto-type-mismatch.patch
@@ -0,0 +1,20 @@
+https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=e34acfce343d53290e72c317213a28327bc52fb0
+
+From e34acfce343d53290e72c317213a28327bc52fb0 Mon Sep 17 00:00:00 2001
+From: Tom de Vries <tdevries@suse.de>
+Date: Thu, 3 Aug 2023 09:48:39 +0100
+Subject: [PATCH]  Fix Wlto-type-mismatch in opcodes/ft32-dis.c
+
+--- a/opcodes/ft32-dis.c
++++ b/opcodes/ft32-dis.c
+@@ -27,7 +27,7 @@
+ #include "opcode/ft32.h"
+ #include "disassemble.h"
+ 
+-extern const ft32_opc_info_t ft32_opc_info[128];
++extern const ft32_opc_info_t ft32_opc_info[];
+ 
+ static fprintf_ftype fpr;
+ static void *stream;
+-- 
+2.39.3


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-10-27  0:44 Sam James
  0 siblings, 0 replies; 51+ messages in thread
From: Sam James @ 2023-10-27  0:44 UTC (permalink / raw
  To: gentoo-commits

commit:     100720f399389f6fec20dcc98064db336e56c5b2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 27 00:44:00 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 00:44:00 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=100720f3

9999: rebase patches

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch |  48 ++----
 ...iberty-install-PIC-version-of-libiberty.a.patch |   4 +-
 ...oo-add-with-extra-soversion-suffix-option.patch |  18 +--
 ...ss-hash-style-sysv-to-ld-in-the-testsuite.patch |  10 +-
 ...-also-libctf-optionally-a-gentoo-specific.patch |  32 +---
 ...0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch |   4 +-
 ...ilar-libiberty-fix-as-in-7d53105d-for-lib.patch |  18 +--
 ...-failures-with-enable-textrel-check-error.patch | 139 -----------------
 9999/0009-tests-objcopy-keep-debug.patch           |  36 -----
 9999/0010-tests-pr23169b.patch                     |  21 ---
 9999/0011-tests-gprofng.patch                      | 164 ---------------------
 9999/0012-lto-type-mismatch.patch                  |  20 ---
 12 files changed, 49 insertions(+), 465 deletions(-)

diff --git a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index a724494..e054415 100644
--- a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,4 +1,4 @@
-From 930c326fd4f16299f06610cf3ff3ee94b13130e0 Mon Sep 17 00:00:00 2001
+From 7b47d0be518ef97bb5259a5dbb70d6b3f22011f6 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 20 Jul 2021 21:08:31 +0200
 Subject: [PATCH 1/7] Gentoo: gold/ld: add support for poisoned system
@@ -33,7 +33,7 @@ Ported to binutils 2.39 by WANG Xuerui <xen0n@gentoo.org>
  gold/options.cc | 33 +++++++++++++++++++++++++++++++++
  gold/options.h  |  7 +++++++
  ld/config.in    |  3 +++
- ld/configure    | 20 ++++++++++++++++++--
+ ld/configure    | 16 ++++++++++++++++
  ld/configure.ac | 10 ++++++++++
  ld/ld.h         |  7 +++++++
  ld/ld.texi      | 18 ++++++++++++++++++
@@ -41,7 +41,7 @@ Ported to binutils 2.39 by WANG Xuerui <xen0n@gentoo.org>
  ld/ldlex.h      |  3 +++
  ld/ldmain.c     |  7 +++++++
  ld/lexsup.c     | 24 ++++++++++++++++++++++++
- 11 files changed, 150 insertions(+), 2 deletions(-)
+ 11 files changed, 148 insertions(+)
 
 diff --git a/gold/options.cc b/gold/options.cc
 index c9834b66159..bd3e948a61b 100644
@@ -106,7 +106,7 @@ index 46f658f23ea..8f9b8c177ad 100644
  	      N_("Warn when skipping an incompatible library"),
  	      N_("Don't warn when skipping an incompatible library"));
 diff --git a/ld/config.in b/ld/config.in
-index ad0dc6a106c..d21edaddce7 100644
+index a453c7f7241..a0bc2a56013 100644
 --- a/ld/config.in
 +++ b/ld/config.in
 @@ -58,6 +58,9 @@
@@ -120,10 +120,10 @@ index ad0dc6a106c..d21edaddce7 100644
  #undef EXTRA_SHLIB_EXTENSION
  
 diff --git a/ld/configure b/ld/configure
-index 0c32b16241a..549b8d49f5e 100755
+index d2cdf256b89..0f32e98bc34 100755
 --- a/ld/configure
 +++ b/ld/configure
-@@ -839,6 +839,7 @@ with_lib_path
+@@ -838,6 +838,7 @@ with_lib_path
  enable_targets
  enable_64_bit_bfd
  with_sysroot
@@ -131,7 +131,7 @@ index 0c32b16241a..549b8d49f5e 100755
  enable_gold
  enable_got
  enable_compressed_debug_sections
-@@ -1521,6 +1522,8 @@ Optional Features:
+@@ -1520,6 +1521,8 @@ Optional Features:
    --enable-checking       enable run-time checks
    --enable-targets        alternative target configurations
    --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
@@ -140,25 +140,7 @@ index 0c32b16241a..549b8d49f5e 100755
    --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
    --enable-got=<type>     GOT handling scheme (target, single, negative,
                            multigot)
-@@ -11625,7 +11628,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11628 "configure"
-+#line 11626 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11731,7 +11734,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11734 "configure"
-+#line 11732 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -15483,6 +15486,19 @@ fi
+@@ -15538,6 +15541,19 @@ fi
  
  
  
@@ -179,7 +161,7 @@ index 0c32b16241a..549b8d49f5e 100755
  if test "${enable_gold+set}" = set; then :
    enableval=$enable_gold; case "${enableval}" in
 diff --git a/ld/configure.ac b/ld/configure.ac
-index 77edac3258c..a74dac63038 100644
+index c3ebd3ec7e4..71790d7640f 100644
 --- a/ld/configure.ac
 +++ b/ld/configure.ac
 @@ -103,6 +103,16 @@ AC_SUBST(use_sysroot)
@@ -218,11 +200,11 @@ index a0f8a15c7a9..69420b6673a 100644
    enum endian_enum endian;
  
 diff --git a/ld/ld.texi b/ld/ld.texi
-index aa8b1aa86eb..b57b0d5c9f5 100644
+index 1f56ded1041..1fa6bf7b225 100644
 --- a/ld/ld.texi
 +++ b/ld/ld.texi
-@@ -3059,6 +3059,24 @@ creation of the metadata note, if one had been enabled by an earlier
- occurrence of the --package-metdata option.
+@@ -3070,6 +3070,24 @@ creation of the metadata note, if one had been enabled by an earlier
+ occurrence of the --package-metadata option.
  If the linker has been built with libjansson, then the JSON string
  will be validated.
 +
@@ -247,7 +229,7 @@ index aa8b1aa86eb..b57b0d5c9f5 100644
  
  @c man end
 diff --git a/ld/ldfile.c b/ld/ldfile.c
-index df7c9cbd65e..ed15262e0bc 100644
+index 8f869c1f19e..ee9d4bccee2 100644
 --- a/ld/ldfile.c
 +++ b/ld/ldfile.c
 @@ -327,6 +327,26 @@ ldfile_add_library_path (const char *name, bool cmdline)
@@ -310,7 +292,7 @@ index 06ac2c64fa8..5ec931a0255 100644
    /* We initialize DEMANGLING based on the environment variable
       COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
 diff --git a/ld/lexsup.c b/ld/lexsup.c
-index fe8722313fe..5fd7350efc5 100644
+index 49dfc13382a..b2d1d967aa0 100644
 --- a/ld/lexsup.c
 +++ b/ld/lexsup.c
 @@ -594,6 +594,18 @@ static const struct ld_option ld_options[] =
@@ -352,5 +334,5 @@ index fe8722313fe..5fd7350efc5 100644
  	  input_flags.pushed = xmemdup (&input_flags,
  					sizeof (input_flags),
 -- 
-2.41.0
+2.42.0
 

diff --git a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index a0bffea..d428c20 100644
--- a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,4 +1,4 @@
-From 68b7e6f60dd42159af779d5b475b7df553655d1f Mon Sep 17 00:00:00 2001
+From 1156f7b2f690654cf5810ef1e34791d18d207a9f Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
 Subject: [PATCH 2/7] Gentoo: libiberty: install PIC version of libiberty.a
@@ -30,5 +30,5 @@ index f9fbba23e2c..d37488d1bf8 100644
  	else true; fi; \
  	if [ x"$(NOASANFLAG)" != x ]; then \
 -- 
-2.41.0
+2.42.0
 

diff --git a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
index 3c08be6..d4d4571 100644
--- a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,4 +1,4 @@
-From 3a489acb4547c320ba43858ead3586fed34c92b4 Mon Sep 17 00:00:00 2001
+From 411d52402227b6e1a9c779988f6f0fc1e17c6620 Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Tue, 20 Jul 2021 21:12:38 +0200
 Subject: [PATCH 3/7] Gentoo: add --with-extra-soversion-suffix= option
@@ -34,7 +34,7 @@ Ported to binutils 2.37 by Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 29 insertions(+)
 
 diff --git a/bfd/Makefile.am b/bfd/Makefile.am
-index 5c5fdefd3b8..fe26bbf4f0f 100644
+index 378c13198d6..e0fa379ca8e 100644
 --- a/bfd/Makefile.am
 +++ b/bfd/Makefile.am
 @@ -64,6 +64,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
@@ -46,7 +46,7 @@ index 5c5fdefd3b8..fe26bbf4f0f 100644
  # bfd.h goes here, for now
  BFD_H = bfd.h
  
-@@ -976,6 +978,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -991,6 +993,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -57,7 +57,7 @@ index 5c5fdefd3b8..fe26bbf4f0f 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/Makefile.in b/bfd/Makefile.in
-index 4edfedee924..70a2442957e 100644
+index 8d09f6fa4af..d397502bb4d 100644
 --- a/bfd/Makefile.in
 +++ b/bfd/Makefile.in
 @@ -342,6 +342,7 @@ ECHO_T = @ECHO_T@
@@ -68,7 +68,7 @@ index 4edfedee924..70a2442957e 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -2435,6 +2436,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -2454,6 +2455,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -79,7 +79,7 @@ index 4edfedee924..70a2442957e 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index dcb10317390..94a4e39d691 100755
+index f0a07ff675f..2322e9b61cf 100755
 --- a/bfd/configure
 +++ b/bfd/configure
 @@ -695,6 +695,7 @@ WARN_CFLAGS
@@ -107,7 +107,7 @@ index dcb10317390..94a4e39d691 100755
    --with-pkgversion=PKG   Use PKG in the version string in place of "GNU
                            Binutils"
    --with-bugurl=URL       Direct users to URL to report a bug
-@@ -12033,6 +12037,15 @@ fi
+@@ -12064,6 +12068,15 @@ fi
  
  
  
@@ -124,7 +124,7 @@ index dcb10317390..94a4e39d691 100755
  
  # Check whether --with-pkgversion was given.
 diff --git a/bfd/configure.ac b/bfd/configure.ac
-index f044616f4d9..f22a87f8f54 100644
+index d1e7e3a4bf3..48f2d69991c 100644
 --- a/bfd/configure.ac
 +++ b/bfd/configure.ac
 @@ -168,6 +168,13 @@ AC_ARG_WITH(separate-debug-dir,
@@ -142,5 +142,5 @@ index f044616f4d9..f22a87f8f54 100644
  ACX_BUGURL([https://sourceware.org/bugzilla/])
  
 -- 
-2.41.0
+2.42.0
 

diff --git a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
index 59c18ef..6d820fe 100644
--- a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
+++ b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
@@ -1,4 +1,4 @@
-From eb585240ae3079a2cdc081a2cd96e09db95947ef Mon Sep 17 00:00:00 2001
+From 722482c5057cc921d1ab96266da29be4dc7d1354 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Tue, 20 Jul 2021 21:15:24 +0200
 Subject: [PATCH 4/7] Gentoo: Pass --hash-style=sysv to ld in the testsuite
@@ -9,10 +9,10 @@ Subject: [PATCH 4/7] Gentoo: Pass --hash-style=sysv to ld in the testsuite
  2 files changed, 15 insertions(+), 3 deletions(-)
 
 diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
-index 7e6bf16ee6e..0491fff2883 100644
+index f89ac8a6108..2be9383b49e 100644
 --- a/binutils/testsuite/lib/binutils-common.exp
 +++ b/binutils/testsuite/lib/binutils-common.exp
-@@ -1354,7 +1354,7 @@ proc run_dump_test { name {extra_options {}} } {
+@@ -1340,7 +1340,7 @@ proc run_dump_test { name {extra_options {}} } {
  
  	    # Add -L$srcdir/$subdir so that the linker command can use
  	    # linker scripts in the source directory.
@@ -22,7 +22,7 @@ index 7e6bf16ee6e..0491fff2883 100644
  
  	    # If needed then check for, or add a -Map option.
 diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index 918464069a9..7d22ee70b27 100644
+index aca303e0728..44f2865116f 100644
 --- a/ld/testsuite/lib/ld-lib.exp
 +++ b/ld/testsuite/lib/ld-lib.exp
 @@ -171,7 +171,7 @@ proc default_ld_relocate { ld target objects } {
@@ -57,5 +57,5 @@ index 918464069a9..7d22ee70b27 100644
  
      # We don't care if we get a warning about a non-existent start
 -- 
-2.41.0
+2.42.0
 

diff --git a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
index 192fa4f..ab34ef9 100644
--- a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
+++ b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
@@ -1,4 +1,4 @@
-From 1de1744597aa5b2e29ddedfea42cd7f99796b0ec Mon Sep 17 00:00:00 2001
+From a0e9a882db04d45bf878b746a8a30c5e51619d8b Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 24 Jul 2021 15:20:16 +0200
 Subject: [PATCH 5/7] Gentoo: Give also libctf optionally a gentoo-specific
@@ -7,9 +7,9 @@ Subject: [PATCH 5/7] Gentoo: Give also libctf optionally a gentoo-specific
 ---
  libctf/Makefile.am  | 14 +++++++++++++-
  libctf/Makefile.in  |  9 ++++++++-
- libctf/configure    | 35 +++++++++++++++++++++++++++++++++--
+ libctf/configure    | 31 +++++++++++++++++++++++++++++++
  libctf/configure.ac | 10 ++++++++++
- 4 files changed, 64 insertions(+), 4 deletions(-)
+ 4 files changed, 62 insertions(+), 2 deletions(-)
 
 diff --git a/libctf/Makefile.am b/libctf/Makefile.am
 index b1dbc2f6ba4..d282ceb619a 100644
@@ -80,7 +80,7 @@ index 3d2696bcc47..664d6360c47 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
 diff --git a/libctf/configure b/libctf/configure
-index a0e40f49a80..356503f689f 100755
+index 4c01c022837..07778d52be4 100755
 --- a/libctf/configure
 +++ b/libctf/configure
 @@ -645,6 +645,10 @@ BUILD_INFO_FALSE
@@ -111,25 +111,7 @@ index a0e40f49a80..356503f689f 100755
  
  Some influential environment variables:
    CC          C compiler command
-@@ -11631,7 +11638,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11634 "configure"
-+#line 11641 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11737,7 +11744,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11740 "configure"
-+#line 11747 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -14304,6 +14311,26 @@ else
+@@ -14335,6 +14342,26 @@ else
  fi
  
  
@@ -156,7 +138,7 @@ index a0e40f49a80..356503f689f 100755
  # Similar to GDB_AC_CHECK_BFD.
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
-@@ -15196,6 +15223,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
+@@ -15227,6 +15254,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
    as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined.
  Usually this means the macro was only invoked conditionally." "$LINENO" 5
  fi
@@ -189,5 +171,5 @@ index 6a5eade1855..a0e65a4aeda 100644
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
 -- 
-2.41.0
+2.42.0
 

diff --git a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
index 210563c..2934cd3 100644
--- a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
+++ b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
@@ -1,4 +1,4 @@
-From 4718611dc4145a8d8de7534f150053c5accf96a1 Mon Sep 17 00:00:00 2001
+From 9bf3571ddf788d8986d1e45d54df356867bd23d9 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 31 Jul 2021 01:18:18 +0200
 Subject: [PATCH 6/7] Gentoo: XFAIL 15 broken ld.gold tests
@@ -73,5 +73,5 @@ index fb0eb12553b..b506a7f8da7 100644
  AUTOMAKE_OPTIONS = foreign -Wno-portability
  
 -- 
-2.41.0
+2.42.0
 

diff --git a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
index 8d7acd1..2331b5c 100644
--- a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
+++ b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
@@ -1,4 +1,4 @@
-From 7fbdb5f138dccdd3b65a0bd048802662c6302ea1 Mon Sep 17 00:00:00 2001
+From 51b418fda84420da6d2c0e830435ad61409daffb Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Wed, 22 Feb 2023 20:05:35 +0100
 Subject: [PATCH 7/7] Apply a similar libiberty fix as in 7d53105d for
@@ -18,10 +18,10 @@ Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 8 insertions(+), 6 deletions(-)
 
 diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
-index 219367fb9ce..d9365260e8d 100644
+index 20c8b0022e4..96dbc8e0e94 100644
 --- a/gprofng/src/Makefile.am
 +++ b/gprofng/src/Makefile.am
-@@ -131,7 +131,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
+@@ -144,7 +144,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
  # Pass -lpthread instead of $(PTHREAD_LIBS) due to $(PTHREAD_LIBS) being empty
  # when -nostdlib is passed to libtool.
  # See bug 29364 - libgprofng.so: needs to link against -pthread
@@ -32,7 +32,7 @@ index 219367fb9ce..d9365260e8d 100644
  	$(GPROFNG_LIBADD) \
  	-lpthread -ldl
 diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
-index b881268b0d9..0e8b707f7d7 100644
+index 47da873b80c..52a22279cf7 100644
 --- a/gprofng/src/Makefile.in
 +++ b/gprofng/src/Makefile.in
 @@ -552,7 +552,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
@@ -46,10 +46,10 @@ index b881268b0d9..0e8b707f7d7 100644
  	$(GPROFNG_LIBADD) \
  	-lpthread -ldl
 diff --git a/opcodes/configure b/opcodes/configure
-index 71504e10c51..cb669ed994f 100755
+index a65b0a2f95b..f412c1a6c96 100755
 --- a/opcodes/configure
 +++ b/opcodes/configure
-@@ -12445,10 +12445,10 @@ if test "$enable_shared" = "yes"; then
+@@ -12479,10 +12479,10 @@ if test "$enable_shared" = "yes"; then
    case "${host}" in
      *-*-cygwin*)
        SHARED_LDFLAGS="-no-undefined"
@@ -63,10 +63,10 @@ index 71504e10c51..cb669ed994f 100755
        ;;
    esac
 diff --git a/opcodes/configure.ac b/opcodes/configure.ac
-index 1beb72e87e0..79310916f7d 100644
+index cae2a67ff10..5cb194779e9 100644
 --- a/opcodes/configure.ac
 +++ b/opcodes/configure.ac
-@@ -193,10 +193,10 @@ if test "$enable_shared" = "yes"; then
+@@ -196,10 +196,10 @@ if test "$enable_shared" = "yes"; then
    case "${host}" in
      *-*-cygwin*)
        SHARED_LDFLAGS="-no-undefined"
@@ -80,5 +80,5 @@ index 1beb72e87e0..79310916f7d 100644
        ;;
    esac
 -- 
-2.41.0
+2.42.0
 

diff --git a/9999/0008-ld-Fix-test-failures-with-enable-textrel-check-error.patch b/9999/0008-ld-Fix-test-failures-with-enable-textrel-check-error.patch
deleted file mode 100644
index 7bf6a47..0000000
--- a/9999/0008-ld-Fix-test-failures-with-enable-textrel-check-error.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From mboxrd@z Thu Jan  1 00:00:00 1970
-Return-Path: <SRS0=Su1r=DO=gentoo.org=sam@sourceware.org>
-Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
-	by sourceware.org (Postfix) with ESMTP id 3725A3858D20
-	for <binutils@sourceware.org>; Fri, 28 Jul 2023 15:20:56 +0000 (GMT)
-DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3725A3858D20
-Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org
-Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org
-From: Sam James <sam@gentoo.org>
-To: binutils@sourceware.org
-Cc: nickc@redhat.com,
-	Sam James <sam@gentoo.org>
-Subject: [PATCH] ld: Fix test failures with --enable-textrel-check=error
-Date: Fri, 28 Jul 2023 16:20:34 +0100
-Message-ID: <20230728152042.401562-1-sam@gentoo.org>
-X-Mailer: git-send-email 2.41.0
-MIME-Version: 1.0
-Content-Transfer-Encoding: 8bit
-X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
-X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org
-List-Id: <binutils.sourceware.org>
-
-Tested with the following:
-* --enable-textrel-check=error
-* --enable-warn-execstack=yes
-* --enable-warn-rwx-segments=yes
-* --enable-default-execstack=no
-in preparation for hopefully toggling these in Gentoo Hardened
-at least.
-
-This is similar in nature to 0ab7005043ee404dabfd690952efc25c399995ae
-and 340640f710e690b37c885166949595cde5f827b2.
-
-This fixes the following test failures:
-* FAIL: ld-x86-64/pr18801a
-* FAIL: ld-x86-64/pr18801b
-* FAIL: ld-x86-64/ifunc-textrel-1a
-* FAIL: ld-x86-64/ifunc-textrel-1b
-* FAIL: ld-i386/pr18801a
-* FAIL: ld-i386/pr18801b
-* FAIL: ld-i386/ifunc-textrel-1a
-* FAIL: ld-i386/ifunc-textrel-1b
-
-Signed-off-by: Sam James <sam@gentoo.org>
----
- ld/testsuite/ld-i386/ifunc-textrel-1a.d   | 2 +-
- ld/testsuite/ld-i386/ifunc-textrel-1b.d   | 2 +-
- ld/testsuite/ld-i386/pr18801a.d           | 2 +-
- ld/testsuite/ld-i386/pr18801b.d           | 2 +-
- ld/testsuite/ld-x86-64/ifunc-textrel-1a.d | 2 +-
- ld/testsuite/ld-x86-64/ifunc-textrel-1b.d | 2 +-
- ld/testsuite/ld-x86-64/pr18801a.d         | 2 +-
- ld/testsuite/ld-x86-64/pr18801b.d         | 2 +-
- 8 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/ld/testsuite/ld-i386/ifunc-textrel-1a.d b/ld/testsuite/ld-i386/ifunc-textrel-1a.d
-index 15f545db03d..aad77e7d230 100644
---- a/ld/testsuite/ld-i386/ifunc-textrel-1a.d
-+++ b/ld/testsuite/ld-i386/ifunc-textrel-1a.d
-@@ -1,4 +1,4 @@
- #source: ../ld-x86-64/ifunc-textrel-1.s
- #as: --32
--#ld: -m elf_i386 -pie
-+#ld: -m elf_i386 -pie -z notext
- #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIE
-diff --git a/ld/testsuite/ld-i386/ifunc-textrel-1b.d b/ld/testsuite/ld-i386/ifunc-textrel-1b.d
-index 6e4a67c48f0..bf0f2ac5df9 100644
---- a/ld/testsuite/ld-i386/ifunc-textrel-1b.d
-+++ b/ld/testsuite/ld-i386/ifunc-textrel-1b.d
-@@ -1,4 +1,4 @@
- #source: ../ld-x86-64/ifunc-textrel-1.s
- #as: --32
--#ld: -m elf_i386 -shared
-+#ld: -m elf_i386 -shared -z notext
- #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIC
-diff --git a/ld/testsuite/ld-i386/pr18801a.d b/ld/testsuite/ld-i386/pr18801a.d
-index 73cb5d17beb..b1ef145a882 100644
---- a/ld/testsuite/ld-i386/pr18801a.d
-+++ b/ld/testsuite/ld-i386/pr18801a.d
-@@ -1,4 +1,4 @@
- #source: pr18801.s
- #as: --32
--#ld: -m elf_i386 -pie
-+#ld: -m elf_i386 -pie -z notext
- #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIE
-diff --git a/ld/testsuite/ld-i386/pr18801b.d b/ld/testsuite/ld-i386/pr18801b.d
-index 0bf7fb729cb..983346ca248 100644
---- a/ld/testsuite/ld-i386/pr18801b.d
-+++ b/ld/testsuite/ld-i386/pr18801b.d
-@@ -1,4 +1,4 @@
- #source: pr18801.s
- #as: --32
--#ld: -m elf_i386 -shared
-+#ld: -m elf_i386 -shared -z notext
- #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIC
-diff --git a/ld/testsuite/ld-x86-64/ifunc-textrel-1a.d b/ld/testsuite/ld-x86-64/ifunc-textrel-1a.d
-index 64a1e7021fd..667366091b9 100644
---- a/ld/testsuite/ld-x86-64/ifunc-textrel-1a.d
-+++ b/ld/testsuite/ld-x86-64/ifunc-textrel-1a.d
-@@ -1,4 +1,4 @@
- #source: ifunc-textrel-1.s
- #as: --64 -defsym __x86_64__=1
--#ld: -m elf_x86_64 -pie
-+#ld: -m elf_x86_64 -pie -z notext
- #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIE
-diff --git a/ld/testsuite/ld-x86-64/ifunc-textrel-1b.d b/ld/testsuite/ld-x86-64/ifunc-textrel-1b.d
-index aeb31fdb3dc..f7b8e02a72c 100644
---- a/ld/testsuite/ld-x86-64/ifunc-textrel-1b.d
-+++ b/ld/testsuite/ld-x86-64/ifunc-textrel-1b.d
-@@ -1,4 +1,4 @@
- #source: ifunc-textrel-1.s
- #as: --64 -defsym __x86_64__=1
--#ld: -m elf_x86_64 -shared
-+#ld: -m elf_x86_64 -shared -z notext
- #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIC
-diff --git a/ld/testsuite/ld-x86-64/pr18801a.d b/ld/testsuite/ld-x86-64/pr18801a.d
-index 2b4159d3044..61f9d991185 100644
---- a/ld/testsuite/ld-x86-64/pr18801a.d
-+++ b/ld/testsuite/ld-x86-64/pr18801a.d
-@@ -1,4 +1,4 @@
- #source: pr18801.s
- #as: --64
--#ld: -melf_x86_64 -pie
-+#ld: -melf_x86_64 -pie -z notext
- #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIE
-diff --git a/ld/testsuite/ld-x86-64/pr18801b.d b/ld/testsuite/ld-x86-64/pr18801b.d
-index 34dab1aa6cb..967a339f90b 100644
---- a/ld/testsuite/ld-x86-64/pr18801b.d
-+++ b/ld/testsuite/ld-x86-64/pr18801b.d
-@@ -1,4 +1,4 @@
- #source: pr18801.s
- #as: --64
--#ld: -melf_x86_64 -shared
-+#ld: -melf_x86_64 -shared -z notext
- #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIC
--- 
-2.41.0
-
-

diff --git a/9999/0009-tests-objcopy-keep-debug.patch b/9999/0009-tests-objcopy-keep-debug.patch
deleted file mode 100644
index dbe2a63..0000000
--- a/9999/0009-tests-objcopy-keep-debug.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=b99a9693430a9f04165b1b868f890b622bb1b46c
-https://sourceware.org/PR30699
-
-From b99a9693430a9f04165b1b868f890b622bb1b46c Mon Sep 17 00:00:00 2001
-From: Nick Clifton <nickc@redhat.com>
-Date: Tue, 1 Aug 2023 14:37:04 +0100
-Subject: [PATCH] Fix "--only-keep-debug for ELF relocatables" binutils test
- for compilers which add .debug_macro sections to object files.
-
-  PR 30699
-  * binutils/testsuite/binutils-all/objcopy.exp (keep_debug_symbols_for_elf_relocatable): Do not add sections containing the string "debug_" to the list of non-debug sections.
---- a/binutils/testsuite/binutils-all/objcopy.exp
-+++ b/binutils/testsuite/binutils-all/objcopy.exp
-@@ -1028,7 +1028,11 @@ proc keep_debug_symbols_for_elf_relocatable { prog flags test } {
- 	    {[^a-zA-Z]+([a-zA-Z0-9_\.]+)[ \t]+([A-Z]+)[ \t]+[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ [0-9]+[ \t]+([A-Z]*)[ \t]+[0-9]+(.*)} \
- 	    $got all name type flag rest] } {
- 	if { $type != "NOTE" && [regexp {[AG]} $flag] } {
--	    lappend non_debug_sections $name
-+	    # PR 30699: Some debug sections can be in a group, so
-+	    # exclude sections whose name includes "debug_"
-+	    if { ! [regexp {debug_} $name] } {
-+		lappend non_debug_sections $name
-+	    }
- 	}
- 	set got $rest
-     }
-@@ -1086,6 +1090,7 @@ switch [copy_setup] {
- 	untested $test5
- 	if [is_elf_format] {
- 	    untested $test6
-+	    untested $test7
- 	}
-     }
-     "3" {
--- 
-2.39.3

diff --git a/9999/0010-tests-pr23169b.patch b/9999/0010-tests-pr23169b.patch
deleted file mode 100644
index 5f75b02..0000000
--- a/9999/0010-tests-pr23169b.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-https://sourceware.org/PR30698
---- a/ld/testsuite/ld-ifunc/ifunc.exp
-+++ b/ld/testsuite/ld-ifunc/ifunc.exp
-@@ -604,7 +604,7 @@ run_cc_link_tests [list \
-     ] \
-     [list \
- 	"Build libpr23169a.so" \
--	"-shared" \
-+	"-shared -Wl,-z,lazy" \
- 	"-fPIC -O2 -g" \
- 	{ pr23169a.c } \
- 	{} \
-@@ -751,7 +751,7 @@ run_ld_link_exec_tests [list \
-     ] \
-     [list \
- 	"Run pr23169b" \
--	"-pie -Wl,--no-as-needed tmpdir/libpr23169a.so" \
-+	"-pie -Wl,--no-as-needed,-z,lazy tmpdir/libpr23169a.so" \
- 	"" \
- 	{ pr23169b.c pr23169c.c } \
- 	"pr23169b" \

diff --git a/9999/0011-tests-gprofng.patch b/9999/0011-tests-gprofng.patch
deleted file mode 100644
index b95afda..0000000
--- a/9999/0011-tests-gprofng.patch
+++ /dev/null
@@ -1,164 +0,0 @@
-https://inbox.sourceware.org/binutils/20230803203339.822435-1-vladimir.mezentsev@oracle.com/
-https://sourceware.org/PR30700
-
-From mboxrd@z Thu Jan  1 00:00:00 1970
-Return-Path: <SRS0=V8/R=DU=oracle.com=vladimir.mezentsev@sourceware.org>
-Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32])
-	by sourceware.org (Postfix) with ESMTPS id 7F83B3858D38
-	for <binutils@sourceware.org>; Thu,  3 Aug 2023 20:33:54 +0000 (GMT)
-DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F83B3858D38
-Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com
-Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com
-Received: from pps.filterd (m0246632.ppops.net [127.0.0.1])
-	by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 373JJDB5001450
-	for <binutils@sourceware.org>; Thu, 3 Aug 2023 20:33:54 GMT
-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc :
- subject : date : message-id : content-transfer-encoding : content-type :
- mime-version; s=corp-2023-03-30;
- bh=aBWH9303Y8NcOBnrwOK3V46ZpHc2uMbEHRXIxE2Mg8U=;
- b=QXr05CxWU/hJ4gUV/hT+wrN4h0vjtTB48pepEU1M7MHli0ttn5Skv54tilAVfVKI/4cd
- 1XlcEgN90YOHmnidsmH50z0NQ4NlFvezd1MYrs2+24ay2kIbeHKrOhDQ/EVJIvNLfpt7
- pdZHkHpNkxl+glRpf9puwFHCFLe5Gqx6sSoz7C28I+5FMDB9/Rc3EQXtovTz90vIYSmO
- A1PsW5C3AJG373lrpoUVxpbcxbOsH1fygEdsB4le8DRv2Pgya2WMWz3T2zL7t2gEtFCZ
- XRbuIv+y4xYE2Q+aOJ4p5uxMbc4z3akRNes4LMwZ5U6NPRpwpOM3WFQw5x5jL6Wr6UXw zA== 
-Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20])
-	by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4tcu2fek-1
-	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
-	for <binutils@sourceware.org>; Thu, 03 Aug 2023 20:33:53 +0000
-Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1])
-	by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 373K58qp003980
-	for <binutils@sourceware.org>; Thu, 3 Aug 2023 20:33:51 GMT
-Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170])
-	by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s856rypc5-1
-	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
-	for <binutils@sourceware.org>; Thu, 03 Aug 2023 20:33:51 +0000
-ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
- b=kZLU5BLuqIUtYWeeq/p3fogSPj1DwGv5PNeVj8xjEepBlQWfzC0ad+4n0znV8bSy0v8FqBxF1sCEZFns3lhzblg1Go5psyG/nJAvlrJ7BZQFBvNmPGwAuX2cxp49Ea7lxFwwhGUmGE1BkxanejSE0fy1gnQqGZzgbiuJfYt6lUnejJOnNTmqxI34DIAaJibRkTj/gD+rLI0k7qwgZGMslll/9ZfKz+Bpzs/oQFGA9ZY9q9xkBVGgRPVIzHHC+9V2Y2vJvbOoHa6njxS0RHCmLL9gXh0kK4rJruYUesbu3T+jOy7Kno/6uqG08NdwBrUIFaPEQUoxVXVOijvXQHr5Zw==
-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
- s=arcselector9901;
- h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
- bh=aBWH9303Y8NcOBnrwOK3V46ZpHc2uMbEHRXIxE2Mg8U=;
- b=ejmYk7X1Z7pY0al9fEFi1vg5hSm/VA0h9l09UExzqmPiotIxFvI639eDwaNWiylM73bCWqtKbbROnZRB3rV1iDj/U2UqBWxfHxB2rGfK5CwLFcX+em4U8F9J1gNZyOAT5HcITq6SUTQ+X2qCh7l/xyQeCp1EEiDqr6Go9U5Fgm8rtFZGEC0LQ8XHKYm33P6FBXJCxpKYv69RPQFkTnZbOf1ZOdhnbOCYBslZIivjDMTsg5nqDZkNF6Hu0CxPPDafAKxoLzBiUSgf8Uf7Eu6hCs6zmDrKqeYvPfv1KqtmivuuTvsoaqks0xCCZko6Nd2GnU1sKTotkumAXfO6Zi5BOQ==
-ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
- smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
- dkim=pass header.d=oracle.com; arc=none
-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
- d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
- h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
- bh=aBWH9303Y8NcOBnrwOK3V46ZpHc2uMbEHRXIxE2Mg8U=;
- b=R6vVOn08a3k+gcCdUObb97WwvDSXIzBkR1ReaZ1dnUqS3ZyElhaRikL5Lyc3Q04w6vKd8PN7h2gkGnwA82Cm+hFEccHGB6blNJNEjOhvFX2Mg6XjMjwPNZ5xQ+rzTiGp2I765cpVdXH7qk0ObwPiTR2WhuXcK/dtWIdU4To6ADk=
-Received: from SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10)
- by SN7PR10MB6473.namprd10.prod.outlook.com (2603:10b6:806:2a0::18) with
- Microsoft SMTP Server (version=TLS1_2,
- cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Thu, 3 Aug
- 2023 20:33:49 +0000
-Received: from SA2PR10MB4636.namprd10.prod.outlook.com
- ([fe80::a15b:c87d:10e3:5765]) by SA2PR10MB4636.namprd10.prod.outlook.com
- ([fe80::a15b:c87d:10e3:5765%7]) with mapi id 15.20.6631.046; Thu, 3 Aug 2023
- 20:33:49 +0000
-From: vladimir.mezentsev@oracle.com
-To: binutils@sourceware.org
-Cc: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
-Subject: [PATCH] gprofng: 30700 tmpdir/gp-collect-app_F test fails
-Date: Thu,  3 Aug 2023 13:33:39 -0700
-Message-Id: <20230803203339.822435-1-vladimir.mezentsev@oracle.com>
-X-Mailer: git-send-email 2.31.1
-Content-Transfer-Encoding: 8bit
-Content-Type: text/plain
-X-ClientProxiedBy: LO6P123CA0031.GBRP123.PROD.OUTLOOK.COM
- (2603:10a6:600:2fe::11) To SA2PR10MB4636.namprd10.prod.outlook.com
- (2603:10b6:806:11e::10)
-MIME-Version: 1.0
-X-MS-PublicTrafficType: Email
-X-MS-TrafficTypeDiagnostic: SA2PR10MB4636:EE_|SN7PR10MB6473:EE_
-X-MS-Office365-Filtering-Correlation-Id: 32d2aa61-d0f0-4bf7-c7e5-08db9460f18b
-X-MS-Exchange-SenderADCheck: 1
-X-MS-Exchange-AntiSpam-Relay: 0
-X-Microsoft-Antispam: BCL:0;
-X-Microsoft-Antispam-Message-Info: 
-	FtlSjDlfJ9H/HjBEUbcrniNfavhoIJJwMeiHr/7PhA98yEcoC1q9zylXvVp7m0JPVj/gnTmS4z69ouHzfKuVWqLENJB9dmRnMv+od0/AsNTwOXFrvlmWYd5TyqhBuIjoG+WuwwuwkVmmUPiKLKfNRwxTpG1gXLDhTN6Psviul8nKELjewe5C+S5mzpY5NhVwJVp4JxnsES3HmWgBTO8OvnLss+/Sr0bLQY4nYfOpHvUtWdRvrqw9S26LGlFE8Z65FJP9STwGKbuGMBerRcHqeCIXIhyGKBwV9H9CdXLn9gOkhlXmjhNzu4x8H4oSCzfo/67bC8JNYZxemIRfHR/MttqTtpBYGCgeTcVeA1rc5U89DUdc3eCf8CSP59iJgpEKWHjEsZlEeb7bcFM1MHgnOnXuWgV3Z9m5hESVpQS3AsXUVQLKvRBYny8REC27NXsUyAZ5/SJ04aJGaSQ9AIUORqw1Kky1OGzYGQocDr4CxduZ1hac+X+8bRiSCjv74qsIe6nb3TtA1AkITgFbX8gH7UOwDwRmS5b6YEARR6BshFys26Xn/ktn/opathwyrZhN
-X-Forefront-Antispam-Report: 
-	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA2PR10MB4636.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(376002)(136003)(396003)(39860400002)(451199021)(66476007)(66556008)(66946007)(2616005)(316002)(4326008)(6916009)(5660300002)(107886003)(41300700001)(186003)(6506007)(8676002)(1076003)(8936002)(86362001)(9686003)(6512007)(6666004)(478600001)(6486002)(38100700002)(2906002)(36756003)(83380400001);DIR:OUT;SFP:1101;
-X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
-X-MS-Exchange-AntiSpam-MessageData-0: 
-	=?us-ascii?Q?2vVQXnKygJyQd+tHtgSFfe014vrOKhj7QtnqPMa5sAkBUzF4FJTFNTsO/pC4?=
- =?us-ascii?Q?gbe82wLSPsQ5xjf3KK41AKConilQU9fCfKMhaBEFVxH33ZS2DURmSf+gjSsJ?=
- =?us-ascii?Q?UAf/zzFrAaUhLIdqP4Tkz6g+0SiqXyTlJOodWIvT3V6JMuKqQA9D1xHbZXF0?=
- =?us-ascii?Q?0py1g7VYW0jYGcVzeCAq2lJsAHran5yjaHNDrR4SmoM4F9uNg2KNGw75ylRd?=
- =?us-ascii?Q?6jbbaGKhUrlHyB9CeTNkvz71c7NH28AuAci6B5fzwuWJkcgNbLOIx41Bq/ZX?=
- =?us-ascii?Q?Zgq4LF5BY80VuzfBGES1sjy2jFmuAsdvjYcBlnJGVcooG7qt9N6Fl/f8HUyu?=
- =?us-ascii?Q?P1rRJB4pgLWC3egtg8vS5Lh4K0KQi0XKs7ks46aVjAiGY/IfHVIzb1L2nD+G?=
- =?us-ascii?Q?RgCwy2Ubx//WcCBiTOQS5yjNxSFt4KZByQp99anrtZfJ8xiE6mghQyusbfWu?=
- =?us-ascii?Q?g1AyKl5aCp8FHXW/vb906djTCM2opRpwR1GmBxXIaMpO/v8j9/eRSQ1R/niB?=
- =?us-ascii?Q?YVZluKsc6R/xTJ2cZNeMJUcQafEYByOAik33U7t5Q9HNMWZ91jiWYsMWKVrj?=
- =?us-ascii?Q?8fibDL3u05AmgiaNeXbYjK7ISPXHOjIRThWj+ILCkdR9Wfmlv5D1svssgxeL?=
- =?us-ascii?Q?EFi3hdvD3shR2mvssmsOGWut6ZWbSEND49EhDnOS1nK6nvGRryfvIc8eAU9K?=
- =?us-ascii?Q?tEujniv2fU6TygAo+5qcav55Dd1ng19ndQFZNMle7b/w9bEA9jXH7mqLpPyd?=
- =?us-ascii?Q?nrNH8S3GeRmb9GCsePQApFOiwgv9gHDa18eSoOTBRlpltPb3HHmPCmaDZLWJ?=
- =?us-ascii?Q?dXB+SI80yXLZCQhiR6u6wHplpH+d5GjZGjFxk3aNFtCb2EhaFq6OHz/f4R34?=
- =?us-ascii?Q?FvutRMk+qKmCJ1/jop1nfn6tM6vFajL0AvOG6XVU9m24DxRAKd8AUDFVM/rO?=
- =?us-ascii?Q?FI1KBQs7oEMN0dSzxl6C4pPmhQx6JXDgZoIN1e42hk2xt4bptYUZAzjKDSxw?=
- =?us-ascii?Q?3CZ9+2dM0MjmLwaQkA9bmdGJNmK+UlBSIa2I+/iJeihktlMtgt0zQk+mUqCd?=
- =?us-ascii?Q?+/IsDmOj9RMecwrIMFUhbUPzCUlns3ZrK9TbBxcqpK5Z1tNOF3lIlcUGnOSw?=
- =?us-ascii?Q?I38m5CXSt4JAMsPpu379MT3JE+oVTrAjgPCOml29osBxGw/mPilKfqSfMJxi?=
- =?us-ascii?Q?8ZesU2hceSc6WFr+kgfbZTDNqQIQKwNPVphs2w566wP8Ae66Gu9qLp6Bk5HQ?=
- =?us-ascii?Q?cwZsfHa00oFB9vgkynYZ+mPu4dG9zV7WftOxsKEl59E/cORj3vQ24ZGMlUHG?=
- =?us-ascii?Q?LB0jLAznZgOQmkUqVmmsqxvtD1/skR3r5CGlJ/K9FN82gYMuVRUT79ppg/r9?=
- =?us-ascii?Q?e1JOgVXvnqlf4s2jYxQw3bi9QlyiFFy7MR9xMNLt7UdOV7+GdtALZXx+uOh3?=
- =?us-ascii?Q?9/9DT7Pt4hWzZuKZc8kZGCrrZRBcpK753R/j7RlyFtGC9glPHkNaV5aQBJ6+?=
- =?us-ascii?Q?Fwkt6CX12BvWW5krg2dy5ZCWkH+MBwS8/PxPbU5Z3bjW40j9fb2tTF8WUFVw?=
- =?us-ascii?Q?NOkA45fBWCbMM84rbOEjN9VJElsbua90fGNcuLYEAxRCve6My1paBT4jV+k5?=
- =?us-ascii?Q?pJraM4gq2jxgfMe/3re6+fc=3D?=
-X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
-X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 
-	5BKKV4T41EwJkqBWXCUBtKfSc0Kqk+2boYpd3LY1KKydGovf7vMEW8cZdK7DpnPReGtLMTe22G8WEdn+eueR59691BC3vrpoNVoYEMczhSi6Rf9TqO5yp8jgE/YufRIst16yC1oF14s88TE0rlftBH2NAVnB/7vKVBrmDa6SSwJyRcGyF1JIB8TKCuUj2m2a/aO9nNBSNZgl1xOBWfPKt3yBwe5hvrsmAQGm8H5Ms2bT4yhwxhA4M6f9bfj2BxBSHvDuCoJx4z7WCMycJJtY37+wT070rAkDGW6u7BTQfSdoup1NNo22gp74EJGxcn0jBDf6A0Oa6mVTe8SBy8SHFkhTwShvYYuj3R6PqqcUV8d0fvtXsNWbCydtFkZSwOugpE1y3RNtvvgtVHLdRSziiPl3CsW0cQEA0aQNdDec9xQV9uYmnQAQvHYQdMB8tGyV0viNsuIae7PaDF4fl0RJsz2Cj2EeuVwQP7txJ7YoU/qLVZLeVL9kk1F7ZCFD4L7tTjxH4/DN/AUWwpMq1U6yAiL6/ByELdB+ttlOTnbtHMN7HuNlJUosjFm59yldZZgz0nM8aiK8uZbcObBcmaHok0j11xKEKl/z3BjVuqKqtOfZs4HmKOCdLSr1cmf1JcnvvCFhjW5XCZySIqechbKUidMlivSQcIPvibERILfG3c+uU26pPEAZLwos3BWiBXFdBaN+nn2bjbrD85QjpnNUg7TF5YJOEXnodgzSvwrp9vD1SiT8sx3g4YD7kKy0E7YO
-X-OriginatorOrg: oracle.com
-X-MS-Exchange-CrossTenant-Network-Message-Id: 32d2aa61-d0f0-4bf7-c7e5-08db9460f18b
-X-MS-Exchange-CrossTenant-AuthSource: SA2PR10MB4636.namprd10.prod.outlook.com
-X-MS-Exchange-CrossTenant-AuthAs: Internal
-X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2023 20:33:49.4380
- (UTC)
-X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
-X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
-X-MS-Exchange-CrossTenant-MailboxType: HOSTED
-X-MS-Exchange-CrossTenant-UserPrincipalName: mt6TZSKYv+lnLPXlQj7hP3NQSiJDZFEbIztaEFvS4u/Ey+jTQS21+Nywl1vdY7TPbl8qS+F2xjqerIF6YU3aJrJY+tEZOUTu7AfUUD4pUl8=
-X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6473
-X-Proofpoint-Virus-Version: vendor=baseguard
- engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26
- definitions=2023-08-03_22,2023-08-03_01,2023-05-22_02
-X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 spamscore=0
- adultscore=0 malwarescore=0 suspectscore=0 mlxscore=0 mlxlogscore=999
- classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000
- definitions=main-2308030184
-X-Proofpoint-GUID: Ai1oZyaQBQimnED3Xzjh2Aq6NHTga79T
-X-Proofpoint-ORIG-GUID: Ai1oZyaQBQimnED3Xzjh2Aq6NHTga79T
-X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
-X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org
-List-Id: <binutils.sourceware.org>
-
-From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
-
-gprofng/ChangeLog
-2023-08-03  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
-
-	PR gprofng/30700
-	* testsuite/gprofng.display/gp-collect-app_F.exp: Fix -name argument
-	for sub-experiment filtering.
---- a/gprofng/testsuite/gprofng.display/gp-collect-app_F.exp
-+++ b/gprofng/testsuite/gprofng.display/gp-collect-app_F.exp
-@@ -46,11 +46,11 @@ proc run_gp_collect_app { subExpCnt F_opt } {
-     return -code break
-   }
- 
--  set output [run_native_host_cmd "find $tdir -name '*x1.er' | wc -l"]
-+  set output [run_native_host_cmd "find $tdir -name '*_x?.er' | wc -l"]
-   set subExp [lindex $output 1]
-   if { $subExp != $subExpCnt } then {
-     set out [lindex $output 1]
--    send_log "Test failed for -F $F_opt. subExp=$subExp. Shold be $subExpCnt\n"
-+    send_log "Test failed for -F $F_opt. subExp=$subExp. Should be $subExpCnt\n"
-     fail $tdir
-     return -code break
-   }
--- 
-2.31.1

diff --git a/9999/0012-lto-type-mismatch.patch b/9999/0012-lto-type-mismatch.patch
deleted file mode 100644
index dbb6958..0000000
--- a/9999/0012-lto-type-mismatch.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=e34acfce343d53290e72c317213a28327bc52fb0
-
-From e34acfce343d53290e72c317213a28327bc52fb0 Mon Sep 17 00:00:00 2001
-From: Tom de Vries <tdevries@suse.de>
-Date: Thu, 3 Aug 2023 09:48:39 +0100
-Subject: [PATCH]  Fix Wlto-type-mismatch in opcodes/ft32-dis.c
-
---- a/opcodes/ft32-dis.c
-+++ b/opcodes/ft32-dis.c
-@@ -27,7 +27,7 @@
- #include "opcode/ft32.h"
- #include "disassemble.h"
- 
--extern const ft32_opc_info_t ft32_opc_info[128];
-+extern const ft32_opc_info_t ft32_opc_info[];
- 
- static fprintf_ftype fpr;
- static void *stream;
--- 
-2.39.3


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-07-30 14:49 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2023-07-30 14:49 UTC (permalink / raw
  To: gentoo-commits

commit:     60851e7be32d7d3014de98b85bd5b58b1ad6fdd3
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 30 14:49:36 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jul 30 14:49:36 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=60851e7b

Add Sam's textrel patch

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...-failures-with-enable-textrel-check-error.patch | 139 +++++++++++++++++++++
 1 file changed, 139 insertions(+)

diff --git a/9999/0008-ld-Fix-test-failures-with-enable-textrel-check-error.patch b/9999/0008-ld-Fix-test-failures-with-enable-textrel-check-error.patch
new file mode 100644
index 0000000..7bf6a47
--- /dev/null
+++ b/9999/0008-ld-Fix-test-failures-with-enable-textrel-check-error.patch
@@ -0,0 +1,139 @@
+From mboxrd@z Thu Jan  1 00:00:00 1970
+Return-Path: <SRS0=Su1r=DO=gentoo.org=sam@sourceware.org>
+Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
+	by sourceware.org (Postfix) with ESMTP id 3725A3858D20
+	for <binutils@sourceware.org>; Fri, 28 Jul 2023 15:20:56 +0000 (GMT)
+DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3725A3858D20
+Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org
+Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org
+From: Sam James <sam@gentoo.org>
+To: binutils@sourceware.org
+Cc: nickc@redhat.com,
+	Sam James <sam@gentoo.org>
+Subject: [PATCH] ld: Fix test failures with --enable-textrel-check=error
+Date: Fri, 28 Jul 2023 16:20:34 +0100
+Message-ID: <20230728152042.401562-1-sam@gentoo.org>
+X-Mailer: git-send-email 2.41.0
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
+X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org
+List-Id: <binutils.sourceware.org>
+
+Tested with the following:
+* --enable-textrel-check=error
+* --enable-warn-execstack=yes
+* --enable-warn-rwx-segments=yes
+* --enable-default-execstack=no
+in preparation for hopefully toggling these in Gentoo Hardened
+at least.
+
+This is similar in nature to 0ab7005043ee404dabfd690952efc25c399995ae
+and 340640f710e690b37c885166949595cde5f827b2.
+
+This fixes the following test failures:
+* FAIL: ld-x86-64/pr18801a
+* FAIL: ld-x86-64/pr18801b
+* FAIL: ld-x86-64/ifunc-textrel-1a
+* FAIL: ld-x86-64/ifunc-textrel-1b
+* FAIL: ld-i386/pr18801a
+* FAIL: ld-i386/pr18801b
+* FAIL: ld-i386/ifunc-textrel-1a
+* FAIL: ld-i386/ifunc-textrel-1b
+
+Signed-off-by: Sam James <sam@gentoo.org>
+---
+ ld/testsuite/ld-i386/ifunc-textrel-1a.d   | 2 +-
+ ld/testsuite/ld-i386/ifunc-textrel-1b.d   | 2 +-
+ ld/testsuite/ld-i386/pr18801a.d           | 2 +-
+ ld/testsuite/ld-i386/pr18801b.d           | 2 +-
+ ld/testsuite/ld-x86-64/ifunc-textrel-1a.d | 2 +-
+ ld/testsuite/ld-x86-64/ifunc-textrel-1b.d | 2 +-
+ ld/testsuite/ld-x86-64/pr18801a.d         | 2 +-
+ ld/testsuite/ld-x86-64/pr18801b.d         | 2 +-
+ 8 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/ld/testsuite/ld-i386/ifunc-textrel-1a.d b/ld/testsuite/ld-i386/ifunc-textrel-1a.d
+index 15f545db03d..aad77e7d230 100644
+--- a/ld/testsuite/ld-i386/ifunc-textrel-1a.d
++++ b/ld/testsuite/ld-i386/ifunc-textrel-1a.d
+@@ -1,4 +1,4 @@
+ #source: ../ld-x86-64/ifunc-textrel-1.s
+ #as: --32
+-#ld: -m elf_i386 -pie
++#ld: -m elf_i386 -pie -z notext
+ #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIE
+diff --git a/ld/testsuite/ld-i386/ifunc-textrel-1b.d b/ld/testsuite/ld-i386/ifunc-textrel-1b.d
+index 6e4a67c48f0..bf0f2ac5df9 100644
+--- a/ld/testsuite/ld-i386/ifunc-textrel-1b.d
++++ b/ld/testsuite/ld-i386/ifunc-textrel-1b.d
+@@ -1,4 +1,4 @@
+ #source: ../ld-x86-64/ifunc-textrel-1.s
+ #as: --32
+-#ld: -m elf_i386 -shared
++#ld: -m elf_i386 -shared -z notext
+ #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIC
+diff --git a/ld/testsuite/ld-i386/pr18801a.d b/ld/testsuite/ld-i386/pr18801a.d
+index 73cb5d17beb..b1ef145a882 100644
+--- a/ld/testsuite/ld-i386/pr18801a.d
++++ b/ld/testsuite/ld-i386/pr18801a.d
+@@ -1,4 +1,4 @@
+ #source: pr18801.s
+ #as: --32
+-#ld: -m elf_i386 -pie
++#ld: -m elf_i386 -pie -z notext
+ #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIE
+diff --git a/ld/testsuite/ld-i386/pr18801b.d b/ld/testsuite/ld-i386/pr18801b.d
+index 0bf7fb729cb..983346ca248 100644
+--- a/ld/testsuite/ld-i386/pr18801b.d
++++ b/ld/testsuite/ld-i386/pr18801b.d
+@@ -1,4 +1,4 @@
+ #source: pr18801.s
+ #as: --32
+-#ld: -m elf_i386 -shared
++#ld: -m elf_i386 -shared -z notext
+ #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIC
+diff --git a/ld/testsuite/ld-x86-64/ifunc-textrel-1a.d b/ld/testsuite/ld-x86-64/ifunc-textrel-1a.d
+index 64a1e7021fd..667366091b9 100644
+--- a/ld/testsuite/ld-x86-64/ifunc-textrel-1a.d
++++ b/ld/testsuite/ld-x86-64/ifunc-textrel-1a.d
+@@ -1,4 +1,4 @@
+ #source: ifunc-textrel-1.s
+ #as: --64 -defsym __x86_64__=1
+-#ld: -m elf_x86_64 -pie
++#ld: -m elf_x86_64 -pie -z notext
+ #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIE
+diff --git a/ld/testsuite/ld-x86-64/ifunc-textrel-1b.d b/ld/testsuite/ld-x86-64/ifunc-textrel-1b.d
+index aeb31fdb3dc..f7b8e02a72c 100644
+--- a/ld/testsuite/ld-x86-64/ifunc-textrel-1b.d
++++ b/ld/testsuite/ld-x86-64/ifunc-textrel-1b.d
+@@ -1,4 +1,4 @@
+ #source: ifunc-textrel-1.s
+ #as: --64 -defsym __x86_64__=1
+-#ld: -m elf_x86_64 -shared
++#ld: -m elf_x86_64 -shared -z notext
+ #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIC
+diff --git a/ld/testsuite/ld-x86-64/pr18801a.d b/ld/testsuite/ld-x86-64/pr18801a.d
+index 2b4159d3044..61f9d991185 100644
+--- a/ld/testsuite/ld-x86-64/pr18801a.d
++++ b/ld/testsuite/ld-x86-64/pr18801a.d
+@@ -1,4 +1,4 @@
+ #source: pr18801.s
+ #as: --64
+-#ld: -melf_x86_64 -pie
++#ld: -melf_x86_64 -pie -z notext
+ #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIE
+diff --git a/ld/testsuite/ld-x86-64/pr18801b.d b/ld/testsuite/ld-x86-64/pr18801b.d
+index 34dab1aa6cb..967a339f90b 100644
+--- a/ld/testsuite/ld-x86-64/pr18801b.d
++++ b/ld/testsuite/ld-x86-64/pr18801b.d
+@@ -1,4 +1,4 @@
+ #source: pr18801.s
+ #as: --64
+-#ld: -melf_x86_64 -shared
++#ld: -melf_x86_64 -shared -z notext
+ #warning: GNU indirect functions with DT_TEXTREL may result in a segfault at runtime; recompile with -fPIC
+-- 
+2.41.0
+
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-07-28 16:23 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2023-07-28 16:23 UTC (permalink / raw
  To: gentoo-commits

commit:     8a47acd3d764114d0fa52bf76e079d6afc0e0c45
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 28 16:23:07 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jul 28 16:23:07 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=8a47acd3

Rebase for upcoming 2.41

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch | 10 +++++-----
 ...2-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch |  4 ++--
 9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch  |  6 +++---
 ...04-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch |  4 ++--
 ...-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch |  4 ++--
 9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch           |  4 ++--
 ...-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch |  6 +++---
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index 716fa9b..a724494 100644
--- a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,4 +1,4 @@
-From 38cf5d1565c113e64a5cdfc9d55d554919bc10d7 Mon Sep 17 00:00:00 2001
+From 930c326fd4f16299f06610cf3ff3ee94b13130e0 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 20 Jul 2021 21:08:31 +0200
 Subject: [PATCH 1/7] Gentoo: gold/ld: add support for poisoned system
@@ -120,7 +120,7 @@ index ad0dc6a106c..d21edaddce7 100644
  #undef EXTRA_SHLIB_EXTENSION
  
 diff --git a/ld/configure b/ld/configure
-index 03b9e46f56d..091d5913ee4 100755
+index 0c32b16241a..549b8d49f5e 100755
 --- a/ld/configure
 +++ b/ld/configure
 @@ -839,6 +839,7 @@ with_lib_path
@@ -247,7 +247,7 @@ index aa8b1aa86eb..b57b0d5c9f5 100644
  
  @c man end
 diff --git a/ld/ldfile.c b/ld/ldfile.c
-index c8a6874978b..6ba20992b66 100644
+index df7c9cbd65e..ed15262e0bc 100644
 --- a/ld/ldfile.c
 +++ b/ld/ldfile.c
 @@ -327,6 +327,26 @@ ldfile_add_library_path (const char *name, bool cmdline)
@@ -292,7 +292,7 @@ index 87cac02141d..d79ec8faa15 100644
    OPTION_POP_STATE,
    OPTION_DISABLE_MULTIPLE_DEFS_ABS,
 diff --git a/ld/ldmain.c b/ld/ldmain.c
-index 25cc89b72f9..9c81fd6f539 100644
+index 06ac2c64fa8..5ec931a0255 100644
 --- a/ld/ldmain.c
 +++ b/ld/ldmain.c
 @@ -325,6 +325,13 @@ main (int argc, char **argv)
@@ -352,5 +352,5 @@ index fe8722313fe..5fd7350efc5 100644
  	  input_flags.pushed = xmemdup (&input_flags,
  					sizeof (input_flags),
 -- 
-2.40.0
+2.41.0
 

diff --git a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index 550f0a1..a0bffea 100644
--- a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,4 +1,4 @@
-From 0486446fa828245f0ac260d170ebe3e7123932c4 Mon Sep 17 00:00:00 2001
+From 68b7e6f60dd42159af779d5b475b7df553655d1f Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
 Subject: [PATCH 2/7] Gentoo: libiberty: install PIC version of libiberty.a
@@ -30,5 +30,5 @@ index f9fbba23e2c..d37488d1bf8 100644
  	else true; fi; \
  	if [ x"$(NOASANFLAG)" != x ]; then \
 -- 
-2.40.0
+2.41.0
 

diff --git a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
index 0597531..3c08be6 100644
--- a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,4 +1,4 @@
-From 36fef3463cc9273249699cf372bf9cb59744df36 Mon Sep 17 00:00:00 2001
+From 3a489acb4547c320ba43858ead3586fed34c92b4 Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Tue, 20 Jul 2021 21:12:38 +0200
 Subject: [PATCH 3/7] Gentoo: add --with-extra-soversion-suffix= option
@@ -79,7 +79,7 @@ index 4edfedee924..70a2442957e 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index 41d280ef461..18e7e3acdbd 100755
+index dcb10317390..94a4e39d691 100755
 --- a/bfd/configure
 +++ b/bfd/configure
 @@ -695,6 +695,7 @@ WARN_CFLAGS
@@ -142,5 +142,5 @@ index f044616f4d9..f22a87f8f54 100644
  ACX_BUGURL([https://sourceware.org/bugzilla/])
  
 -- 
-2.40.0
+2.41.0
 

diff --git a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
index 4242ba8..59c18ef 100644
--- a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
+++ b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
@@ -1,4 +1,4 @@
-From 50af4f7750d537ada9cdb9946804f12e19bb6842 Mon Sep 17 00:00:00 2001
+From eb585240ae3079a2cdc081a2cd96e09db95947ef Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Tue, 20 Jul 2021 21:15:24 +0200
 Subject: [PATCH 4/7] Gentoo: Pass --hash-style=sysv to ld in the testsuite
@@ -57,5 +57,5 @@ index 918464069a9..7d22ee70b27 100644
  
      # We don't care if we get a warning about a non-existent start
 -- 
-2.40.0
+2.41.0
 

diff --git a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
index e5342b3..192fa4f 100644
--- a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
+++ b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
@@ -1,4 +1,4 @@
-From c7ff4b542556d68004ccc30e2da25c56380dcea2 Mon Sep 17 00:00:00 2001
+From 1de1744597aa5b2e29ddedfea42cd7f99796b0ec Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 24 Jul 2021 15:20:16 +0200
 Subject: [PATCH 5/7] Gentoo: Give also libctf optionally a gentoo-specific
@@ -189,5 +189,5 @@ index 6a5eade1855..a0e65a4aeda 100644
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
 -- 
-2.40.0
+2.41.0
 

diff --git a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
index eb2c2b0..210563c 100644
--- a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
+++ b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
@@ -1,4 +1,4 @@
-From 15971356d40e17c2409f729d376237a6d1a980c6 Mon Sep 17 00:00:00 2001
+From 4718611dc4145a8d8de7534f150053c5accf96a1 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 31 Jul 2021 01:18:18 +0200
 Subject: [PATCH 6/7] Gentoo: XFAIL 15 broken ld.gold tests
@@ -73,5 +73,5 @@ index fb0eb12553b..b506a7f8da7 100644
  AUTOMAKE_OPTIONS = foreign -Wno-portability
  
 -- 
-2.40.0
+2.41.0
 

diff --git a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
index 808d877..8d7acd1 100644
--- a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
+++ b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
@@ -1,4 +1,4 @@
-From d76981d4b7bb9bc31825a3ccf5a075ac2694a4c0 Mon Sep 17 00:00:00 2001
+From 7fbdb5f138dccdd3b65a0bd048802662c6302ea1 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Wed, 22 Feb 2023 20:05:35 +0100
 Subject: [PATCH 7/7] Apply a similar libiberty fix as in 7d53105d for
@@ -46,7 +46,7 @@ index b881268b0d9..0e8b707f7d7 100644
  	$(GPROFNG_LIBADD) \
  	-lpthread -ldl
 diff --git a/opcodes/configure b/opcodes/configure
-index 8717d99ca26..fbdf41f87be 100755
+index 71504e10c51..cb669ed994f 100755
 --- a/opcodes/configure
 +++ b/opcodes/configure
 @@ -12445,10 +12445,10 @@ if test "$enable_shared" = "yes"; then
@@ -80,5 +80,5 @@ index 1beb72e87e0..79310916f7d 100644
        ;;
    esac
 -- 
-2.40.0
+2.41.0
 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-06-30  9:21 WANG Xuerui
  0 siblings, 0 replies; 51+ messages in thread
From: WANG Xuerui @ 2023-06-30  9:21 UTC (permalink / raw
  To: gentoo-commits

commit:     73a506ab573568d06b30206258b2d4875b5450fb
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 30 09:19:42 2023 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Fri Jun 30 09:19:50 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=73a506ab

Rebase on top of upstream commit 6637ae9232f0ba44

Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch | 32 ++++++++---------
 ...iberty-install-PIC-version-of-libiberty.a.patch |  6 ++--
 ...oo-add-with-extra-soversion-suffix-option.patch | 20 +++++------
 ...ss-hash-style-sysv-to-ld-in-the-testsuite.patch | 12 +++----
 ...-also-libctf-optionally-a-gentoo-specific.patch | 40 +++++++++++-----------
 ...0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch |  6 ++--
 ...ilar-libiberty-fix-as-in-7d53105d-for-lib.patch | 16 ++++-----
 7 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index c9a15e1..716fa9b 100644
--- a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,7 +1,7 @@
-From febeab1e92e6aaf19a3a67a8729cbe0a444ddf59 Mon Sep 17 00:00:00 2001
+From 38cf5d1565c113e64a5cdfc9d55d554919bc10d7 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 20 Jul 2021 21:08:31 +0200
-Subject: [PATCH 1/6] Gentoo: gold/ld: add support for poisoned system
+Subject: [PATCH 1/7] Gentoo: gold/ld: add support for poisoned system
  directories
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
@@ -88,10 +88,10 @@ index c9834b66159..bd3e948a61b 100644
    if (this->shared() && this->is_static())
      gold_fatal(_("-shared and -static are incompatible"));
 diff --git a/gold/options.h b/gold/options.h
-index 1aa451c7711..524c7c859df 100644
+index 46f658f23ea..8f9b8c177ad 100644
 --- a/gold/options.h
 +++ b/gold/options.h
-@@ -1398,6 +1398,13 @@ class General_options
+@@ -1402,6 +1402,13 @@ class General_options
    DEFINE_bool(warn_multiple_gp, options::TWO_DASHES, '\0', false,
  	      N_("Ignored"), NULL);
  
@@ -200,7 +200,7 @@ index 77edac3258c..a74dac63038 100644
  dnl "install_as_default" is set to false if gold is the default linker.
  dnl "installed_linker" is the installed BFD linker name.
 diff --git a/ld/ld.h b/ld/ld.h
-index 05649ff61b8..ce9e8229ac5 100644
+index a0f8a15c7a9..69420b6673a 100644
 --- a/ld/ld.h
 +++ b/ld/ld.h
 @@ -163,6 +163,13 @@ typedef struct
@@ -218,10 +218,10 @@ index 05649ff61b8..ce9e8229ac5 100644
    enum endian_enum endian;
  
 diff --git a/ld/ld.texi b/ld/ld.texi
-index db3a9f09b45..5b543914e67 100644
+index aa8b1aa86eb..b57b0d5c9f5 100644
 --- a/ld/ld.texi
 +++ b/ld/ld.texi
-@@ -2960,6 +2960,24 @@ creation of the metadata note, if one had been enabled by an earlier
+@@ -3059,6 +3059,24 @@ creation of the metadata note, if one had been enabled by an earlier
  occurrence of the --package-metdata option.
  If the linker has been built with libjansson, then the JSON string
  will be validated.
@@ -247,10 +247,10 @@ index db3a9f09b45..5b543914e67 100644
  
  @c man end
 diff --git a/ld/ldfile.c b/ld/ldfile.c
-index b8fd4e5d8e0..639204f4c29 100644
+index c8a6874978b..6ba20992b66 100644
 --- a/ld/ldfile.c
 +++ b/ld/ldfile.c
-@@ -117,6 +117,26 @@ ldfile_add_library_path (const char *name, bool cmdline)
+@@ -327,6 +327,26 @@ ldfile_add_library_path (const char *name, bool cmdline)
      new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
    else
      new_dirs->name = xstrdup (name);
@@ -278,7 +278,7 @@ index b8fd4e5d8e0..639204f4c29 100644
  
  /* Try to open a BFD for a lang_input_statement.  */
 diff --git a/ld/ldlex.h b/ld/ldlex.h
-index 0538f0a06a1..82685348055 100644
+index 87cac02141d..d79ec8faa15 100644
 --- a/ld/ldlex.h
 +++ b/ld/ldlex.h
 @@ -151,6 +151,9 @@ enum option_values
@@ -292,10 +292,10 @@ index 0538f0a06a1..82685348055 100644
    OPTION_POP_STATE,
    OPTION_DISABLE_MULTIPLE_DEFS_ABS,
 diff --git a/ld/ldmain.c b/ld/ldmain.c
-index 9290a189b0d..da25dbb13b7 100644
+index 25cc89b72f9..9c81fd6f539 100644
 --- a/ld/ldmain.c
 +++ b/ld/ldmain.c
-@@ -321,6 +321,13 @@ main (int argc, char **argv)
+@@ -325,6 +325,13 @@ main (int argc, char **argv)
    command_line.warn_mismatch = true;
    command_line.warn_search_mismatch = true;
    command_line.check_section_addresses = -1;
@@ -310,10 +310,10 @@ index 9290a189b0d..da25dbb13b7 100644
    /* We initialize DEMANGLING based on the environment variable
       COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
 diff --git a/ld/lexsup.c b/ld/lexsup.c
-index c5960385572..950b6969cb8 100644
+index fe8722313fe..5fd7350efc5 100644
 --- a/ld/lexsup.c
 +++ b/ld/lexsup.c
-@@ -584,6 +584,18 @@ static const struct ld_option ld_options[] =
+@@ -594,6 +594,18 @@ static const struct ld_option ld_options[] =
      OPTION_IGNORE_UNRESOLVED_SYMBOL},
      '\0', N_("SYMBOL"),
      N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
@@ -332,7 +332,7 @@ index c5960385572..950b6969cb8 100644
    { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
      '\0', NULL, N_("Push state of flags governing input file handling"),
      TWO_DASHES },
-@@ -1692,6 +1704,18 @@ parse_args (unsigned argc, char **argv)
+@@ -1738,6 +1750,18 @@ parse_args (unsigned argc, char **argv)
  	  }
  	  break;
  
@@ -352,5 +352,5 @@ index c5960385572..950b6969cb8 100644
  	  input_flags.pushed = xmemdup (&input_flags,
  					sizeof (input_flags),
 -- 
-2.38.2
+2.40.0
 

diff --git a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index f5936c6..550f0a1 100644
--- a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,7 +1,7 @@
-From 041fec351bca1ec30fa639ee80c0810a413b2d89 Mon Sep 17 00:00:00 2001
+From 0486446fa828245f0ac260d170ebe3e7123932c4 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
-Subject: [PATCH 2/6] Gentoo: libiberty: install PIC version of libiberty.a
+Subject: [PATCH 2/7] Gentoo: libiberty: install PIC version of libiberty.a
 
 This will install a PIC version of libiberty.a by overwriting the non-PIC
 version of libiberty.a while compiling.  We do this because there is no
@@ -30,5 +30,5 @@ index f9fbba23e2c..d37488d1bf8 100644
  	else true; fi; \
  	if [ x"$(NOASANFLAG)" != x ]; then \
 -- 
-2.38.2
+2.40.0
 

diff --git a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
index 8921582..0597531 100644
--- a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,7 +1,7 @@
-From b1e693934cde0f00e0b2fea50753e0f965bf7f88 Mon Sep 17 00:00:00 2001
+From 36fef3463cc9273249699cf372bf9cb59744df36 Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Tue, 20 Jul 2021 21:12:38 +0200
-Subject: [PATCH 3/6] Gentoo: add --with-extra-soversion-suffix= option
+Subject: [PATCH 3/7] Gentoo: add --with-extra-soversion-suffix= option
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -34,7 +34,7 @@ Ported to binutils 2.37 by Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 29 insertions(+)
 
 diff --git a/bfd/Makefile.am b/bfd/Makefile.am
-index 75d21db88d1..9137f025b87 100644
+index 5c5fdefd3b8..fe26bbf4f0f 100644
 --- a/bfd/Makefile.am
 +++ b/bfd/Makefile.am
 @@ -64,6 +64,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
@@ -46,7 +46,7 @@ index 75d21db88d1..9137f025b87 100644
  # bfd.h goes here, for now
  BFD_H = bfd.h
  
-@@ -994,6 +996,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -976,6 +978,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -57,10 +57,10 @@ index 75d21db88d1..9137f025b87 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/Makefile.in b/bfd/Makefile.in
-index 0b0bb1a950e..0ee27ecc111 100644
+index 4edfedee924..70a2442957e 100644
 --- a/bfd/Makefile.in
 +++ b/bfd/Makefile.in
-@@ -355,6 +355,7 @@ ECHO_T = @ECHO_T@
+@@ -342,6 +342,7 @@ ECHO_T = @ECHO_T@
  EGREP = @EGREP@
  EXEEXT = @EXEEXT@
  EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
@@ -68,7 +68,7 @@ index 0b0bb1a950e..0ee27ecc111 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -2474,6 +2475,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -2435,6 +2436,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -79,7 +79,7 @@ index 0b0bb1a950e..0ee27ecc111 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index 5af8af2ee37..42bd8f32145 100755
+index 41d280ef461..18e7e3acdbd 100755
 --- a/bfd/configure
 +++ b/bfd/configure
 @@ -695,6 +695,7 @@ WARN_CFLAGS
@@ -124,7 +124,7 @@ index 5af8af2ee37..42bd8f32145 100755
  
  # Check whether --with-pkgversion was given.
 diff --git a/bfd/configure.ac b/bfd/configure.ac
-index 82a3d1f832e..2b882c735d4 100644
+index f044616f4d9..f22a87f8f54 100644
 --- a/bfd/configure.ac
 +++ b/bfd/configure.ac
 @@ -168,6 +168,13 @@ AC_ARG_WITH(separate-debug-dir,
@@ -142,5 +142,5 @@ index 82a3d1f832e..2b882c735d4 100644
  ACX_BUGURL([https://sourceware.org/bugzilla/])
  
 -- 
-2.38.2
+2.40.0
 

diff --git a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
index 4411e88..4242ba8 100644
--- a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
+++ b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
@@ -1,7 +1,7 @@
-From c45749c4cc5750db631e16b301133f15adfb94c7 Mon Sep 17 00:00:00 2001
+From 50af4f7750d537ada9cdb9946804f12e19bb6842 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Tue, 20 Jul 2021 21:15:24 +0200
-Subject: [PATCH 4/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
+Subject: [PATCH 4/7] Gentoo: Pass --hash-style=sysv to ld in the testsuite
 
 ---
  binutils/testsuite/lib/binutils-common.exp |  2 +-
@@ -9,10 +9,10 @@ Subject: [PATCH 4/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
  2 files changed, 15 insertions(+), 3 deletions(-)
 
 diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
-index b0190ac51ac..aeef8e55b87 100644
+index 7e6bf16ee6e..0491fff2883 100644
 --- a/binutils/testsuite/lib/binutils-common.exp
 +++ b/binutils/testsuite/lib/binutils-common.exp
-@@ -1308,7 +1308,7 @@ proc run_dump_test { name {extra_options {}} } {
+@@ -1354,7 +1354,7 @@ proc run_dump_test { name {extra_options {}} } {
  
  	    # Add -L$srcdir/$subdir so that the linker command can use
  	    # linker scripts in the source directory.
@@ -22,7 +22,7 @@ index b0190ac51ac..aeef8e55b87 100644
  
  	    # If needed then check for, or add a -Map option.
 diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index 47e86a7b27c..55192a05f35 100644
+index 918464069a9..7d22ee70b27 100644
 --- a/ld/testsuite/lib/ld-lib.exp
 +++ b/ld/testsuite/lib/ld-lib.exp
 @@ -171,7 +171,7 @@ proc default_ld_relocate { ld target objects } {
@@ -57,5 +57,5 @@ index 47e86a7b27c..55192a05f35 100644
  
      # We don't care if we get a warning about a non-existent start
 -- 
-2.38.2
+2.40.0
 

diff --git a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
index 3ac7217..e5342b3 100644
--- a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
+++ b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
@@ -1,7 +1,7 @@
-From ffb569acc3bfa5a22cc6581338108f79fd3d8c55 Mon Sep 17 00:00:00 2001
+From c7ff4b542556d68004ccc30e2da25c56380dcea2 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 24 Jul 2021 15:20:16 +0200
-Subject: [PATCH 5/6] Gentoo: Give also libctf optionally a gentoo-specific
+Subject: [PATCH 5/7] Gentoo: Give also libctf optionally a gentoo-specific
  soversion
 
 ---
@@ -12,7 +12,7 @@ Subject: [PATCH 5/6] Gentoo: Give also libctf optionally a gentoo-specific
  4 files changed, 64 insertions(+), 4 deletions(-)
 
 diff --git a/libctf/Makefile.am b/libctf/Makefile.am
-index c4809f70bae..5571eef8aa1 100644
+index b1dbc2f6ba4..d282ceb619a 100644
 --- a/libctf/Makefile.am
 +++ b/libctf/Makefile.am
 @@ -26,6 +26,9 @@ info_TEXINFOS =
@@ -45,10 +45,10 @@ index c4809f70bae..5571eef8aa1 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
 diff --git a/libctf/Makefile.in b/libctf/Makefile.in
-index f2b852e3fae..14fc79bf5a9 100644
+index 3d2696bcc47..664d6360c47 100644
 --- a/libctf/Makefile.in
 +++ b/libctf/Makefile.in
-@@ -381,6 +381,7 @@ AUTOCONF = @AUTOCONF@
+@@ -380,6 +380,7 @@ AUTOCONF = @AUTOCONF@
  AUTOHEADER = @AUTOHEADER@
  AUTOMAKE = @AUTOMAKE@
  AWK = @AWK@
@@ -56,7 +56,7 @@ index f2b852e3fae..14fc79bf5a9 100644
  CATALOGS = @CATALOGS@
  CATOBJEXT = @CATOBJEXT@
  CC = @CC@
-@@ -403,6 +404,7 @@ EXEEXT = @EXEEXT@
+@@ -402,6 +403,7 @@ EXEEXT = @EXEEXT@
  
  # Setup the testing framework, if you have one
  EXPECT = expect
@@ -80,10 +80,10 @@ index f2b852e3fae..14fc79bf5a9 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
 diff --git a/libctf/configure b/libctf/configure
-index 17463a74cca..b0b5c78a7a6 100755
+index a0e40f49a80..356503f689f 100755
 --- a/libctf/configure
 +++ b/libctf/configure
-@@ -646,6 +646,10 @@ BUILD_INFO_FALSE
+@@ -645,6 +645,10 @@ BUILD_INFO_FALSE
  BUILD_INFO_TRUE
  NEED_CTF_QSORT_R_FALSE
  NEED_CTF_QSORT_R_TRUE
@@ -94,7 +94,7 @@ index 17463a74cca..b0b5c78a7a6 100755
  ENABLE_LIBCTF_HASH_DEBUGGING_FALSE
  ENABLE_LIBCTF_HASH_DEBUGGING_TRUE
  zlibinc
-@@ -807,6 +811,7 @@ enable_maintainer_mode
+@@ -806,6 +810,7 @@ enable_maintainer_mode
  enable_install_libbfd
  with_system_zlib
  enable_libctf_hash_debugging
@@ -102,7 +102,7 @@ index 17463a74cca..b0b5c78a7a6 100755
  '
        ac_precious_vars='build_alias
  host_alias
-@@ -1464,6 +1469,8 @@ Optional Packages:
+@@ -1463,6 +1468,8 @@ Optional Packages:
                            both]
    --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
    --with-system-zlib      use installed libz
@@ -111,25 +111,25 @@ index 17463a74cca..b0b5c78a7a6 100755
  
  Some influential environment variables:
    CC          C compiler command
-@@ -11632,7 +11639,7 @@ else
+@@ -11631,7 +11638,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11635 "configure"
-+#line 11665 "configure"
+-#line 11634 "configure"
++#line 11641 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -11738,7 +11745,7 @@ else
+@@ -11737,7 +11744,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11741 "configure"
-+#line 11771 "configure"
+-#line 11740 "configure"
++#line 11747 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -14305,6 +14312,26 @@ else
+@@ -14304,6 +14311,26 @@ else
  fi
  
  
@@ -156,7 +156,7 @@ index 17463a74cca..b0b5c78a7a6 100755
  # Similar to GDB_AC_CHECK_BFD.
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
-@@ -15199,6 +15226,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
+@@ -15196,6 +15223,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
    as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined.
  Usually this means the macro was only invoked conditionally." "$LINENO" 5
  fi
@@ -168,7 +168,7 @@ index 17463a74cca..b0b5c78a7a6 100755
  if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; then
    as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined.
 diff --git a/libctf/configure.ac b/libctf/configure.ac
-index a0148a4c328..1901ade381d 100644
+index 6a5eade1855..a0e65a4aeda 100644
 --- a/libctf/configure.ac
 +++ b/libctf/configure.ac
 @@ -76,6 +76,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then
@@ -189,5 +189,5 @@ index a0148a4c328..1901ade381d 100644
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
 -- 
-2.38.2
+2.40.0
 

diff --git a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
index 303942b..eb2c2b0 100644
--- a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
+++ b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
@@ -1,7 +1,7 @@
-From a5ae5bca2b691999092655fe0df9b6c22e76ffaa Mon Sep 17 00:00:00 2001
+From 15971356d40e17c2409f729d376237a6d1a980c6 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 31 Jul 2021 01:18:18 +0200
-Subject: [PATCH 6/6] Gentoo: XFAIL 15 broken ld.gold tests
+Subject: [PATCH 6/7] Gentoo: XFAIL 15 broken ld.gold tests
 
 It seems like either the tests or ld.gold in general cannot handle
 compilers built with --enable-default-pie. No fix yet, so let's ignore
@@ -73,5 +73,5 @@ index fb0eb12553b..b506a7f8da7 100644
  AUTOMAKE_OPTIONS = foreign -Wno-portability
  
 -- 
-2.38.2
+2.40.0
 

diff --git a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
index d915528..808d877 100644
--- a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
+++ b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
@@ -1,8 +1,8 @@
-From afc5e9fab399c9164f7355b69d0e23318d0559a5 Mon Sep 17 00:00:00 2001
+From d76981d4b7bb9bc31825a3ccf5a075ac2694a4c0 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Wed, 22 Feb 2023 20:05:35 +0100
-Subject: [PATCH] Apply a similar libiberty fix as in 7d53105d for libopcodes
- and libgprofng
+Subject: [PATCH 7/7] Apply a similar libiberty fix as in 7d53105d for
+ libopcodes and libgprofng
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -18,7 +18,7 @@ Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 8 insertions(+), 6 deletions(-)
 
 diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
-index ab90bb08c5f..96256faf788 100644
+index 219367fb9ce..d9365260e8d 100644
 --- a/gprofng/src/Makefile.am
 +++ b/gprofng/src/Makefile.am
 @@ -131,7 +131,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
@@ -32,10 +32,10 @@ index ab90bb08c5f..96256faf788 100644
  	$(GPROFNG_LIBADD) \
  	-lpthread -ldl
 diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
-index 605fa4f6fd4..f968d8d6e59 100644
+index b881268b0d9..0e8b707f7d7 100644
 --- a/gprofng/src/Makefile.in
 +++ b/gprofng/src/Makefile.in
-@@ -555,7 +555,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
+@@ -552,7 +552,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
  # Pass -lpthread instead of $(PTHREAD_LIBS) due to $(PTHREAD_LIBS) being empty
  # when -nostdlib is passed to libtool.
  # See bug 29364 - libgprofng.so: needs to link against -pthread
@@ -46,7 +46,7 @@ index 605fa4f6fd4..f968d8d6e59 100644
  	$(GPROFNG_LIBADD) \
  	-lpthread -ldl
 diff --git a/opcodes/configure b/opcodes/configure
-index d2364991ee8..1f483e37fc9 100755
+index 8717d99ca26..fbdf41f87be 100755
 --- a/opcodes/configure
 +++ b/opcodes/configure
 @@ -12445,10 +12445,10 @@ if test "$enable_shared" = "yes"; then
@@ -80,5 +80,5 @@ index 1beb72e87e0..79310916f7d 100644
        ;;
    esac
 -- 
-2.39.2
+2.40.0
 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-04-02 11:44 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2023-04-02 11:44 UTC (permalink / raw
  To: gentoo-commits

commit:     b359e23310a3269a6b25f49fa0c962364ece0fc5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  2 11:43:34 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Apr  2 11:43:34 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=b359e233

Apply build fix for libiberty to libopcodes and libgprofng

To be upstreamed properly

Bug: https://bugs.gentoo.org/834720
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...ilar-libiberty-fix-as-in-7d53105d-for-lib.patch | 84 ++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
new file mode 100644
index 0000000..d915528
--- /dev/null
+++ b/9999/0007-Apply-a-similar-libiberty-fix-as-in-7d53105d-for-lib.patch
@@ -0,0 +1,84 @@
+From afc5e9fab399c9164f7355b69d0e23318d0559a5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Wed, 22 Feb 2023 20:05:35 +0100
+Subject: [PATCH] Apply a similar libiberty fix as in 7d53105d for libopcodes
+ and libgprofng
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29042
+Bug: https://bugs.gentoo.org/834720
+Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
+---
+ gprofng/src/Makefile.am | 3 ++-
+ gprofng/src/Makefile.in | 3 ++-
+ opcodes/configure       | 4 ++--
+ opcodes/configure.ac    | 4 ++--
+ 4 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
+index ab90bb08c5f..96256faf788 100644
+--- a/gprofng/src/Makefile.am
++++ b/gprofng/src/Makefile.am
+@@ -131,7 +131,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
+ # Pass -lpthread instead of $(PTHREAD_LIBS) due to $(PTHREAD_LIBS) being empty
+ # when -nostdlib is passed to libtool.
+ # See bug 29364 - libgprofng.so: needs to link against -pthread
+-libgprofng_la_LIBADD = $(top_builddir)/../opcodes/libopcodes.la \
++libgprofng_la_LIBADD = $(GPROFNG_LIBADD) \
++	$(top_builddir)/../opcodes/libopcodes.la \
+ 	$(top_builddir)/../bfd/libbfd.la \
+ 	$(GPROFNG_LIBADD) \
+ 	-lpthread -ldl
+diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
+index 605fa4f6fd4..f968d8d6e59 100644
+--- a/gprofng/src/Makefile.in
++++ b/gprofng/src/Makefile.in
+@@ -555,7 +555,8 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
+ # Pass -lpthread instead of $(PTHREAD_LIBS) due to $(PTHREAD_LIBS) being empty
+ # when -nostdlib is passed to libtool.
+ # See bug 29364 - libgprofng.so: needs to link against -pthread
+-libgprofng_la_LIBADD = $(top_builddir)/../opcodes/libopcodes.la \
++libgprofng_la_LIBADD = $(GPROFNG_LIBADD) \
++	$(top_builddir)/../opcodes/libopcodes.la \
+ 	$(top_builddir)/../bfd/libbfd.la \
+ 	$(GPROFNG_LIBADD) \
+ 	-lpthread -ldl
+diff --git a/opcodes/configure b/opcodes/configure
+index d2364991ee8..1f483e37fc9 100755
+--- a/opcodes/configure
++++ b/opcodes/configure
+@@ -12445,10 +12445,10 @@ if test "$enable_shared" = "yes"; then
+   case "${host}" in
+     *-*-cygwin*)
+       SHARED_LDFLAGS="-no-undefined"
+-      SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty $SHARED_LIBADD"
++      SHARED_LIBADD="$SHARED_LIBADD -L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty $SHARED_LIBADD"
+       ;;
+     *)
+-      SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}"
++      SHARED_LIBADD="${SHARED_LIBADD} ../bfd/libbfd.la ${SHARED_LIBADD}"
+       SHARED_DEPENDENCIES="../bfd/libbfd.la"
+       ;;
+   esac
+diff --git a/opcodes/configure.ac b/opcodes/configure.ac
+index 1beb72e87e0..79310916f7d 100644
+--- a/opcodes/configure.ac
++++ b/opcodes/configure.ac
+@@ -193,10 +193,10 @@ if test "$enable_shared" = "yes"; then
+   case "${host}" in
+     *-*-cygwin*)
+       SHARED_LDFLAGS="-no-undefined"
+-      SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty $SHARED_LIBADD"
++      SHARED_LIBADD="$SHARED_LIBADD -L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty $SHARED_LIBADD"
+       ;;
+     *)
+-      SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}"
++      SHARED_LIBADD="${SHARED_LIBADD} ../bfd/libbfd.la ${SHARED_LIBADD}"
+       SHARED_DEPENDENCIES="../bfd/libbfd.la"
+       ;;
+   esac
+-- 
+2.39.2
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-01-05 16:22 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2023-01-05 16:22 UTC (permalink / raw
  To: gentoo-commits

commit:     39d3e22103c9b44afb5c9b6eba4298a9f3394c9f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  5 16:22:01 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan  5 16:22:01 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=39d3e221

Patch 0008 pushed upstream

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...e-un-xfail-pr19719-tests-on-aarch64-seems.patch | 26 ----------------------
 1 file changed, 26 deletions(-)

diff --git a/9999/0008-ld-testsuite-un-xfail-pr19719-tests-on-aarch64-seems.patch b/9999/0008-ld-testsuite-un-xfail-pr19719-tests-on-aarch64-seems.patch
deleted file mode 100644
index 7168d7e..0000000
--- a/9999/0008-ld-testsuite-un-xfail-pr19719-tests-on-aarch64-seems.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 0564593ab415665b6de8089debf4a0205582d8ef Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Tue, 3 Jan 2023 22:39:24 +0100
-Subject: [PATCH 2/2] ld testsuite: un-xfail pr19719 tests on aarch64, seems to
- succeed now
-
----
- ld/testsuite/ld-elf/shared.exp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
-index 6dd99bb5c9d..db9d71398de 100644
---- a/ld/testsuite/ld-elf/shared.exp
-+++ b/ld/testsuite/ld-elf/shared.exp
-@@ -1656,7 +1656,7 @@ proc mix_pic_and_non_pic {xfails cflags ldflags exe} {
-     }
- }
- 
--mix_pic_and_non_pic [list "arm*-*-*" "aarch64*-*-*"] "" "" "pr19719"
-+mix_pic_and_non_pic [list "arm*-*-*"] "" "" "pr19719"
- mix_pic_and_non_pic [] "-fPIE" "-pie" "pr19719pie"
- 
- set AFLAGS_PIE ""
--- 
-2.38.2
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-01-05 16:21 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2023-01-05 16:21 UTC (permalink / raw
  To: gentoo-commits

commit:     701c5749a5548f5fb002477ad33e9379889a77c4
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  5 16:21:05 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu Jan  5 16:21:05 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=701c5749

Patch 0007 pushed upstream

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...e-relax-regexps-to-make-tests-pass-on-aar.patch | 52 ----------------------
 1 file changed, 52 deletions(-)

diff --git a/9999/0007-ld-testsuite-relax-regexps-to-make-tests-pass-on-aar.patch b/9999/0007-ld-testsuite-relax-regexps-to-make-tests-pass-on-aar.patch
deleted file mode 100644
index d129d85..0000000
--- a/9999/0007-ld-testsuite-relax-regexps-to-make-tests-pass-on-aar.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 80c4388424197f5994fa71646fe81ba77b69d996 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Tue, 3 Jan 2023 22:23:02 +0100
-Subject: [PATCH 1/2] ld testsuite: relax regexps to make tests pass on
- aarch64, bug 29843
-
----
- ld/testsuite/ld-aarch64/bti-plt-5.d              | 8 ++++----
- ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d | 2 +-
- 2 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/ld/testsuite/ld-aarch64/bti-plt-5.d b/ld/testsuite/ld-aarch64/bti-plt-5.d
-index 12abbc2e055..ed0029b8de1 100644
---- a/ld/testsuite/ld-aarch64/bti-plt-5.d
-+++ b/ld/testsuite/ld-aarch64/bti-plt-5.d
-@@ -13,8 +13,8 @@ Disassembly of section \.plt:
- .*:	d503245f 	bti	c
- .*:	a9bf7bf0 	stp	x16, x30, \[sp, #-16\]!
- .*:	90000090 	adrp	x16, 410000 <.*>
--.*:	f9421611 	ldr	x17, \[x16, #1064\]
--.*:	9110a210 	add	x16, x16, #0x428
-+.*:	f9...... 	ldr	x17, \[x16, #....\]
-+.*:	91...... 	add	x16, x16, #0x...
- .*:	d61f0220 	br	x17
- .*:	d503201f 	nop
- .*:	d503201f 	nop
-@@ -22,7 +22,7 @@ Disassembly of section \.plt:
- [0-9a-f]+ <.*>:
- .*:	d503245f 	bti	c
- .*:	90000090 	adrp	x16, 410000 <.*>
--.*:	f9421a11 	ldr	x17, \[x16, #1072\]
--.*:	9110c210 	add	x16, x16, #0x430
-+.*:	f9...... 	ldr	x17, \[x16, #....\]
-+.*:	91...... 	add	x16, x16, #0x...
- .*:	d61f0220 	br	x17
- .*:	d503201f 	nop
-diff --git a/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d b/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d
-index 8b6dceff81b..dcf913428fb 100644
---- a/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d
-+++ b/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d
-@@ -11,7 +11,7 @@
-  0x.+ \(PLTRELSZ\) \s+.+ \(bytes\)
-  0x.+ \(PLTREL\)   \s+RELA
-  0x.+ \(JMPREL\)   \s+0x.+
-- 0x.+ \(BIND_NOW\) \s+
-+ 0x.+ (\(BIND_NOW\) \s+|\(FLAGS\)  \s+   BIND_NOW)
-  0x.+ \(FLAGS_1\)  \s+   Flags: NOW
-  0x.+ \(NULL\)     \s+   0x0
- 
--- 
-2.38.2
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-01-03 23:03 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2023-01-03 23:03 UTC (permalink / raw
  To: gentoo-commits

commit:     c0ada7cf5326b17ffd2a4f8e6e9699f83e8e9b04
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  3 23:02:41 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jan  3 23:02:41 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=c0ada7cf

Fix tests on aarch64 (submitted upstream)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...e-relax-regexps-to-make-tests-pass-on-aar.patch | 52 ++++++++++++++++++++++
 ...e-un-xfail-pr19719-tests-on-aarch64-seems.patch | 26 +++++++++++
 2 files changed, 78 insertions(+)

diff --git a/9999/0007-ld-testsuite-relax-regexps-to-make-tests-pass-on-aar.patch b/9999/0007-ld-testsuite-relax-regexps-to-make-tests-pass-on-aar.patch
new file mode 100644
index 0000000..d129d85
--- /dev/null
+++ b/9999/0007-ld-testsuite-relax-regexps-to-make-tests-pass-on-aar.patch
@@ -0,0 +1,52 @@
+From 80c4388424197f5994fa71646fe81ba77b69d996 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Tue, 3 Jan 2023 22:23:02 +0100
+Subject: [PATCH 1/2] ld testsuite: relax regexps to make tests pass on
+ aarch64, bug 29843
+
+---
+ ld/testsuite/ld-aarch64/bti-plt-5.d              | 8 ++++----
+ ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d | 2 +-
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/ld/testsuite/ld-aarch64/bti-plt-5.d b/ld/testsuite/ld-aarch64/bti-plt-5.d
+index 12abbc2e055..ed0029b8de1 100644
+--- a/ld/testsuite/ld-aarch64/bti-plt-5.d
++++ b/ld/testsuite/ld-aarch64/bti-plt-5.d
+@@ -13,8 +13,8 @@ Disassembly of section \.plt:
+ .*:	d503245f 	bti	c
+ .*:	a9bf7bf0 	stp	x16, x30, \[sp, #-16\]!
+ .*:	90000090 	adrp	x16, 410000 <.*>
+-.*:	f9421611 	ldr	x17, \[x16, #1064\]
+-.*:	9110a210 	add	x16, x16, #0x428
++.*:	f9...... 	ldr	x17, \[x16, #....\]
++.*:	91...... 	add	x16, x16, #0x...
+ .*:	d61f0220 	br	x17
+ .*:	d503201f 	nop
+ .*:	d503201f 	nop
+@@ -22,7 +22,7 @@ Disassembly of section \.plt:
+ [0-9a-f]+ <.*>:
+ .*:	d503245f 	bti	c
+ .*:	90000090 	adrp	x16, 410000 <.*>
+-.*:	f9421a11 	ldr	x17, \[x16, #1072\]
+-.*:	9110c210 	add	x16, x16, #0x430
++.*:	f9...... 	ldr	x17, \[x16, #....\]
++.*:	91...... 	add	x16, x16, #0x...
+ .*:	d61f0220 	br	x17
+ .*:	d503201f 	nop
+diff --git a/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d b/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d
+index 8b6dceff81b..dcf913428fb 100644
+--- a/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d
++++ b/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d
+@@ -11,7 +11,7 @@
+  0x.+ \(PLTRELSZ\) \s+.+ \(bytes\)
+  0x.+ \(PLTREL\)   \s+RELA
+  0x.+ \(JMPREL\)   \s+0x.+
+- 0x.+ \(BIND_NOW\) \s+
++ 0x.+ (\(BIND_NOW\) \s+|\(FLAGS\)  \s+   BIND_NOW)
+  0x.+ \(FLAGS_1\)  \s+   Flags: NOW
+  0x.+ \(NULL\)     \s+   0x0
+ 
+-- 
+2.38.2
+

diff --git a/9999/0008-ld-testsuite-un-xfail-pr19719-tests-on-aarch64-seems.patch b/9999/0008-ld-testsuite-un-xfail-pr19719-tests-on-aarch64-seems.patch
new file mode 100644
index 0000000..7168d7e
--- /dev/null
+++ b/9999/0008-ld-testsuite-un-xfail-pr19719-tests-on-aarch64-seems.patch
@@ -0,0 +1,26 @@
+From 0564593ab415665b6de8089debf4a0205582d8ef Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Tue, 3 Jan 2023 22:39:24 +0100
+Subject: [PATCH 2/2] ld testsuite: un-xfail pr19719 tests on aarch64, seems to
+ succeed now
+
+---
+ ld/testsuite/ld-elf/shared.exp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
+index 6dd99bb5c9d..db9d71398de 100644
+--- a/ld/testsuite/ld-elf/shared.exp
++++ b/ld/testsuite/ld-elf/shared.exp
+@@ -1656,7 +1656,7 @@ proc mix_pic_and_non_pic {xfails cflags ldflags exe} {
+     }
+ }
+ 
+-mix_pic_and_non_pic [list "arm*-*-*" "aarch64*-*-*"] "" "" "pr19719"
++mix_pic_and_non_pic [list "arm*-*-*"] "" "" "pr19719"
+ mix_pic_and_non_pic [] "-fPIE" "-pie" "pr19719pie"
+ 
+ set AFLAGS_PIE ""
+-- 
+2.38.2
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2023-01-02 23:50 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2023-01-02 23:50 UTC (permalink / raw
  To: gentoo-commits

commit:     af2d7885363daa305cf4840cb7fe72e3ada04122
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  2 23:49:51 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jan  2 23:49:51 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=af2d7885

Rebase patches onto master

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch | 52 +++++++++++-----------
 ...iberty-install-PIC-version-of-libiberty.a.patch |  6 +--
 ...oo-add-with-extra-soversion-suffix-option.patch | 16 +++----
 ...ss-hash-style-sysv-to-ld-in-the-testsuite.patch | 10 ++---
 ...-also-libctf-optionally-a-gentoo-specific.patch | 44 +++++++++---------
 ...0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch | 10 ++---
 6 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index 1a03757..c9a15e1 100644
--- a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,4 +1,4 @@
-From eaf58344eafc9b9943a0bd7e9e00130965b10274 Mon Sep 17 00:00:00 2001
+From febeab1e92e6aaf19a3a67a8729cbe0a444ddf59 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 20 Jul 2021 21:08:31 +0200
 Subject: [PATCH 1/6] Gentoo: gold/ld: add support for poisoned system
@@ -44,7 +44,7 @@ Ported to binutils 2.39 by WANG Xuerui <xen0n@gentoo.org>
  11 files changed, 150 insertions(+), 2 deletions(-)
 
 diff --git a/gold/options.cc b/gold/options.cc
-index 04be98a3e39..64439f8af7a 100644
+index c9834b66159..bd3e948a61b 100644
 --- a/gold/options.cc
 +++ b/gold/options.cc
 @@ -1355,6 +1355,39 @@ General_options::finalize()
@@ -88,7 +88,7 @@ index 04be98a3e39..64439f8af7a 100644
    if (this->shared() && this->is_static())
      gold_fatal(_("-shared and -static are incompatible"));
 diff --git a/gold/options.h b/gold/options.h
-index 17236eb9cb9..dad649870bf 100644
+index 1aa451c7711..524c7c859df 100644
 --- a/gold/options.h
 +++ b/gold/options.h
 @@ -1398,6 +1398,13 @@ class General_options
@@ -106,10 +106,10 @@ index 17236eb9cb9..dad649870bf 100644
  	      N_("Warn when skipping an incompatible library"),
  	      N_("Don't warn when skipping an incompatible library"));
 diff --git a/ld/config.in b/ld/config.in
-index 3916740eee4..7e70b0179ea 100644
+index ad0dc6a106c..d21edaddce7 100644
 --- a/ld/config.in
 +++ b/ld/config.in
-@@ -55,6 +55,9 @@
+@@ -58,6 +58,9 @@
     language is requested. */
  #undef ENABLE_NLS
  
@@ -120,10 +120,10 @@ index 3916740eee4..7e70b0179ea 100644
  #undef EXTRA_SHLIB_EXTENSION
  
 diff --git a/ld/configure b/ld/configure
-index 9dd3ed5f1e7..a9a67a8babe 100755
+index 03b9e46f56d..091d5913ee4 100755
 --- a/ld/configure
 +++ b/ld/configure
-@@ -838,6 +838,7 @@ with_lib_path
+@@ -839,6 +839,7 @@ with_lib_path
  enable_targets
  enable_64_bit_bfd
  with_sysroot
@@ -131,7 +131,7 @@ index 9dd3ed5f1e7..a9a67a8babe 100755
  enable_gold
  enable_got
  enable_compressed_debug_sections
-@@ -1519,6 +1520,8 @@ Optional Features:
+@@ -1521,6 +1522,8 @@ Optional Features:
    --enable-checking       enable run-time checks
    --enable-targets        alternative target configurations
    --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
@@ -140,25 +140,25 @@ index 9dd3ed5f1e7..a9a67a8babe 100755
    --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
    --enable-got=<type>     GOT handling scheme (target, single, negative,
                            multigot)
-@@ -11620,7 +11623,7 @@ else
+@@ -11625,7 +11628,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11623 "configure"
+-#line 11628 "configure"
 +#line 11626 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -11726,7 +11729,7 @@ else
+@@ -11731,7 +11734,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11729 "configure"
+-#line 11734 "configure"
 +#line 11732 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -15478,6 +15481,19 @@ fi
+@@ -15483,6 +15486,19 @@ fi
  
  
  
@@ -179,7 +179,7 @@ index 9dd3ed5f1e7..a9a67a8babe 100755
  if test "${enable_gold+set}" = set; then :
    enableval=$enable_gold; case "${enableval}" in
 diff --git a/ld/configure.ac b/ld/configure.ac
-index f1b2f9897f8..1927d79e728 100644
+index 77edac3258c..a74dac63038 100644
 --- a/ld/configure.ac
 +++ b/ld/configure.ac
 @@ -103,6 +103,16 @@ AC_SUBST(use_sysroot)
@@ -200,10 +200,10 @@ index f1b2f9897f8..1927d79e728 100644
  dnl "install_as_default" is set to false if gold is the default linker.
  dnl "installed_linker" is the installed BFD linker name.
 diff --git a/ld/ld.h b/ld/ld.h
-index f3086bf30de..90cf1ca51e5 100644
+index 05649ff61b8..ce9e8229ac5 100644
 --- a/ld/ld.h
 +++ b/ld/ld.h
-@@ -162,6 +162,13 @@ typedef struct
+@@ -163,6 +163,13 @@ typedef struct
       in the linker script.  */
    bool force_group_allocation;
  
@@ -218,10 +218,10 @@ index f3086bf30de..90cf1ca51e5 100644
    enum endian_enum endian;
  
 diff --git a/ld/ld.texi b/ld/ld.texi
-index 9daed2e7e9f..d76b534a456 100644
+index db3a9f09b45..5b543914e67 100644
 --- a/ld/ld.texi
 +++ b/ld/ld.texi
-@@ -2952,6 +2952,24 @@ creation of the metadata note, if one had been enabled by an earlier
+@@ -2960,6 +2960,24 @@ creation of the metadata note, if one had been enabled by an earlier
  occurrence of the --package-metdata option.
  If the linker has been built with libjansson, then the JSON string
  will be validated.
@@ -247,7 +247,7 @@ index 9daed2e7e9f..d76b534a456 100644
  
  @c man end
 diff --git a/ld/ldfile.c b/ld/ldfile.c
-index 731ae5f7aed..6b67e29041b 100644
+index b8fd4e5d8e0..639204f4c29 100644
 --- a/ld/ldfile.c
 +++ b/ld/ldfile.c
 @@ -117,6 +117,26 @@ ldfile_add_library_path (const char *name, bool cmdline)
@@ -278,10 +278,10 @@ index 731ae5f7aed..6b67e29041b 100644
  
  /* Try to open a BFD for a lang_input_statement.  */
 diff --git a/ld/ldlex.h b/ld/ldlex.h
-index 57ade1f754b..b35a6122e09 100644
+index 0538f0a06a1..82685348055 100644
 --- a/ld/ldlex.h
 +++ b/ld/ldlex.h
-@@ -149,6 +149,9 @@ enum option_values
+@@ -151,6 +151,9 @@ enum option_values
    OPTION_PRINT_OUTPUT_FORMAT,
    OPTION_PRINT_SYSROOT,
    OPTION_IGNORE_UNRESOLVED_SYMBOL,
@@ -292,7 +292,7 @@ index 57ade1f754b..b35a6122e09 100644
    OPTION_POP_STATE,
    OPTION_DISABLE_MULTIPLE_DEFS_ABS,
 diff --git a/ld/ldmain.c b/ld/ldmain.c
-index d63002c994a..55364ef5773 100644
+index 9290a189b0d..da25dbb13b7 100644
 --- a/ld/ldmain.c
 +++ b/ld/ldmain.c
 @@ -321,6 +321,13 @@ main (int argc, char **argv)
@@ -310,10 +310,10 @@ index d63002c994a..55364ef5773 100644
    /* We initialize DEMANGLING based on the environment variable
       COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
 diff --git a/ld/lexsup.c b/ld/lexsup.c
-index 299371fb775..02816ebb1b6 100644
+index c5960385572..950b6969cb8 100644
 --- a/ld/lexsup.c
 +++ b/ld/lexsup.c
-@@ -579,6 +579,18 @@ static const struct ld_option ld_options[] =
+@@ -584,6 +584,18 @@ static const struct ld_option ld_options[] =
      OPTION_IGNORE_UNRESOLVED_SYMBOL},
      '\0', N_("SYMBOL"),
      N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
@@ -332,7 +332,7 @@ index 299371fb775..02816ebb1b6 100644
    { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
      '\0', NULL, N_("Push state of flags governing input file handling"),
      TWO_DASHES },
-@@ -1679,6 +1691,18 @@ parse_args (unsigned argc, char **argv)
+@@ -1692,6 +1704,18 @@ parse_args (unsigned argc, char **argv)
  	  }
  	  break;
  
@@ -352,5 +352,5 @@ index 299371fb775..02816ebb1b6 100644
  	  input_flags.pushed = xmemdup (&input_flags,
  					sizeof (input_flags),
 -- 
-2.38.0
+2.38.2
 

diff --git a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index 9a5590e..f5936c6 100644
--- a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,4 +1,4 @@
-From 14210956fa30806c5316ede3db67cac94420bb96 Mon Sep 17 00:00:00 2001
+From 041fec351bca1ec30fa639ee80c0810a413b2d89 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
 Subject: [PATCH 2/6] Gentoo: libiberty: install PIC version of libiberty.a
@@ -18,7 +18,7 @@ general are fairly low, and we'd rather have things work for all of them.
  1 file changed, 1 insertion(+)
 
 diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
-index abef3c4601b..9dfb6b6d2b0 100644
+index f9fbba23e2c..d37488d1bf8 100644
 --- a/libiberty/Makefile.in
 +++ b/libiberty/Makefile.in
 @@ -258,6 +258,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
@@ -30,5 +30,5 @@ index abef3c4601b..9dfb6b6d2b0 100644
  	else true; fi; \
  	if [ x"$(NOASANFLAG)" != x ]; then \
 -- 
-2.38.0
+2.38.2
 

diff --git a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
index 81265e4..8921582 100644
--- a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,4 +1,4 @@
-From 96aa5434285fe8006fd671634fe753cf69451043 Mon Sep 17 00:00:00 2001
+From b1e693934cde0f00e0b2fea50753e0f965bf7f88 Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Tue, 20 Jul 2021 21:12:38 +0200
 Subject: [PATCH 3/6] Gentoo: add --with-extra-soversion-suffix= option
@@ -34,7 +34,7 @@ Ported to binutils 2.37 by Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 29 insertions(+)
 
 diff --git a/bfd/Makefile.am b/bfd/Makefile.am
-index 794d992310d..34b71212d75 100644
+index 75d21db88d1..9137f025b87 100644
 --- a/bfd/Makefile.am
 +++ b/bfd/Makefile.am
 @@ -64,6 +64,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
@@ -46,7 +46,7 @@ index 794d992310d..34b71212d75 100644
  # bfd.h goes here, for now
  BFD_H = bfd.h
  
-@@ -992,6 +994,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -994,6 +996,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -57,7 +57,7 @@ index 794d992310d..34b71212d75 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/Makefile.in b/bfd/Makefile.in
-index bdf12c99cfd..e4c613d7406 100644
+index 0b0bb1a950e..0ee27ecc111 100644
 --- a/bfd/Makefile.in
 +++ b/bfd/Makefile.in
 @@ -355,6 +355,7 @@ ECHO_T = @ECHO_T@
@@ -68,7 +68,7 @@ index bdf12c99cfd..e4c613d7406 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -2471,6 +2472,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -2474,6 +2475,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -79,7 +79,7 @@ index bdf12c99cfd..e4c613d7406 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index b72e885f711..b464614592d 100755
+index 5af8af2ee37..42bd8f32145 100755
 --- a/bfd/configure
 +++ b/bfd/configure
 @@ -695,6 +695,7 @@ WARN_CFLAGS
@@ -124,7 +124,7 @@ index b72e885f711..b464614592d 100755
  
  # Check whether --with-pkgversion was given.
 diff --git a/bfd/configure.ac b/bfd/configure.ac
-index 7a0ad0ffe33..2910cc9121f 100644
+index 82a3d1f832e..2b882c735d4 100644
 --- a/bfd/configure.ac
 +++ b/bfd/configure.ac
 @@ -168,6 +168,13 @@ AC_ARG_WITH(separate-debug-dir,
@@ -142,5 +142,5 @@ index 7a0ad0ffe33..2910cc9121f 100644
  ACX_BUGURL([https://sourceware.org/bugzilla/])
  
 -- 
-2.38.0
+2.38.2
 

diff --git a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
index 484c657..4411e88 100644
--- a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
+++ b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
@@ -1,4 +1,4 @@
-From eeb95d2a0cda143dad4d905429ced8a339c486e3 Mon Sep 17 00:00:00 2001
+From c45749c4cc5750db631e16b301133f15adfb94c7 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Tue, 20 Jul 2021 21:15:24 +0200
 Subject: [PATCH 4/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
@@ -9,10 +9,10 @@ Subject: [PATCH 4/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
  2 files changed, 15 insertions(+), 3 deletions(-)
 
 diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
-index ccc33a827b4..f7aecf7edc2 100644
+index b0190ac51ac..aeef8e55b87 100644
 --- a/binutils/testsuite/lib/binutils-common.exp
 +++ b/binutils/testsuite/lib/binutils-common.exp
-@@ -1310,7 +1310,7 @@ proc run_dump_test { name {extra_options {}} } {
+@@ -1308,7 +1308,7 @@ proc run_dump_test { name {extra_options {}} } {
  
  	    # Add -L$srcdir/$subdir so that the linker command can use
  	    # linker scripts in the source directory.
@@ -22,7 +22,7 @@ index ccc33a827b4..f7aecf7edc2 100644
  
  	    # If needed then check for, or add a -Map option.
 diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index ec27388a72e..fc7292a40a7 100644
+index 47e86a7b27c..55192a05f35 100644
 --- a/ld/testsuite/lib/ld-lib.exp
 +++ b/ld/testsuite/lib/ld-lib.exp
 @@ -171,7 +171,7 @@ proc default_ld_relocate { ld target objects } {
@@ -57,5 +57,5 @@ index ec27388a72e..fc7292a40a7 100644
  
      # We don't care if we get a warning about a non-existent start
 -- 
-2.38.0
+2.38.2
 

diff --git a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
index 2133994..3ac7217 100644
--- a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
+++ b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
@@ -1,4 +1,4 @@
-From ee4de1adb09cbfcad39e544e2f05392b210b550a Mon Sep 17 00:00:00 2001
+From ffb569acc3bfa5a22cc6581338108f79fd3d8c55 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 24 Jul 2021 15:20:16 +0200
 Subject: [PATCH 5/6] Gentoo: Give also libctf optionally a gentoo-specific
@@ -12,7 +12,7 @@ Subject: [PATCH 5/6] Gentoo: Give also libctf optionally a gentoo-specific
  4 files changed, 64 insertions(+), 4 deletions(-)
 
 diff --git a/libctf/Makefile.am b/libctf/Makefile.am
-index 27e90f0ba36..4990a20efa3 100644
+index c4809f70bae..5571eef8aa1 100644
 --- a/libctf/Makefile.am
 +++ b/libctf/Makefile.am
 @@ -26,6 +26,9 @@ info_TEXINFOS =
@@ -45,10 +45,10 @@ index 27e90f0ba36..4990a20efa3 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
 diff --git a/libctf/Makefile.in b/libctf/Makefile.in
-index 036a63fa720..e971f0b31bb 100644
+index f2b852e3fae..14fc79bf5a9 100644
 --- a/libctf/Makefile.in
 +++ b/libctf/Makefile.in
-@@ -383,6 +383,7 @@ AUTOCONF = @AUTOCONF@
+@@ -381,6 +381,7 @@ AUTOCONF = @AUTOCONF@
  AUTOHEADER = @AUTOHEADER@
  AUTOMAKE = @AUTOMAKE@
  AWK = @AWK@
@@ -56,7 +56,7 @@ index 036a63fa720..e971f0b31bb 100644
  CATALOGS = @CATALOGS@
  CATOBJEXT = @CATOBJEXT@
  CC = @CC@
-@@ -405,6 +406,7 @@ EXEEXT = @EXEEXT@
+@@ -403,6 +404,7 @@ EXEEXT = @EXEEXT@
  
  # Setup the testing framework, if you have one
  EXPECT = expect
@@ -64,7 +64,7 @@ index 036a63fa720..e971f0b31bb 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -547,8 +549,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
+@@ -540,8 +542,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
  @INSTALL_LIBBFD_FALSE@include_HEADERS = 
  @INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
  @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
@@ -80,7 +80,7 @@ index 036a63fa720..e971f0b31bb 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
 diff --git a/libctf/configure b/libctf/configure
-index 176b3d6b918..31fe5f72a90 100755
+index 17463a74cca..b0b5c78a7a6 100755
 --- a/libctf/configure
 +++ b/libctf/configure
 @@ -646,6 +646,10 @@ BUILD_INFO_FALSE
@@ -93,43 +93,43 @@ index 176b3d6b918..31fe5f72a90 100755
 +EXTRA_SOVERSION_SUFFIX
  ENABLE_LIBCTF_HASH_DEBUGGING_FALSE
  ENABLE_LIBCTF_HASH_DEBUGGING_TRUE
- ZSTD_LIBS
-@@ -813,6 +817,7 @@ enable_install_libbfd
+ zlibinc
+@@ -807,6 +811,7 @@ enable_maintainer_mode
+ enable_install_libbfd
  with_system_zlib
- with_zstd
  enable_libctf_hash_debugging
 +with_extra_soversion_suffix
  '
        ac_precious_vars='build_alias
  host_alias
-@@ -1477,6 +1482,8 @@ Optional Packages:
+@@ -1464,6 +1469,8 @@ Optional Packages:
+                           both]
+   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
    --with-system-zlib      use installed libz
-   --with-zstd             support zstd compressed debug sections
-                           (default=auto)
 +  --with-extra-soversion-suffix=SUFFIX
 +                          Append '.SUFFIX' to SONAME [[default=]]
  
  Some influential environment variables:
    CC          C compiler command
-@@ -11655,7 +11662,7 @@ else
+@@ -11632,7 +11639,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11658 "configure"
+-#line 11635 "configure"
 +#line 11665 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -11761,7 +11768,7 @@ else
+@@ -11738,7 +11745,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11764 "configure"
+-#line 11741 "configure"
 +#line 11771 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -13209,6 +13216,26 @@ else
+@@ -14305,6 +14312,26 @@ else
  fi
  
  
@@ -156,7 +156,7 @@ index 176b3d6b918..31fe5f72a90 100755
  # Similar to GDB_AC_CHECK_BFD.
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
-@@ -14101,6 +14128,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
+@@ -15199,6 +15226,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
    as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined.
  Usually this means the macro was only invoked conditionally." "$LINENO" 5
  fi
@@ -168,10 +168,10 @@ index 176b3d6b918..31fe5f72a90 100755
  if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; then
    as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined.
 diff --git a/libctf/configure.ac b/libctf/configure.ac
-index 2e2ccf4b624..fbe5f27241b 100644
+index a0148a4c328..1901ade381d 100644
 --- a/libctf/configure.ac
 +++ b/libctf/configure.ac
-@@ -79,6 +79,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then
+@@ -76,6 +76,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then
  fi
  AM_CONDITIONAL(ENABLE_LIBCTF_HASH_DEBUGGING, test "${enable_libctf_hash_debugging}" = yes)
  
@@ -189,5 +189,5 @@ index 2e2ccf4b624..fbe5f27241b 100644
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
 -- 
-2.38.0
+2.38.2
 

diff --git a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
index 23e7576..303942b 100644
--- a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
+++ b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
@@ -1,4 +1,4 @@
-From 85c162be0eea0006c9d73fae243d771f7d0c9756 Mon Sep 17 00:00:00 2001
+From a5ae5bca2b691999092655fe0df9b6c22e76ffaa Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 31 Jul 2021 01:18:18 +0200
 Subject: [PATCH 6/6] Gentoo: XFAIL 15 broken ld.gold tests
@@ -16,7 +16,7 @@ Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27303
  2 files changed, 18 insertions(+), 4 deletions(-)
 
 diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
-index 843fd0d197c..4940119c190 100644
+index df9405c1aac..749921633b2 100644
 --- a/gold/testsuite/Makefile.am
 +++ b/gold/testsuite/Makefile.am
 @@ -1,5 +1,11 @@
@@ -32,7 +32,7 @@ index 843fd0d197c..4940119c190 100644
  # system and the host system are the same.  So these tests will not
  # work when building with a cross-compiler.
 diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
-index 21804df6573..6a4e2b5c5bb 100644
+index fb0eb12553b..b506a7f8da7 100644
 --- a/gold/testsuite/Makefile.in
 +++ b/gold/testsuite/Makefile.in
 @@ -15,10 +15,6 @@
@@ -61,7 +61,7 @@ index 21804df6573..6a4e2b5c5bb 100644
  check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
  	$(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
  	$(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \
-@@ -2757,6 +2761,10 @@ top_srcdir = @top_srcdir@
+@@ -2759,6 +2763,10 @@ top_srcdir = @top_srcdir@
  zlibdir = @zlibdir@
  zlibinc = @zlibinc@
  
@@ -73,5 +73,5 @@ index 21804df6573..6a4e2b5c5bb 100644
  AUTOMAKE_OPTIONS = foreign -Wno-portability
  
 -- 
-2.38.0
+2.38.2
 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2022-10-08 12:15 WANG Xuerui
  0 siblings, 0 replies; 51+ messages in thread
From: WANG Xuerui @ 2022-10-08 12:15 UTC (permalink / raw
  To: gentoo-commits

commit:     0420678a87bef8c743a278e5a7a2d60a23e513cf
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  8 12:14:29 2022 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Sat Oct  8 12:14:29 2022 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=0420678a

Rebase on top of upstream commit 4cbfd0daabd6851

Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch | 42 ++++++++++----------
 ...iberty-install-PIC-version-of-libiberty.a.patch |  4 +-
 ...oo-add-with-extra-soversion-suffix-option.patch | 26 ++++++------
 ...ss-hash-style-sysv-to-ld-in-the-testsuite.patch |  4 +-
 ...-also-libctf-optionally-a-gentoo-specific.patch | 46 +++++++++++-----------
 ...0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch | 10 ++---
 6 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index 8e2e947..1a03757 100644
--- a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,4 +1,4 @@
-From 6ad35e463cbd086b4d4e7bb5aca1da6b73e614c8 Mon Sep 17 00:00:00 2001
+From eaf58344eafc9b9943a0bd7e9e00130965b10274 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 20 Jul 2021 21:08:31 +0200
 Subject: [PATCH 1/6] Gentoo: gold/ld: add support for poisoned system
@@ -88,10 +88,10 @@ index 04be98a3e39..64439f8af7a 100644
    if (this->shared() && this->is_static())
      gold_fatal(_("-shared and -static are incompatible"));
 diff --git a/gold/options.h b/gold/options.h
-index 9509a445e8e..a3d76b294cd 100644
+index 17236eb9cb9..dad649870bf 100644
 --- a/gold/options.h
 +++ b/gold/options.h
-@@ -1394,6 +1394,13 @@ class General_options
+@@ -1398,6 +1398,13 @@ class General_options
    DEFINE_bool(warn_multiple_gp, options::TWO_DASHES, '\0', false,
  	      N_("Ignored"), NULL);
  
@@ -106,7 +106,7 @@ index 9509a445e8e..a3d76b294cd 100644
  	      N_("Warn when skipping an incompatible library"),
  	      N_("Don't warn when skipping an incompatible library"));
 diff --git a/ld/config.in b/ld/config.in
-index 0ccd79d59cd..5e39814bce0 100644
+index 3916740eee4..7e70b0179ea 100644
 --- a/ld/config.in
 +++ b/ld/config.in
 @@ -55,6 +55,9 @@
@@ -120,10 +120,10 @@ index 0ccd79d59cd..5e39814bce0 100644
  #undef EXTRA_SHLIB_EXTENSION
  
 diff --git a/ld/configure b/ld/configure
-index 1c2b64870b1..46b5789c77e 100755
+index 9dd3ed5f1e7..a9a67a8babe 100755
 --- a/ld/configure
 +++ b/ld/configure
-@@ -836,6 +836,7 @@ with_lib_path
+@@ -838,6 +838,7 @@ with_lib_path
  enable_targets
  enable_64_bit_bfd
  with_sysroot
@@ -131,7 +131,7 @@ index 1c2b64870b1..46b5789c77e 100755
  enable_gold
  enable_got
  enable_compressed_debug_sections
-@@ -1514,6 +1515,8 @@ Optional Features:
+@@ -1519,6 +1520,8 @@ Optional Features:
    --enable-checking       enable run-time checks
    --enable-targets        alternative target configurations
    --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
@@ -140,25 +140,25 @@ index 1c2b64870b1..46b5789c77e 100755
    --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
    --enable-got=<type>     GOT handling scheme (target, single, negative,
                            multigot)
-@@ -11491,7 +11494,7 @@ else
+@@ -11620,7 +11623,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11494 "configure"
-+#line 11497 "configure"
+-#line 11623 "configure"
++#line 11626 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -11597,7 +11600,7 @@ else
+@@ -11726,7 +11729,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11600 "configure"
-+#line 11603 "configure"
+-#line 11729 "configure"
++#line 11732 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -15349,6 +15352,19 @@ fi
+@@ -15478,6 +15481,19 @@ fi
  
  
  
@@ -179,10 +179,10 @@ index 1c2b64870b1..46b5789c77e 100755
  if test "${enable_gold+set}" = set; then :
    enableval=$enable_gold; case "${enableval}" in
 diff --git a/ld/configure.ac b/ld/configure.ac
-index eb55904c090..0844c2364c5 100644
+index f1b2f9897f8..1927d79e728 100644
 --- a/ld/configure.ac
 +++ b/ld/configure.ac
-@@ -102,6 +102,16 @@ AC_SUBST(use_sysroot)
+@@ -103,6 +103,16 @@ AC_SUBST(use_sysroot)
  AC_SUBST(TARGET_SYSTEM_ROOT)
  AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
  
@@ -218,10 +218,10 @@ index f3086bf30de..90cf1ca51e5 100644
    enum endian_enum endian;
  
 diff --git a/ld/ld.texi b/ld/ld.texi
-index eabbec8faa9..45f4858526c 100644
+index 9daed2e7e9f..d76b534a456 100644
 --- a/ld/ld.texi
 +++ b/ld/ld.texi
-@@ -2947,6 +2947,24 @@ creation of the metadata note, if one had been enabled by an earlier
+@@ -2952,6 +2952,24 @@ creation of the metadata note, if one had been enabled by an earlier
  occurrence of the --package-metdata option.
  If the linker has been built with libjansson, then the JSON string
  will be validated.
@@ -292,7 +292,7 @@ index 57ade1f754b..b35a6122e09 100644
    OPTION_POP_STATE,
    OPTION_DISABLE_MULTIPLE_DEFS_ABS,
 diff --git a/ld/ldmain.c b/ld/ldmain.c
-index ea72b14a301..706ec9ce26e 100644
+index d63002c994a..55364ef5773 100644
 --- a/ld/ldmain.c
 +++ b/ld/ldmain.c
 @@ -321,6 +321,13 @@ main (int argc, char **argv)
@@ -310,7 +310,7 @@ index ea72b14a301..706ec9ce26e 100644
    /* We initialize DEMANGLING based on the environment variable
       COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
 diff --git a/ld/lexsup.c b/ld/lexsup.c
-index 9225f71b3ce..db5b170bc7c 100644
+index 299371fb775..02816ebb1b6 100644
 --- a/ld/lexsup.c
 +++ b/ld/lexsup.c
 @@ -579,6 +579,18 @@ static const struct ld_option ld_options[] =
@@ -352,5 +352,5 @@ index 9225f71b3ce..db5b170bc7c 100644
  	  input_flags.pushed = xmemdup (&input_flags,
  					sizeof (input_flags),
 -- 
-2.35.1
+2.38.0
 

diff --git a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index 34462cc..9a5590e 100644
--- a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,4 +1,4 @@
-From 4bd606f5945ea94b1ea0db8fba206cfe67959cde Mon Sep 17 00:00:00 2001
+From 14210956fa30806c5316ede3db67cac94420bb96 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
 Subject: [PATCH 2/6] Gentoo: libiberty: install PIC version of libiberty.a
@@ -30,5 +30,5 @@ index abef3c4601b..9dfb6b6d2b0 100644
  	else true; fi; \
  	if [ x"$(NOASANFLAG)" != x ]; then \
 -- 
-2.35.1
+2.38.0
 

diff --git a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
index 9328241..81265e4 100644
--- a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,4 +1,4 @@
-From 2d3d27e6c5ad343a524a117dc02358ad7cb06e0d Mon Sep 17 00:00:00 2001
+From 96aa5434285fe8006fd671634fe753cf69451043 Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Tue, 20 Jul 2021 21:12:38 +0200
 Subject: [PATCH 3/6] Gentoo: add --with-extra-soversion-suffix= option
@@ -34,7 +34,7 @@ Ported to binutils 2.37 by Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 29 insertions(+)
 
 diff --git a/bfd/Makefile.am b/bfd/Makefile.am
-index 670e0598f55..18d6eef60bb 100644
+index 794d992310d..34b71212d75 100644
 --- a/bfd/Makefile.am
 +++ b/bfd/Makefile.am
 @@ -64,6 +64,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
@@ -46,7 +46,7 @@ index 670e0598f55..18d6eef60bb 100644
  # bfd.h goes here, for now
  BFD_H = bfd.h
  
-@@ -983,6 +985,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -992,6 +994,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -57,10 +57,10 @@ index 670e0598f55..18d6eef60bb 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/Makefile.in b/bfd/Makefile.in
-index d3ef4c2524b..56fac1bb94d 100644
+index bdf12c99cfd..e4c613d7406 100644
 --- a/bfd/Makefile.in
 +++ b/bfd/Makefile.in
-@@ -354,6 +354,7 @@ ECHO_T = @ECHO_T@
+@@ -355,6 +355,7 @@ ECHO_T = @ECHO_T@
  EGREP = @EGREP@
  EXEEXT = @EXEEXT@
  EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
@@ -68,7 +68,7 @@ index d3ef4c2524b..56fac1bb94d 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -2453,6 +2454,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -2471,6 +2472,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -79,10 +79,10 @@ index d3ef4c2524b..56fac1bb94d 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index 590986efb61..299f7bb0244 100755
+index b72e885f711..b464614592d 100755
 --- a/bfd/configure
 +++ b/bfd/configure
-@@ -691,6 +691,7 @@ WARN_CFLAGS
+@@ -695,6 +695,7 @@ WARN_CFLAGS
  REPORT_BUGS_TEXI
  REPORT_BUGS_TO
  PKGVERSION
@@ -90,7 +90,7 @@ index 590986efb61..299f7bb0244 100755
  DEBUGDIR
  ENABLE_BFD_64_BIT_FALSE
  ENABLE_BFD_64_BIT_TRUE
-@@ -832,6 +833,7 @@ enable_secureplt
+@@ -836,6 +837,7 @@ enable_secureplt
  enable_separate_code
  enable_leading_mingw64_underscores
  with_separate_debug_dir
@@ -98,7 +98,7 @@ index 590986efb61..299f7bb0244 100755
  with_pkgversion
  with_bugurl
  enable_werror
-@@ -1508,6 +1510,8 @@ Optional Packages:
+@@ -1518,6 +1520,8 @@ Optional Packages:
    --with-separate-debug-dir=DIR
                            Look for global separate debug info in DIR
                            [[default=LIBDIR/debug]]
@@ -107,7 +107,7 @@ index 590986efb61..299f7bb0244 100755
    --with-pkgversion=PKG   Use PKG in the version string in place of "GNU
                            Binutils"
    --with-bugurl=URL       Direct users to URL to report a bug
-@@ -12014,6 +12018,15 @@ fi
+@@ -12033,6 +12037,15 @@ fi
  
  
  
@@ -124,7 +124,7 @@ index 590986efb61..299f7bb0244 100755
  
  # Check whether --with-pkgversion was given.
 diff --git a/bfd/configure.ac b/bfd/configure.ac
-index aad4f3c83a5..e9158315bf1 100644
+index 7a0ad0ffe33..2910cc9121f 100644
 --- a/bfd/configure.ac
 +++ b/bfd/configure.ac
 @@ -168,6 +168,13 @@ AC_ARG_WITH(separate-debug-dir,
@@ -142,5 +142,5 @@ index aad4f3c83a5..e9158315bf1 100644
  ACX_BUGURL([https://sourceware.org/bugzilla/])
  
 -- 
-2.35.1
+2.38.0
 

diff --git a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
index caaf9c7..484c657 100644
--- a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
+++ b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
@@ -1,4 +1,4 @@
-From 19d0d0a3fca319b6a14888ce709a75d9b0765561 Mon Sep 17 00:00:00 2001
+From eeb95d2a0cda143dad4d905429ced8a339c486e3 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Tue, 20 Jul 2021 21:15:24 +0200
 Subject: [PATCH 4/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
@@ -57,5 +57,5 @@ index ec27388a72e..fc7292a40a7 100644
  
      # We don't care if we get a warning about a non-existent start
 -- 
-2.35.1
+2.38.0
 

diff --git a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
index 4788ee0..2133994 100644
--- a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
+++ b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
@@ -1,4 +1,4 @@
-From ebc2d6f6c6d46a7fe77a37612ea0e12dccc467cf Mon Sep 17 00:00:00 2001
+From ee4de1adb09cbfcad39e544e2f05392b210b550a Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 24 Jul 2021 15:20:16 +0200
 Subject: [PATCH 5/6] Gentoo: Give also libctf optionally a gentoo-specific
@@ -45,10 +45,10 @@ index 27e90f0ba36..4990a20efa3 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
 diff --git a/libctf/Makefile.in b/libctf/Makefile.in
-index 1984f50867a..55772ba94b3 100644
+index 036a63fa720..e971f0b31bb 100644
 --- a/libctf/Makefile.in
 +++ b/libctf/Makefile.in
-@@ -381,6 +381,7 @@ AUTOCONF = @AUTOCONF@
+@@ -383,6 +383,7 @@ AUTOCONF = @AUTOCONF@
  AUTOHEADER = @AUTOHEADER@
  AUTOMAKE = @AUTOMAKE@
  AWK = @AWK@
@@ -56,7 +56,7 @@ index 1984f50867a..55772ba94b3 100644
  CATALOGS = @CATALOGS@
  CATOBJEXT = @CATOBJEXT@
  CC = @CC@
-@@ -403,6 +404,7 @@ EXEEXT = @EXEEXT@
+@@ -405,6 +406,7 @@ EXEEXT = @EXEEXT@
  
  # Setup the testing framework, if you have one
  EXPECT = expect
@@ -64,7 +64,7 @@ index 1984f50867a..55772ba94b3 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -540,8 +542,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
+@@ -547,8 +549,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
  @INSTALL_LIBBFD_FALSE@include_HEADERS = 
  @INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
  @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
@@ -80,7 +80,7 @@ index 1984f50867a..55772ba94b3 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
 diff --git a/libctf/configure b/libctf/configure
-index 8704bc215f4..de99d1714d7 100755
+index 176b3d6b918..31fe5f72a90 100755
 --- a/libctf/configure
 +++ b/libctf/configure
 @@ -646,6 +646,10 @@ BUILD_INFO_FALSE
@@ -93,43 +93,43 @@ index 8704bc215f4..de99d1714d7 100755
 +EXTRA_SOVERSION_SUFFIX
  ENABLE_LIBCTF_HASH_DEBUGGING_FALSE
  ENABLE_LIBCTF_HASH_DEBUGGING_TRUE
- zlibinc
-@@ -807,6 +811,7 @@ enable_maintainer_mode
- enable_install_libbfd
+ ZSTD_LIBS
+@@ -813,6 +817,7 @@ enable_install_libbfd
  with_system_zlib
+ with_zstd
  enable_libctf_hash_debugging
 +with_extra_soversion_suffix
  '
        ac_precious_vars='build_alias
  host_alias
-@@ -1464,6 +1469,8 @@ Optional Packages:
-                           both]
-   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+@@ -1477,6 +1482,8 @@ Optional Packages:
    --with-system-zlib      use installed libz
+   --with-zstd             support zstd compressed debug sections
+                           (default=auto)
 +  --with-extra-soversion-suffix=SUFFIX
 +                          Append '.SUFFIX' to SONAME [[default=]]
  
  Some influential environment variables:
    CC          C compiler command
-@@ -11635,7 +11642,7 @@ else
+@@ -11655,7 +11662,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11638 "configure"
-+#line 11645 "configure"
+-#line 11658 "configure"
++#line 11665 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -11741,7 +11748,7 @@ else
+@@ -11761,7 +11768,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11744 "configure"
-+#line 11751 "configure"
+-#line 11764 "configure"
++#line 11771 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -12948,6 +12955,26 @@ else
+@@ -13209,6 +13216,26 @@ else
  fi
  
  
@@ -156,7 +156,7 @@ index 8704bc215f4..de99d1714d7 100755
  # Similar to GDB_AC_CHECK_BFD.
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
-@@ -13840,6 +13867,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
+@@ -14101,6 +14128,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
    as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined.
  Usually this means the macro was only invoked conditionally." "$LINENO" 5
  fi
@@ -168,10 +168,10 @@ index 8704bc215f4..de99d1714d7 100755
  if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; then
    as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined.
 diff --git a/libctf/configure.ac b/libctf/configure.ac
-index 4996edd5b70..103fc8b9d33 100644
+index 2e2ccf4b624..fbe5f27241b 100644
 --- a/libctf/configure.ac
 +++ b/libctf/configure.ac
-@@ -78,6 +78,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then
+@@ -79,6 +79,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then
  fi
  AM_CONDITIONAL(ENABLE_LIBCTF_HASH_DEBUGGING, test "${enable_libctf_hash_debugging}" = yes)
  
@@ -189,5 +189,5 @@ index 4996edd5b70..103fc8b9d33 100644
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
 -- 
-2.35.1
+2.38.0
 

diff --git a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
index 318552c..23e7576 100644
--- a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
+++ b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
@@ -1,4 +1,4 @@
-From 7eefd99e98a9396f0ce2e98e9bd86bfeb53a84dc Mon Sep 17 00:00:00 2001
+From 85c162be0eea0006c9d73fae243d771f7d0c9756 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 31 Jul 2021 01:18:18 +0200
 Subject: [PATCH 6/6] Gentoo: XFAIL 15 broken ld.gold tests
@@ -16,7 +16,7 @@ Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27303
  2 files changed, 18 insertions(+), 4 deletions(-)
 
 diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
-index 38e54818f48..85c94d40660 100644
+index 843fd0d197c..4940119c190 100644
 --- a/gold/testsuite/Makefile.am
 +++ b/gold/testsuite/Makefile.am
 @@ -1,5 +1,11 @@
@@ -32,7 +32,7 @@ index 38e54818f48..85c94d40660 100644
  # system and the host system are the same.  So these tests will not
  # work when building with a cross-compiler.
 diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
-index 7b4b7832d38..765c2b73140 100644
+index 21804df6573..6a4e2b5c5bb 100644
 --- a/gold/testsuite/Makefile.in
 +++ b/gold/testsuite/Makefile.in
 @@ -15,10 +15,6 @@
@@ -61,7 +61,7 @@ index 7b4b7832d38..765c2b73140 100644
  check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
  	$(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
  	$(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \
-@@ -2742,6 +2746,10 @@ top_srcdir = @top_srcdir@
+@@ -2757,6 +2761,10 @@ top_srcdir = @top_srcdir@
  zlibdir = @zlibdir@
  zlibinc = @zlibinc@
  
@@ -73,5 +73,5 @@ index 7b4b7832d38..765c2b73140 100644
  AUTOMAKE_OPTIONS = foreign -Wno-portability
  
 -- 
-2.35.1
+2.38.0
 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2022-07-29  7:55 WANG Xuerui
  0 siblings, 0 replies; 51+ messages in thread
From: WANG Xuerui @ 2022-07-29  7:55 UTC (permalink / raw
  To: gentoo-commits

commit:     2fcd49180d8c27c14b56a5fb9fee3c26e4317dac
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 29 07:54:56 2022 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Fri Jul 29 07:54:56 2022 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=2fcd4918

Update patches for binutils 2.39

Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch | 72 ++++++++++++++--------
 ...iberty-install-PIC-version-of-libiberty.a.patch |  4 +-
 ...oo-add-with-extra-soversion-suffix-option.patch | 30 ++++-----
 ...ss-hash-style-sysv-to-ld-in-the-testsuite.patch | 10 +--
 ...-also-libctf-optionally-a-gentoo-specific.patch | 24 ++++----
 ...0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch |  4 +-
 6 files changed, 82 insertions(+), 62 deletions(-)

diff --git a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index 0dc4cf1..8e2e947 100644
--- a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,4 +1,4 @@
-From 322deede0713506f899ee7f284a7c82ba1ec1cf7 Mon Sep 17 00:00:00 2001
+From 6ad35e463cbd086b4d4e7bb5aca1da6b73e614c8 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 20 Jul 2021 21:08:31 +0200
 Subject: [PATCH 1/6] Gentoo: gold/ld: add support for poisoned system
@@ -27,12 +27,13 @@ TEST=x86_64-cros-linux-gnu-ld throws warnings when using -L/lib (gold & bfd)
 Reviewed-on: https://chromium-review.googlesource.com/272083
 (cherry picked from commit f92dbf35c00ab13cee36f6be8ae5ca46454d9000)
 
-Ported to binutils 2.37 Andreas K. Hütte <dilfridge@gentoo.org>
+Ported to binutils 2.37 by Andreas K. Hüttel <dilfridge@gentoo.org>
+Ported to binutils 2.39 by WANG Xuerui <xen0n@gentoo.org>
 ---
  gold/options.cc | 33 +++++++++++++++++++++++++++++++++
  gold/options.h  |  7 +++++++
  ld/config.in    |  3 +++
- ld/configure    | 14 ++++++++++++++
+ ld/configure    | 20 ++++++++++++++++++--
  ld/configure.ac | 10 ++++++++++
  ld/ld.h         |  7 +++++++
  ld/ld.texi      | 18 ++++++++++++++++++
@@ -40,7 +41,7 @@ Ported to binutils 2.37 Andreas K. Hütte <dilfridge@gentoo.org>
  ld/ldlex.h      |  3 +++
  ld/ldmain.c     |  7 +++++++
  ld/lexsup.c     | 24 ++++++++++++++++++++++++
- 11 files changed, 146 insertions(+)
+ 11 files changed, 150 insertions(+), 2 deletions(-)
 
 diff --git a/gold/options.cc b/gold/options.cc
 index 04be98a3e39..64439f8af7a 100644
@@ -105,10 +106,10 @@ index 9509a445e8e..a3d76b294cd 100644
  	      N_("Warn when skipping an incompatible library"),
  	      N_("Don't warn when skipping an incompatible library"));
 diff --git a/ld/config.in b/ld/config.in
-index 26d55a00d47..ffad464783c 100644
+index 0ccd79d59cd..5e39814bce0 100644
 --- a/ld/config.in
 +++ b/ld/config.in
-@@ -43,6 +43,9 @@
+@@ -55,6 +55,9 @@
     language is requested. */
  #undef ENABLE_NLS
  
@@ -119,10 +120,10 @@ index 26d55a00d47..ffad464783c 100644
  #undef EXTRA_SHLIB_EXTENSION
  
 diff --git a/ld/configure b/ld/configure
-index f5c329c1f12..41ec6ca73ac 100755
+index 1c2b64870b1..46b5789c77e 100755
 --- a/ld/configure
 +++ b/ld/configure
-@@ -831,6 +831,7 @@ with_lib_path
+@@ -836,6 +836,7 @@ with_lib_path
  enable_targets
  enable_64_bit_bfd
  with_sysroot
@@ -130,7 +131,7 @@ index f5c329c1f12..41ec6ca73ac 100755
  enable_gold
  enable_got
  enable_compressed_debug_sections
-@@ -1500,6 +1501,8 @@ Optional Features:
+@@ -1514,6 +1515,8 @@ Optional Features:
    --enable-checking       enable run-time checks
    --enable-targets        alternative target configurations
    --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
@@ -139,8 +140,26 @@ index f5c329c1f12..41ec6ca73ac 100755
    --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
    --enable-got=<type>     GOT handling scheme (target, single, negative,
                            multigot)
-@@ -15333,7 +15336,18 @@ else
- fi
+@@ -11491,7 +11494,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11494 "configure"
++#line 11497 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11597,7 +11600,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11600 "configure"
++#line 11603 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -15349,6 +15352,19 @@ fi
+ 
  
  
 +# Check whether --enable-poison-system-directories was given.
@@ -151,15 +170,16 @@ index f5c329c1f12..41ec6ca73ac 100755
 +fi
 +
 +if test "x${enable_poison_system_directories}" = "xyes"; then
- 
++
 +$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
 +
 +fi
- 
- # Check whether --enable-got was given.
- if test "${enable_got+set}" = set; then :
++
+ # Check whether --enable-gold was given.
+ if test "${enable_gold+set}" = set; then :
+   enableval=$enable_gold; case "${enableval}" in
 diff --git a/ld/configure.ac b/ld/configure.ac
-index 7f4cff079b7..57d1abff870 100644
+index eb55904c090..0844c2364c5 100644
 --- a/ld/configure.ac
 +++ b/ld/configure.ac
 @@ -102,6 +102,16 @@ AC_SUBST(use_sysroot)
@@ -198,13 +218,13 @@ index f3086bf30de..90cf1ca51e5 100644
    enum endian_enum endian;
  
 diff --git a/ld/ld.texi b/ld/ld.texi
-index fc75e9b3625..f7d46117bab 100644
+index eabbec8faa9..45f4858526c 100644
 --- a/ld/ld.texi
 +++ b/ld/ld.texi
-@@ -2892,6 +2892,24 @@ string identifying the original linked file does not change.
- 
- Passing @code{none} for @var{style} disables the setting from any
- @code{--build-id} options earlier on the command line.
+@@ -2947,6 +2947,24 @@ creation of the metadata note, if one had been enabled by an earlier
+ occurrence of the --package-metdata option.
+ If the linker has been built with libjansson, then the JSON string
+ will be validated.
 +
 +@kindex --warn-poison-system-directories
 +@item --warn-poison-system-directories
@@ -258,7 +278,7 @@ index 731ae5f7aed..6b67e29041b 100644
  
  /* Try to open a BFD for a lang_input_statement.  */
 diff --git a/ld/ldlex.h b/ld/ldlex.h
-index bc58fea73cc..cf1b015a420 100644
+index 57ade1f754b..b35a6122e09 100644
 --- a/ld/ldlex.h
 +++ b/ld/ldlex.h
 @@ -149,6 +149,9 @@ enum option_values
@@ -290,10 +310,10 @@ index ea72b14a301..706ec9ce26e 100644
    /* We initialize DEMANGLING based on the environment variable
       COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
 diff --git a/ld/lexsup.c b/ld/lexsup.c
-index 5acc47ed5a0..e78df2daf29 100644
+index 9225f71b3ce..db5b170bc7c 100644
 --- a/ld/lexsup.c
 +++ b/ld/lexsup.c
-@@ -571,6 +571,18 @@ static const struct ld_option ld_options[] =
+@@ -579,6 +579,18 @@ static const struct ld_option ld_options[] =
      OPTION_IGNORE_UNRESOLVED_SYMBOL},
      '\0', N_("SYMBOL"),
      N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
@@ -312,7 +332,7 @@ index 5acc47ed5a0..e78df2daf29 100644
    { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
      '\0', NULL, N_("Push state of flags governing input file handling"),
      TWO_DASHES },
-@@ -1659,6 +1671,18 @@ parse_args (unsigned argc, char **argv)
+@@ -1679,6 +1691,18 @@ parse_args (unsigned argc, char **argv)
  	  }
  	  break;
  
@@ -332,5 +352,5 @@ index 5acc47ed5a0..e78df2daf29 100644
  	  input_flags.pushed = xmemdup (&input_flags,
  					sizeof (input_flags),
 -- 
-2.34.1
+2.35.1
 

diff --git a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index 72b99c0..34462cc 100644
--- a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,4 +1,4 @@
-From 887d52771263fc6b8260b873e104bc57d54b3f5c Mon Sep 17 00:00:00 2001
+From 4bd606f5945ea94b1ea0db8fba206cfe67959cde Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
 Subject: [PATCH 2/6] Gentoo: libiberty: install PIC version of libiberty.a
@@ -30,5 +30,5 @@ index abef3c4601b..9dfb6b6d2b0 100644
  	else true; fi; \
  	if [ x"$(NOASANFLAG)" != x ]; then \
 -- 
-2.34.1
+2.35.1
 

diff --git a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
index b2b0bb5..9328241 100644
--- a/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,4 +1,4 @@
-From 820a68dff1ec2eb3836727ced1b5b74bd31daa28 Mon Sep 17 00:00:00 2001
+From 2d3d27e6c5ad343a524a117dc02358ad7cb06e0d Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Tue, 20 Jul 2021 21:12:38 +0200
 Subject: [PATCH 3/6] Gentoo: add --with-extra-soversion-suffix= option
@@ -25,7 +25,7 @@ built with different flags (see https://bugs.gentoo.org/663690).
 Bug: https://bugs.gentoo.org/666100
 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
 
-Ported to binutils 2.37 Andreas K. Hüttel <dilfridge@gentoo.org>
+Ported to binutils 2.37 by Andreas K. Hüttel <dilfridge@gentoo.org>
 ---
  bfd/Makefile.am  |  5 +++++
  bfd/Makefile.in  |  4 ++++
@@ -34,10 +34,10 @@ Ported to binutils 2.37 Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 29 insertions(+)
 
 diff --git a/bfd/Makefile.am b/bfd/Makefile.am
-index 10dd765bec8..e3d97adfbb3 100644
+index 670e0598f55..18d6eef60bb 100644
 --- a/bfd/Makefile.am
 +++ b/bfd/Makefile.am
-@@ -59,6 +59,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
+@@ -64,6 +64,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
  LIBDL = @lt_cv_dlopen_libs@
  endif
  
@@ -46,7 +46,7 @@ index 10dd765bec8..e3d97adfbb3 100644
  # bfd.h goes here, for now
  BFD_H = bfd.h
  
-@@ -987,6 +989,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -983,6 +985,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -57,10 +57,10 @@ index 10dd765bec8..e3d97adfbb3 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/Makefile.in b/bfd/Makefile.in
-index f5313a2ad6f..c8cfc0474f2 100644
+index d3ef4c2524b..56fac1bb94d 100644
 --- a/bfd/Makefile.in
 +++ b/bfd/Makefile.in
-@@ -319,6 +319,7 @@ ECHO_T = @ECHO_T@
+@@ -354,6 +354,7 @@ ECHO_T = @ECHO_T@
  EGREP = @EGREP@
  EXEEXT = @EXEEXT@
  EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
@@ -68,7 +68,7 @@ index f5313a2ad6f..c8cfc0474f2 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -2104,6 +2105,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -2453,6 +2454,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -79,10 +79,10 @@ index f5313a2ad6f..c8cfc0474f2 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index b09702f26e1..7a7c1229c99 100755
+index 590986efb61..299f7bb0244 100755
 --- a/bfd/configure
 +++ b/bfd/configure
-@@ -696,6 +696,7 @@ WARN_CFLAGS
+@@ -691,6 +691,7 @@ WARN_CFLAGS
  REPORT_BUGS_TEXI
  REPORT_BUGS_TO
  PKGVERSION
@@ -90,7 +90,7 @@ index b09702f26e1..7a7c1229c99 100755
  DEBUGDIR
  ENABLE_BFD_64_BIT_FALSE
  ENABLE_BFD_64_BIT_TRUE
-@@ -837,6 +838,7 @@ enable_secureplt
+@@ -832,6 +833,7 @@ enable_secureplt
  enable_separate_code
  enable_leading_mingw64_underscores
  with_separate_debug_dir
@@ -98,7 +98,7 @@ index b09702f26e1..7a7c1229c99 100755
  with_pkgversion
  with_bugurl
  enable_werror
-@@ -1513,6 +1515,8 @@ Optional Packages:
+@@ -1508,6 +1510,8 @@ Optional Packages:
    --with-separate-debug-dir=DIR
                            Look for global separate debug info in DIR
                            [[default=LIBDIR/debug]]
@@ -107,7 +107,7 @@ index b09702f26e1..7a7c1229c99 100755
    --with-pkgversion=PKG   Use PKG in the version string in place of "GNU
                            Binutils"
    --with-bugurl=URL       Direct users to URL to report a bug
-@@ -12013,6 +12017,15 @@ fi
+@@ -12014,6 +12018,15 @@ fi
  
  
  
@@ -124,7 +124,7 @@ index b09702f26e1..7a7c1229c99 100755
  
  # Check whether --with-pkgversion was given.
 diff --git a/bfd/configure.ac b/bfd/configure.ac
-index a9078965c40..3406c071fe7 100644
+index aad4f3c83a5..e9158315bf1 100644
 --- a/bfd/configure.ac
 +++ b/bfd/configure.ac
 @@ -168,6 +168,13 @@ AC_ARG_WITH(separate-debug-dir,
@@ -142,5 +142,5 @@ index a9078965c40..3406c071fe7 100644
  ACX_BUGURL([https://sourceware.org/bugzilla/])
  
 -- 
-2.34.1
+2.35.1
 

diff --git a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
index 2ac5053..caaf9c7 100644
--- a/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
+++ b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
@@ -1,4 +1,4 @@
-From 6e5bb8fa8e5f409e12098a922de72f6bdcc99603 Mon Sep 17 00:00:00 2001
+From 19d0d0a3fca319b6a14888ce709a75d9b0765561 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Tue, 20 Jul 2021 21:15:24 +0200
 Subject: [PATCH 4/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
@@ -9,10 +9,10 @@ Subject: [PATCH 4/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
  2 files changed, 15 insertions(+), 3 deletions(-)
 
 diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
-index 93603b0be68..83ae1307f2a 100644
+index ccc33a827b4..f7aecf7edc2 100644
 --- a/binutils/testsuite/lib/binutils-common.exp
 +++ b/binutils/testsuite/lib/binutils-common.exp
-@@ -1303,7 +1303,7 @@ proc run_dump_test { name {extra_options {}} } {
+@@ -1310,7 +1310,7 @@ proc run_dump_test { name {extra_options {}} } {
  
  	    # Add -L$srcdir/$subdir so that the linker command can use
  	    # linker scripts in the source directory.
@@ -22,7 +22,7 @@ index 93603b0be68..83ae1307f2a 100644
  
  	    # If needed then check for, or add a -Map option.
 diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index 5c7771f7221..ff9ee6a425c 100644
+index ec27388a72e..fc7292a40a7 100644
 --- a/ld/testsuite/lib/ld-lib.exp
 +++ b/ld/testsuite/lib/ld-lib.exp
 @@ -171,7 +171,7 @@ proc default_ld_relocate { ld target objects } {
@@ -57,5 +57,5 @@ index 5c7771f7221..ff9ee6a425c 100644
  
      # We don't care if we get a warning about a non-existent start
 -- 
-2.34.1
+2.35.1
 

diff --git a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
index 871812a..4788ee0 100644
--- a/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
+++ b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
@@ -1,4 +1,4 @@
-From f4db43e58d2f3a6e66b15ff2b25ac6850199399b Mon Sep 17 00:00:00 2001
+From ebc2d6f6c6d46a7fe77a37612ea0e12dccc467cf Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 24 Jul 2021 15:20:16 +0200
 Subject: [PATCH 5/6] Gentoo: Give also libctf optionally a gentoo-specific
@@ -45,7 +45,7 @@ index 27e90f0ba36..4990a20efa3 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
 diff --git a/libctf/Makefile.in b/libctf/Makefile.in
-index 3b5ab73324e..10029107a05 100644
+index 1984f50867a..55772ba94b3 100644
 --- a/libctf/Makefile.in
 +++ b/libctf/Makefile.in
 @@ -381,6 +381,7 @@ AUTOCONF = @AUTOCONF@
@@ -80,7 +80,7 @@ index 3b5ab73324e..10029107a05 100644
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
 diff --git a/libctf/configure b/libctf/configure
-index c56ac218213..623e71477b3 100755
+index 8704bc215f4..de99d1714d7 100755
 --- a/libctf/configure
 +++ b/libctf/configure
 @@ -646,6 +646,10 @@ BUILD_INFO_FALSE
@@ -111,25 +111,25 @@ index c56ac218213..623e71477b3 100755
  
  Some influential environment variables:
    CC          C compiler command
-@@ -11629,7 +11636,7 @@ else
+@@ -11635,7 +11642,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11632 "configure"
-+#line 11639 "configure"
+-#line 11638 "configure"
++#line 11645 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -11735,7 +11742,7 @@ else
+@@ -11741,7 +11748,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11738 "configure"
-+#line 11745 "configure"
+-#line 11744 "configure"
++#line 11751 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -12942,6 +12949,26 @@ else
+@@ -12948,6 +12955,26 @@ else
  fi
  
  
@@ -156,7 +156,7 @@ index c56ac218213..623e71477b3 100755
  # Similar to GDB_AC_CHECK_BFD.
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
-@@ -13834,6 +13861,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
+@@ -13840,6 +13867,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
    as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined.
  Usually this means the macro was only invoked conditionally." "$LINENO" 5
  fi
@@ -189,5 +189,5 @@ index 4996edd5b70..103fc8b9d33 100644
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
 -- 
-2.34.1
+2.35.1
 

diff --git a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
index b9435e9..318552c 100644
--- a/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
+++ b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
@@ -1,4 +1,4 @@
-From 66686e75515c742e573d25b74ce324e3d1acad08 Mon Sep 17 00:00:00 2001
+From 7eefd99e98a9396f0ce2e98e9bd86bfeb53a84dc Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 31 Jul 2021 01:18:18 +0200
 Subject: [PATCH 6/6] Gentoo: XFAIL 15 broken ld.gold tests
@@ -73,5 +73,5 @@ index 7b4b7832d38..765c2b73140 100644
  AUTOMAKE_OPTIONS = foreign -Wno-portability
  
 -- 
-2.34.1
+2.35.1
 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2022-01-15 22:27 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2022-01-15 22:27 UTC (permalink / raw
  To: gentoo-commits

commit:     09d59da43630e66d4f7ae7145e121d06c81a2fdc
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 15 22:19:42 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jan 15 22:26:47 2022 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=09d59da4

Update patches for binutils 2.38

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch |  42 ++++----
 ...iberty-install-PIC-version-of-libiberty.a.patch |   8 +-
 ...o-add-with-extra-soversion-suffix-option.patch} |  34 +++----
 ...des-link-against-libbfd.la-for-rpath-deps.patch |  49 ---------
 ...s-hash-style-sysv-to-ld-in-the-testsuite.patch} |  16 +--
 ...also-libctf-optionally-a-gentoo-specific.patch} |  94 +++++++++--------
 ...006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch} |   6 +-
 ...-soversion-suffix-then-we-also-use-the-bd.patch | 111 ---------------------
 8 files changed, 108 insertions(+), 252 deletions(-)

diff --git a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index f7443bf..0dc4cf1 100644
--- a/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0001-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,7 +1,7 @@
-From 8a82f64de912f26e840b20eec9d8a463fd0e242b Mon Sep 17 00:00:00 2001
+From 322deede0713506f899ee7f284a7c82ba1ec1cf7 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 20 Jul 2021 21:08:31 +0200
-Subject: [PATCH 1/6] Gentoo: gold/ld: add support for poisoned system 
+Subject: [PATCH 1/6] Gentoo: gold/ld: add support for poisoned system
  directories
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
@@ -43,7 +43,7 @@ Ported to binutils 2.37 Andreas K. Hütte <dilfridge@gentoo.org>
  11 files changed, 146 insertions(+)
 
 diff --git a/gold/options.cc b/gold/options.cc
-index 5a55bd8ba6d..f7940c75f5a 100644
+index 04be98a3e39..64439f8af7a 100644
 --- a/gold/options.cc
 +++ b/gold/options.cc
 @@ -1355,6 +1355,39 @@ General_options::finalize()
@@ -87,7 +87,7 @@ index 5a55bd8ba6d..f7940c75f5a 100644
    if (this->shared() && this->is_static())
      gold_fatal(_("-shared and -static are incompatible"));
 diff --git a/gold/options.h b/gold/options.h
-index 757ebf18fec..490b4cbd7d4 100644
+index 9509a445e8e..a3d76b294cd 100644
 --- a/gold/options.h
 +++ b/gold/options.h
 @@ -1394,6 +1394,13 @@ class General_options
@@ -119,10 +119,10 @@ index 26d55a00d47..ffad464783c 100644
  #undef EXTRA_SHLIB_EXTENSION
  
 diff --git a/ld/configure b/ld/configure
-index c197aaef3cb..882263aa43f 100755
+index f5c329c1f12..41ec6ca73ac 100755
 --- a/ld/configure
 +++ b/ld/configure
-@@ -829,6 +829,7 @@ with_lib_path
+@@ -831,6 +831,7 @@ with_lib_path
  enable_targets
  enable_64_bit_bfd
  with_sysroot
@@ -130,7 +130,7 @@ index c197aaef3cb..882263aa43f 100755
  enable_gold
  enable_got
  enable_compressed_debug_sections
-@@ -1498,6 +1499,8 @@ Optional Features:
+@@ -1500,6 +1501,8 @@ Optional Features:
    --enable-checking       enable run-time checks
    --enable-targets        alternative target configurations
    --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
@@ -139,7 +139,7 @@ index c197aaef3cb..882263aa43f 100755
    --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
    --enable-got=<type>     GOT handling scheme (target, single, negative,
                            multigot)
-@@ -15236,7 +15239,18 @@ else
+@@ -15333,7 +15336,18 @@ else
  fi
  
  
@@ -159,10 +159,10 @@ index c197aaef3cb..882263aa43f 100755
  # Check whether --enable-got was given.
  if test "${enable_got+set}" = set; then :
 diff --git a/ld/configure.ac b/ld/configure.ac
-index 8ea97c43cd4..0f246db67d8 100644
+index 7f4cff079b7..57d1abff870 100644
 --- a/ld/configure.ac
 +++ b/ld/configure.ac
-@@ -106,6 +106,16 @@ AC_SUBST(use_sysroot)
+@@ -102,6 +102,16 @@ AC_SUBST(use_sysroot)
  AC_SUBST(TARGET_SYSTEM_ROOT)
  AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
  
@@ -180,7 +180,7 @@ index 8ea97c43cd4..0f246db67d8 100644
  dnl "install_as_default" is set to false if gold is the default linker.
  dnl "installed_linker" is the installed BFD linker name.
 diff --git a/ld/ld.h b/ld/ld.h
-index 35fafebfaed..4152278b8f4 100644
+index f3086bf30de..90cf1ca51e5 100644
 --- a/ld/ld.h
 +++ b/ld/ld.h
 @@ -162,6 +162,13 @@ typedef struct
@@ -198,10 +198,10 @@ index 35fafebfaed..4152278b8f4 100644
    enum endian_enum endian;
  
 diff --git a/ld/ld.texi b/ld/ld.texi
-index dd8f571d4e4..0aee4a4e9f1 100644
+index fc75e9b3625..f7d46117bab 100644
 --- a/ld/ld.texi
 +++ b/ld/ld.texi
-@@ -2863,6 +2863,24 @@ string identifying the original linked file does not change.
+@@ -2892,6 +2892,24 @@ string identifying the original linked file does not change.
  
  Passing @code{none} for @var{style} disables the setting from any
  @code{--build-id} options earlier on the command line.
@@ -227,7 +227,7 @@ index dd8f571d4e4..0aee4a4e9f1 100644
  
  @c man end
 diff --git a/ld/ldfile.c b/ld/ldfile.c
-index 9d0af06f1f6..f4a83acca93 100644
+index 731ae5f7aed..6b67e29041b 100644
 --- a/ld/ldfile.c
 +++ b/ld/ldfile.c
 @@ -117,6 +117,26 @@ ldfile_add_library_path (const char *name, bool cmdline)
@@ -258,10 +258,10 @@ index 9d0af06f1f6..f4a83acca93 100644
  
  /* Try to open a BFD for a lang_input_statement.  */
 diff --git a/ld/ldlex.h b/ld/ldlex.h
-index 9e8bf5fb835..3baed822a22 100644
+index bc58fea73cc..cf1b015a420 100644
 --- a/ld/ldlex.h
 +++ b/ld/ldlex.h
-@@ -148,6 +148,9 @@ enum option_values
+@@ -149,6 +149,9 @@ enum option_values
    OPTION_PRINT_OUTPUT_FORMAT,
    OPTION_PRINT_SYSROOT,
    OPTION_IGNORE_UNRESOLVED_SYMBOL,
@@ -272,7 +272,7 @@ index 9e8bf5fb835..3baed822a22 100644
    OPTION_POP_STATE,
    OPTION_DISABLE_MULTIPLE_DEFS_ABS,
 diff --git a/ld/ldmain.c b/ld/ldmain.c
-index 42660eb9a3c..c78009b760c 100644
+index ea72b14a301..706ec9ce26e 100644
 --- a/ld/ldmain.c
 +++ b/ld/ldmain.c
 @@ -321,6 +321,13 @@ main (int argc, char **argv)
@@ -290,10 +290,10 @@ index 42660eb9a3c..c78009b760c 100644
    /* We initialize DEMANGLING based on the environment variable
       COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
 diff --git a/ld/lexsup.c b/ld/lexsup.c
-index 00274c500d0..a19cce9967c 100644
+index 5acc47ed5a0..e78df2daf29 100644
 --- a/ld/lexsup.c
 +++ b/ld/lexsup.c
-@@ -566,6 +566,18 @@ static const struct ld_option ld_options[] =
+@@ -571,6 +571,18 @@ static const struct ld_option ld_options[] =
      OPTION_IGNORE_UNRESOLVED_SYMBOL},
      '\0', N_("SYMBOL"),
      N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
@@ -312,7 +312,7 @@ index 00274c500d0..a19cce9967c 100644
    { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
      '\0', NULL, N_("Push state of flags governing input file handling"),
      TWO_DASHES },
-@@ -1643,6 +1655,18 @@ parse_args (unsigned argc, char **argv)
+@@ -1659,6 +1671,18 @@ parse_args (unsigned argc, char **argv)
  	  }
  	  break;
  
@@ -332,5 +332,5 @@ index 00274c500d0..a19cce9967c 100644
  	  input_flags.pushed = xmemdup (&input_flags,
  					sizeof (input_flags),
 -- 
-2.31.1
+2.34.1
 

diff --git a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index 4d5ed11..72b99c0 100644
--- a/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0002-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,4 +1,4 @@
-From 6536761c1e2756ec39fdc33c400757be3744510c Mon Sep 17 00:00:00 2001
+From 887d52771263fc6b8260b873e104bc57d54b3f5c Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
 Subject: [PATCH 2/6] Gentoo: libiberty: install PIC version of libiberty.a
@@ -18,10 +18,10 @@ general are fairly low, and we'd rather have things work for all of them.
  1 file changed, 1 insertion(+)
 
 diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
-index d19e14a2aca..cd02be1c2fb 100644
+index abef3c4601b..9dfb6b6d2b0 100644
 --- a/libiberty/Makefile.in
 +++ b/libiberty/Makefile.in
-@@ -257,6 +257,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
+@@ -258,6 +258,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
  	  $(AR) $(AR_FLAGS) $(TARGETLIB) \
  	    $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
  	  $(RANLIB) $(TARGETLIB); \
@@ -30,5 +30,5 @@ index d19e14a2aca..cd02be1c2fb 100644
  	else true; fi; \
  	if [ x"$(NOASANFLAG)" != x ]; then \
 -- 
-2.31.1
+2.34.1
 

diff --git a/9999/0004-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
similarity index 85%
rename from 9999/0004-Gentoo-add-with-extra-soversion-suffix-option.patch
rename to 9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
index 1051543..b2b0bb5 100644
--- a/9999/0004-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0003-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,7 +1,7 @@
-From 235f1f862fb9bf77e2b9f62c24db0ca801c4a057 Mon Sep 17 00:00:00 2001
+From 820a68dff1ec2eb3836727ced1b5b74bd31daa28 Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Tue, 20 Jul 2021 21:12:38 +0200
-Subject: [PATCH 4/6] Gentoo: add --with-extra-soversion-suffix= option
+Subject: [PATCH 3/6] Gentoo: add --with-extra-soversion-suffix= option
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -34,7 +34,7 @@ Ported to binutils 2.37 Andreas K. Hüttel <dilfridge@gentoo.org>
  4 files changed, 29 insertions(+)
 
 diff --git a/bfd/Makefile.am b/bfd/Makefile.am
-index ed2f701805d..dab3bfc8ed7 100644
+index 10dd765bec8..e3d97adfbb3 100644
 --- a/bfd/Makefile.am
 +++ b/bfd/Makefile.am
 @@ -59,6 +59,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
@@ -46,7 +46,7 @@ index ed2f701805d..dab3bfc8ed7 100644
  # bfd.h goes here, for now
  BFD_H = bfd.h
  
-@@ -952,6 +954,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -987,6 +989,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -57,10 +57,10 @@ index ed2f701805d..dab3bfc8ed7 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/Makefile.in b/bfd/Makefile.in
-index 12807d99760..572df143487 100644
+index f5313a2ad6f..c8cfc0474f2 100644
 --- a/bfd/Makefile.in
 +++ b/bfd/Makefile.in
-@@ -318,6 +318,7 @@ ECHO_T = @ECHO_T@
+@@ -319,6 +319,7 @@ ECHO_T = @ECHO_T@
  EGREP = @EGREP@
  EXEEXT = @EXEEXT@
  EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
@@ -68,7 +68,7 @@ index 12807d99760..572df143487 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -2063,6 +2064,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -2104,6 +2105,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -79,7 +79,7 @@ index 12807d99760..572df143487 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index 41586f00f93..f0acf160913 100755
+index b09702f26e1..7a7c1229c99 100755
 --- a/bfd/configure
 +++ b/bfd/configure
 @@ -696,6 +696,7 @@ WARN_CFLAGS
@@ -88,9 +88,9 @@ index 41586f00f93..f0acf160913 100755
  PKGVERSION
 +EXTRA_SOVERSION_SUFFIX
  DEBUGDIR
- PLUGINS_FALSE
- PLUGINS_TRUE
-@@ -835,6 +836,7 @@ enable_secureplt
+ ENABLE_BFD_64_BIT_FALSE
+ ENABLE_BFD_64_BIT_TRUE
+@@ -837,6 +838,7 @@ enable_secureplt
  enable_separate_code
  enable_leading_mingw64_underscores
  with_separate_debug_dir
@@ -98,7 +98,7 @@ index 41586f00f93..f0acf160913 100755
  with_pkgversion
  with_bugurl
  enable_werror
-@@ -1511,6 +1513,8 @@ Optional Packages:
+@@ -1513,6 +1515,8 @@ Optional Packages:
    --with-separate-debug-dir=DIR
                            Look for global separate debug info in DIR
                            [[default=LIBDIR/debug]]
@@ -107,7 +107,7 @@ index 41586f00f93..f0acf160913 100755
    --with-pkgversion=PKG   Use PKG in the version string in place of "GNU
                            Binutils"
    --with-bugurl=URL       Direct users to URL to report a bug
-@@ -11913,6 +11917,15 @@ fi
+@@ -12013,6 +12017,15 @@ fi
  
  
  
@@ -124,10 +124,10 @@ index 41586f00f93..f0acf160913 100755
  
  # Check whether --with-pkgversion was given.
 diff --git a/bfd/configure.ac b/bfd/configure.ac
-index fec067b2135..8c9ef9a04c0 100644
+index a9078965c40..3406c071fe7 100644
 --- a/bfd/configure.ac
 +++ b/bfd/configure.ac
-@@ -169,6 +169,13 @@ AC_ARG_WITH(separate-debug-dir,
+@@ -168,6 +168,13 @@ AC_ARG_WITH(separate-debug-dir,
  [DEBUGDIR="${withval}"])
  AC_SUBST(DEBUGDIR)
  
@@ -139,8 +139,8 @@ index fec067b2135..8c9ef9a04c0 100644
 +AC_SUBST(EXTRA_SOVERSION_SUFFIX)
 +
  ACX_PKGVERSION([GNU Binutils])
- ACX_BUGURL([https://www.sourceware.org/bugzilla/])
+ ACX_BUGURL([https://sourceware.org/bugzilla/])
  
 -- 
-2.31.1
+2.34.1
 

diff --git a/9999/0003-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch b/9999/0003-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
deleted file mode 100644
index f3c9f8e..0000000
--- a/9999/0003-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From c55536c61ec7e4c2e983e15f51f56f7a7c340889 Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Tue, 5 Jul 2016 20:24:00 +0545
-Subject: [PATCH 3/6] Gentoo: opcodes: link against libbfd.la for rpath deps
-
-The reason opcodes doesn't link against libbfd.la is to workaround a
-libtool bug where it uses installed -L paths ahead of DESTDIR paths.
-The downside is that the library itself lacks rpath tags to find the
-right version of libbfd.so.
-
-Since Gentoo has patched the libtool bug for a while, we don't need
-the workaround.  Use the .la file so we get the rpath tags.
-
-URL: https://bugs.gentoo.org/563934
-(cherry picked from commit 662586237b0b00ee881e79b56f6234ff36e8bfe6)
----
- opcodes/configure    | 2 +-
- opcodes/configure.ac | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/opcodes/configure b/opcodes/configure
-index a3da5987f1b..22a05245286 100755
---- a/opcodes/configure
-+++ b/opcodes/configure
-@@ -12142,7 +12142,7 @@ if test "$enable_shared" = "yes"; then
-           SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
- 	  ;;
- 	*)
--          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}"
-+          SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}"
- 	  ;;
-       esac
-       SHARED_DEPENDENCIES="../bfd/libbfd.la"
-diff --git a/opcodes/configure.ac b/opcodes/configure.ac
-index e564f067334..fb6254cd69d 100644
---- a/opcodes/configure.ac
-+++ b/opcodes/configure.ac
-@@ -203,7 +203,7 @@ if test "$enable_shared" = "yes"; then
-           SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
- 	  ;;
- 	*)
--          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}"
-+          SHARED_LIBADD="../bfd/libbfd.la ${SHARED_LIBADD}"
- 	  ;;
-       esac
-       SHARED_DEPENDENCIES="../bfd/libbfd.la"
--- 
-2.31.1
-

diff --git a/9999/0006-Gentoo-Pass-hash-style-sysv.patch b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
similarity index 84%
rename from 9999/0006-Gentoo-Pass-hash-style-sysv.patch
rename to 9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
index 41b6a33..2ac5053 100644
--- a/9999/0006-Gentoo-Pass-hash-style-sysv.patch
+++ b/9999/0004-Gentoo-Pass-hash-style-sysv-to-ld-in-the-testsuite.patch
@@ -1,7 +1,7 @@
-From 905bf3c180f4f7fd07024eb9ff7851898593f3f8 Mon Sep 17 00:00:00 2001
+From 6e5bb8fa8e5f409e12098a922de72f6bdcc99603 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Tue, 20 Jul 2021 21:15:24 +0200
-Subject: [PATCH 6/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
+Subject: [PATCH 4/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
 
 ---
  binutils/testsuite/lib/binutils-common.exp |  2 +-
@@ -9,10 +9,10 @@ Subject: [PATCH 6/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
  2 files changed, 15 insertions(+), 3 deletions(-)
 
 diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
-index 59e25df99b0..401a05b5c32 100644
+index 93603b0be68..83ae1307f2a 100644
 --- a/binutils/testsuite/lib/binutils-common.exp
 +++ b/binutils/testsuite/lib/binutils-common.exp
-@@ -1279,7 +1279,7 @@ proc run_dump_test { name {extra_options {}} } {
+@@ -1303,7 +1303,7 @@ proc run_dump_test { name {extra_options {}} } {
  
  	    # Add -L$srcdir/$subdir so that the linker command can use
  	    # linker scripts in the source directory.
@@ -22,10 +22,10 @@ index 59e25df99b0..401a05b5c32 100644
  
  	    # If needed then check for, or add a -Map option.
 diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index 8fd14afc63e..adbeaa3bd08 100644
+index 5c7771f7221..ff9ee6a425c 100644
 --- a/ld/testsuite/lib/ld-lib.exp
 +++ b/ld/testsuite/lib/ld-lib.exp
-@@ -167,7 +167,7 @@ proc default_ld_relocate { ld target objects } {
+@@ -171,7 +171,7 @@ proc default_ld_relocate { ld target objects } {
      global HOSTING_EMU
  
      remote_file host delete $target
@@ -34,7 +34,7 @@ index 8fd14afc63e..adbeaa3bd08 100644
  }
  
  # Check to see if ld is being invoked with a non-endian output format
-@@ -198,8 +198,20 @@ proc default_ld_link { ld target objects } {
+@@ -202,8 +202,20 @@ proc default_ld_link { ld target objects } {
  	set flags [big_or_little_endian]
      }
  
@@ -57,5 +57,5 @@ index 8fd14afc63e..adbeaa3bd08 100644
  
      # We don't care if we get a warning about a non-existent start
 -- 
-2.31.1
+2.34.1
 

diff --git a/9999/0007-Give-also-libctf-optionally-a-gentoo-specific-sovers.patch b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
similarity index 68%
rename from 9999/0007-Give-also-libctf-optionally-a-gentoo-specific-sovers.patch
rename to 9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
index 6f1c6b3..871812a 100644
--- a/9999/0007-Give-also-libctf-optionally-a-gentoo-specific-sovers.patch
+++ b/9999/0005-Gentoo-Give-also-libctf-optionally-a-gentoo-specific.patch
@@ -1,29 +1,31 @@
-From d3cd41f5c7e405a8db5e85a7be9dfc42d44ef1b8 Mon Sep 17 00:00:00 2001
+From f4db43e58d2f3a6e66b15ff2b25ac6850199399b Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 24 Jul 2021 15:20:16 +0200
-Subject: [PATCH 1/2] Give also libctf optionally a gentoo-specific soversion
+Subject: [PATCH 5/6] Gentoo: Give also libctf optionally a gentoo-specific
+ soversion
 
 ---
- libctf/Makefile.am  | 13 ++++++++++++-
- libctf/Makefile.in  |  8 +++++++-
- libctf/configure    | 31 +++++++++++++++++++++++++++++--
- libctf/configure.ac |  8 ++++++++
- 4 files changed, 56 insertions(+), 4 deletions(-)
+ libctf/Makefile.am  | 14 +++++++++++++-
+ libctf/Makefile.in  |  9 ++++++++-
+ libctf/configure    | 35 +++++++++++++++++++++++++++++++++--
+ libctf/configure.ac | 10 ++++++++++
+ 4 files changed, 64 insertions(+), 4 deletions(-)
 
 diff --git a/libctf/Makefile.am b/libctf/Makefile.am
-index e586d25fb37..eabc7fa8394 100644
+index 27e90f0ba36..4990a20efa3 100644
 --- a/libctf/Makefile.am
 +++ b/libctf/Makefile.am
-@@ -21,6 +21,8 @@ ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
- 
- AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex
+@@ -26,6 +26,9 @@ info_TEXINFOS =
+ DISTCLEANFILES =
+ MAINTAINERCLEANFILES =
  
 +EXTRA_SOVERSION_SUFFIX = @EXTRA_SOVERSION_SUFFIX@
++BFD_VERSION = @BFD_VERSION@
 +
  # This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
  # -I../zlib, unless we were configured with --with-system-zlib, in which
  # case both are empty.
-@@ -41,8 +43,17 @@ include_HEADERS =
+@@ -46,8 +49,17 @@ include_HEADERS =
  noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
  endif
  
@@ -31,22 +33,30 @@ index e586d25fb37..eabc7fa8394 100644
 +# a supplement to the soversion. So we need to switch tracks and be creative.
 +
 +if HAVE_EXTRA_SOVERSION_SUFFIX
-+gentoo_ctf_soversion = 0.0.0.$(EXTRA_SOVERSION_SUFFIX)
++gentoo_ctf_soversion = "$(BFD_VERSION).$(EXTRA_SOVERSION_SUFFIX)"
 +else
 +gentoo_ctf_soversion = 0.0.0
 +endif
 +
  libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
--libctf_nobfd_la_LDFLAGS = -version-info 0:0:0 @SHARED_LDFLAGS@ @VERSION_FLAGS@
-+libctf_nobfd_la_LDFLAGS = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@ @VERSION_FLAGS@
+-libctf_ldflags_nover = -version-info 0:0:0 @SHARED_LDFLAGS@
++libctf_ldflags_nover = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@
+ libctf_nobfd_la_LDFLAGS = $(libctf_ldflags_nover) @VERSION_FLAGS_NOBFD@
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
- 			  ctf-hash.c ctf-labels.c ctf-dedup.c ctf-link.c ctf-lookup.c \
 diff --git a/libctf/Makefile.in b/libctf/Makefile.in
-index 5cfa100f9cc..b528781af97 100644
+index 3b5ab73324e..10029107a05 100644
 --- a/libctf/Makefile.in
 +++ b/libctf/Makefile.in
-@@ -338,6 +338,7 @@ EXEEXT = @EXEEXT@
+@@ -381,6 +381,7 @@ AUTOCONF = @AUTOCONF@
+ AUTOHEADER = @AUTOHEADER@
+ AUTOMAKE = @AUTOMAKE@
+ AWK = @AWK@
++BFD_VERSION = @BFD_VERSION@
+ CATALOGS = @CATALOGS@
+ CATOBJEXT = @CATOBJEXT@
+ CC = @CC@
+@@ -403,6 +404,7 @@ EXEEXT = @EXEEXT@
  
  # Setup the testing framework, if you have one
  EXPECT = expect
@@ -54,7 +64,7 @@ index 5cfa100f9cc..b528781af97 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -469,8 +470,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
+@@ -540,8 +542,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
  @INSTALL_LIBBFD_FALSE@include_HEADERS = 
  @INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
  @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
@@ -62,28 +72,29 @@ index 5cfa100f9cc..b528781af97 100644
 +
 +# libctf by default uses libtool versioning. Unfortunately that keeps us from adding
 +# a supplement to the soversion. So we need to switch tracks and be creative.
-+@HAVE_EXTRA_SOVERSION_SUFFIX_TRUE@gentoo_ctf_soversion = 0.0.0.$(EXTRA_SOVERSION_SUFFIX)
++@HAVE_EXTRA_SOVERSION_SUFFIX_TRUE@gentoo_ctf_soversion = "$(BFD_VERSION).$(EXTRA_SOVERSION_SUFFIX)"
  libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
--libctf_nobfd_la_LDFLAGS = -version-info 0:0:0 @SHARED_LDFLAGS@ @VERSION_FLAGS@
-+libctf_nobfd_la_LDFLAGS = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@ @VERSION_FLAGS@
+-libctf_ldflags_nover = -version-info 0:0:0 @SHARED_LDFLAGS@
++libctf_ldflags_nover = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@
+ libctf_nobfd_la_LDFLAGS = $(libctf_ldflags_nover) @VERSION_FLAGS_NOBFD@
  libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
  libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
- 	ctf-decl.c ctf-error.c ctf-hash.c ctf-labels.c ctf-dedup.c \
 diff --git a/libctf/configure b/libctf/configure
-index 82bcf13a606..e961f637a69 100755
+index c56ac218213..623e71477b3 100755
 --- a/libctf/configure
 +++ b/libctf/configure
-@@ -643,6 +643,9 @@ CTF_LIBADD
- SHARED_LDFLAGS
+@@ -646,6 +646,10 @@ BUILD_INFO_FALSE
+ BUILD_INFO_TRUE
  NEED_CTF_QSORT_R_FALSE
  NEED_CTF_QSORT_R_TRUE
++BFD_VERSION
 +HAVE_EXTRA_SOVERSION_SUFFIX_FALSE
 +HAVE_EXTRA_SOVERSION_SUFFIX_TRUE
 +EXTRA_SOVERSION_SUFFIX
  ENABLE_LIBCTF_HASH_DEBUGGING_FALSE
  ENABLE_LIBCTF_HASH_DEBUGGING_TRUE
  zlibinc
-@@ -804,6 +807,7 @@ enable_maintainer_mode
+@@ -807,6 +811,7 @@ enable_maintainer_mode
  enable_install_libbfd
  with_system_zlib
  enable_libctf_hash_debugging
@@ -91,7 +102,7 @@ index 82bcf13a606..e961f637a69 100755
  '
        ac_precious_vars='build_alias
  host_alias
-@@ -1461,6 +1465,8 @@ Optional Packages:
+@@ -1464,6 +1469,8 @@ Optional Packages:
                            both]
    --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
    --with-system-zlib      use installed libz
@@ -100,25 +111,25 @@ index 82bcf13a606..e961f637a69 100755
  
  Some influential environment variables:
    CC          C compiler command
-@@ -11586,7 +11592,7 @@ else
+@@ -11629,7 +11636,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11589 "configure"
-+#line 11607 "configure"
+-#line 11632 "configure"
++#line 11639 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -11692,7 +11698,7 @@ else
+@@ -11735,7 +11742,7 @@ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11695 "configure"
-+#line 11713 "configure"
+-#line 11738 "configure"
++#line 11745 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -12899,6 +12905,23 @@ else
+@@ -12942,6 +12949,26 @@ else
  fi
  
  
@@ -138,11 +149,14 @@ index 82bcf13a606..e961f637a69 100755
 +  HAVE_EXTRA_SOVERSION_SUFFIX_FALSE=
 +fi
 +
++
++BFD_VERSION=$(${srcdir}/../bfd/configure --version | sed -n -e '1s,.* ,,p')
++
 +
  # Similar to GDB_AC_CHECK_BFD.
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
-@@ -13657,6 +13680,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
+@@ -13834,6 +13861,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
    as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined.
  Usually this means the macro was only invoked conditionally." "$LINENO" 5
  fi
@@ -154,10 +168,10 @@ index 82bcf13a606..e961f637a69 100755
  if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; then
    as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined.
 diff --git a/libctf/configure.ac b/libctf/configure.ac
-index 80644b89d67..f7e6180afd8 100644
+index 4996edd5b70..103fc8b9d33 100644
 --- a/libctf/configure.ac
 +++ b/libctf/configure.ac
-@@ -77,6 +77,14 @@ if test "${enable_libctf_hash_debugging}" = yes; then
+@@ -78,6 +78,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then
  fi
  AM_CONDITIONAL(ENABLE_LIBCTF_HASH_DEBUGGING, test "${enable_libctf_hash_debugging}" = yes)
  
@@ -168,10 +182,12 @@ index 80644b89d67..f7e6180afd8 100644
 +[EXTRA_SOVERSION_SUFFIX="${withval}"])
 +AC_SUBST(EXTRA_SOVERSION_SUFFIX)
 +AM_CONDITIONAL([HAVE_EXTRA_SOVERSION_SUFFIX], [test -n "${with_extra_soversion_suffix}"])
++
++AC_SUBST(BFD_VERSION, $(${srcdir}/../bfd/configure --version | sed -n -e '1s,.* ,,p'), [Version of the accompanying bfd linker])
 +
  # Similar to GDB_AC_CHECK_BFD.
  OLD_CFLAGS=$CFLAGS
  OLD_LDFLAGS=$LDFLAGS
 -- 
-2.31.1
+2.34.1
 

diff --git a/9999/0020-XFAIL-15-broken-ld.gold-tests.patch b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
similarity index 95%
rename from 9999/0020-XFAIL-15-broken-ld.gold-tests.patch
rename to 9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
index 777390f..b9435e9 100644
--- a/9999/0020-XFAIL-15-broken-ld.gold-tests.patch
+++ b/9999/0006-Gentoo-XFAIL-15-broken-ld.gold-tests.patch
@@ -1,7 +1,7 @@
-From 6f9a3d6ffa2bcf91bc047055848591dab77c0f11 Mon Sep 17 00:00:00 2001
+From 66686e75515c742e573d25b74ce324e3d1acad08 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sat, 31 Jul 2021 01:18:18 +0200
-Subject: [PATCH] Gentoo: XFAIL 15 broken ld.gold tests
+Subject: [PATCH 6/6] Gentoo: XFAIL 15 broken ld.gold tests
 
 It seems like either the tests or ld.gold in general cannot handle
 compilers built with --enable-default-pie. No fix yet, so let's ignore
@@ -73,5 +73,5 @@ index 7b4b7832d38..765c2b73140 100644
  AUTOMAKE_OPTIONS = foreign -Wno-portability
  
 -- 
-2.31.1
+2.34.1
 

diff --git a/9999/0008-If-we-use-a-soversion-suffix-then-we-also-use-the-bd.patch b/9999/0008-If-we-use-a-soversion-suffix-then-we-also-use-the-bd.patch
deleted file mode 100644
index b88f50e..0000000
--- a/9999/0008-If-we-use-a-soversion-suffix-then-we-also-use-the-bd.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From 235448cc5c53641417e17fd39ced95a21053c8ca Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Sat, 24 Jul 2021 19:25:32 +0200
-Subject: [PATCH 2/2] If we use a soversion suffix, then we also use the bdf
- version as soversion
-
----
- libctf/Makefile.am  | 3 ++-
- libctf/Makefile.in  | 3 ++-
- libctf/configure    | 8 ++++++--
- libctf/configure.ac | 2 ++
- 4 files changed, 12 insertions(+), 4 deletions(-)
-
-diff --git a/libctf/Makefile.am b/libctf/Makefile.am
-index eabc7fa8394..e1304e8e89b 100644
---- a/libctf/Makefile.am
-+++ b/libctf/Makefile.am
-@@ -22,6 +22,7 @@ ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
- AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex
- 
- EXTRA_SOVERSION_SUFFIX = @EXTRA_SOVERSION_SUFFIX@
-+BFD_VERSION = @BFD_VERSION@
- 
- # This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
- # -I../zlib, unless we were configured with --with-system-zlib, in which
-@@ -47,7 +48,7 @@ endif
- # a supplement to the soversion. So we need to switch tracks and be creative.
- 
- if HAVE_EXTRA_SOVERSION_SUFFIX
--gentoo_ctf_soversion = 0.0.0.$(EXTRA_SOVERSION_SUFFIX)
-+gentoo_ctf_soversion = "$(BFD_VERSION).$(EXTRA_SOVERSION_SUFFIX)"
- else
- gentoo_ctf_soversion = 0.0.0
- endif
-diff --git a/libctf/Makefile.in b/libctf/Makefile.in
-index b528781af97..18d482411e8 100644
---- a/libctf/Makefile.in
-+++ b/libctf/Makefile.in
-@@ -316,6 +316,7 @@ AUTOCONF = @AUTOCONF@
- AUTOHEADER = @AUTOHEADER@
- AUTOMAKE = @AUTOMAKE@
- AWK = @AWK@
-+BFD_VERSION = @BFD_VERSION@
- CATALOGS = @CATALOGS@
- CATOBJEXT = @CATOBJEXT@
- CC = @CC@
-@@ -474,7 +475,7 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
- 
- # libctf by default uses libtool versioning. Unfortunately that keeps us from adding
- # a supplement to the soversion. So we need to switch tracks and be creative.
--@HAVE_EXTRA_SOVERSION_SUFFIX_TRUE@gentoo_ctf_soversion = 0.0.0.$(EXTRA_SOVERSION_SUFFIX)
-+@HAVE_EXTRA_SOVERSION_SUFFIX_TRUE@gentoo_ctf_soversion = "$(BFD_VERSION).$(EXTRA_SOVERSION_SUFFIX)"
- libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
- libctf_nobfd_la_LDFLAGS = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@ @VERSION_FLAGS@
- libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
-diff --git a/libctf/configure b/libctf/configure
-index e961f637a69..520d3a5cb3e 100755
---- a/libctf/configure
-+++ b/libctf/configure
-@@ -643,6 +643,7 @@ CTF_LIBADD
- SHARED_LDFLAGS
- NEED_CTF_QSORT_R_FALSE
- NEED_CTF_QSORT_R_TRUE
-+BFD_VERSION
- HAVE_EXTRA_SOVERSION_SUFFIX_FALSE
- HAVE_EXTRA_SOVERSION_SUFFIX_TRUE
- EXTRA_SOVERSION_SUFFIX
-@@ -11592,7 +11593,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11607 "configure"
-+#line 11608 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -11698,7 +11699,7 @@ else
-   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-   lt_status=$lt_dlunknown
-   cat > conftest.$ac_ext <<_LT_EOF
--#line 11713 "configure"
-+#line 11714 "configure"
- #include "confdefs.h"
- 
- #if HAVE_DLFCN_H
-@@ -12922,6 +12923,9 @@ else
- fi
- 
- 
-+BFD_VERSION=$(${srcdir}/../bfd/configure --version | sed -n -e '1s,.* ,,p')
-+
-+
- # Similar to GDB_AC_CHECK_BFD.
- OLD_CFLAGS=$CFLAGS
- OLD_LDFLAGS=$LDFLAGS
-diff --git a/libctf/configure.ac b/libctf/configure.ac
-index f7e6180afd8..5306e5499ec 100644
---- a/libctf/configure.ac
-+++ b/libctf/configure.ac
-@@ -85,6 +85,8 @@ AC_ARG_WITH(extra-soversion-suffix,
- AC_SUBST(EXTRA_SOVERSION_SUFFIX)
- AM_CONDITIONAL([HAVE_EXTRA_SOVERSION_SUFFIX], [test -n "${with_extra_soversion_suffix}"])
- 
-+AC_SUBST(BFD_VERSION, $(${srcdir}/../bfd/configure --version | sed -n -e '1s,.* ,,p'), [Version of the accompanying bfd linker])
-+
- # Similar to GDB_AC_CHECK_BFD.
- OLD_CFLAGS=$CFLAGS
- OLD_LDFLAGS=$LDFLAGS
--- 
-2.31.1
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2021-08-17 20:07 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2021-08-17 20:07 UTC (permalink / raw
  To: gentoo-commits

commit:     8699e74a960289b51ace04e4fffde22d5344171b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 17 20:01:35 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Aug 17 20:01:35 2021 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=8699e74a

Enable new dtags via configure, not broken patch

Bug: https://bugs.gentoo.org/808787
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...nable-new-dtags-by-default-for-linux-gnu-.patch | 49 ----------------------
 1 file changed, 49 deletions(-)

diff --git a/9999/0005-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch b/9999/0005-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
deleted file mode 100644
index c6e5299..0000000
--- a/9999/0005-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From f4ecba77ec1eb0576b8731c749336ea3889eba73 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Sun, 13 Oct 2019 05:25:28 +0200
-Subject: [PATCH 5/6] Gentoo: ld: enable new dtags by default for linux/gnu
- targets
-
-Original author: Mike Frysinger <vapier@gentoo.org>
-
-The "new" dtags options have been around for 14+ years now, so for Linux
-and GNU targets, enable them by default.
-
-2012-01-21  Mike Frysinger  <vapier@gentoo.org>
-
-        * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
-        link_info.new_dtags to TRUE for linux/gnu targets.
-        * NEWS: Mention new dtags default.
-
-2013-01-22  Roland McGrath  <mcgrathr@google.com>
-
-        * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
-        new_dtags to TRUE for *-*-nacl* targets.
----
- ld/emultempl/elf.em | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
-index bfaf8130a3e..c4c42b7371a 100644
---- a/ld/emultempl/elf.em
-+++ b/ld/emultempl/elf.em
-@@ -81,6 +81,16 @@ gld${EMULATION_NAME}_before_parse (void)
-   input_flags.dynamic = ${DYNAMIC_LINK-true};
-   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
-   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
-+EOF
-+
-+case ${target} in
-+  *-*-linux-* | *-*-k*bsd*-* | *-*-gnu* | *-*-nacl*)
-+    fragment <<EOF
-+  link_info.new_dtags = true;
-+EOF
-+    ;;
-+esac
-+fragment <<EOF
-   link_info.check_relocs_after_open_input = true;
- EOF
- if test -n "$COMMONPAGESIZE"; then
--- 
-2.31.1
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2021-07-30 23:25 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2021-07-30 23:25 UTC (permalink / raw
  To: gentoo-commits

commit:     7d4ad0cdad6d8eda51cc091f9357fe9d13c3f1e2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 30 23:25:06 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Jul 30 23:25:06 2021 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=7d4ad0cd

XFAIL 15 broken ld.gold tests

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 9999/0020-XFAIL-15-broken-ld.gold-tests.patch | 77 +++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/9999/0020-XFAIL-15-broken-ld.gold-tests.patch b/9999/0020-XFAIL-15-broken-ld.gold-tests.patch
new file mode 100644
index 0000000..777390f
--- /dev/null
+++ b/9999/0020-XFAIL-15-broken-ld.gold-tests.patch
@@ -0,0 +1,77 @@
+From 6f9a3d6ffa2bcf91bc047055848591dab77c0f11 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Sat, 31 Jul 2021 01:18:18 +0200
+Subject: [PATCH] Gentoo: XFAIL 15 broken ld.gold tests
+
+It seems like either the tests or ld.gold in general cannot handle
+compilers built with --enable-default-pie. No fix yet, so let's ignore
+these test failures for the moment. For details see the linked bugs.
+
+Bug: https://bugs.gentoo.org/684046
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22755
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27303
+---
+ gold/testsuite/Makefile.am |  6 ++++++
+ gold/testsuite/Makefile.in | 16 ++++++++++++----
+ 2 files changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
+index 38e54818f48..85c94d40660 100644
+--- a/gold/testsuite/Makefile.am
++++ b/gold/testsuite/Makefile.am
+@@ -1,5 +1,11 @@
+ # Process this file with automake to generate Makefile.in
+ 
++# Gentoo, https://bugs.gentoo.org/684046
++XFAIL_TESTS = exception_separate_shared_12_test exception_separate_shared_21_test \
++	weak_undef_test initpri3a justsyms_exec script_test_2 script_test_1 \
++	justsyms binary_test script_test_3 tls_phdrs_script_test script_test_12i \
++	dynamic_list_2 incremental_test_2 incremental_test_5
++
+ # As far as I can tell automake testing support assumes that the build
+ # system and the host system are the same.  So these tests will not
+ # work when building with a cross-compiler.
+diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
+index 7b4b7832d38..765c2b73140 100644
+--- a/gold/testsuite/Makefile.in
++++ b/gold/testsuite/Makefile.in
+@@ -15,10 +15,6 @@
+ @SET_MAKE@
+ 
+ # Process this file with automake to generate Makefile.in
+-
+-# As far as I can tell automake testing support assumes that the build
+-# system and the host system are the same.  So these tests will not
+-# work when building with a cross-compiler.
+ VPATH = @srcdir@
+ am__is_gnu_make = { \
+   if test -z '$(MAKELEVEL)'; then \
+@@ -94,6 +90,14 @@ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+ target_triplet = @target@
++XFAIL_TESTS = exception_separate_shared_12_test$(EXEEXT) \
++	exception_separate_shared_21_test$(EXEEXT) \
++	weak_undef_test$(EXEEXT) initpri3a$(EXEEXT) \
++	justsyms_exec$(EXEEXT) script_test_2$(EXEEXT) \
++	script_test_1$(EXEEXT) justsyms$(EXEEXT) binary_test$(EXEEXT) \
++	script_test_3$(EXEEXT) tls_phdrs_script_test$(EXEEXT) \
++	script_test_12i$(EXEEXT) dynamic_list_2$(EXEEXT) \
++	incremental_test_2$(EXEEXT) incremental_test_5$(EXEEXT)
+ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+ 	$(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
+ 	$(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \
+@@ -2742,6 +2746,10 @@ top_srcdir = @top_srcdir@
+ zlibdir = @zlibdir@
+ zlibinc = @zlibinc@
+ 
++# As far as I can tell automake testing support assumes that the build
++# system and the host system are the same.  So these tests will not
++# work when building with a cross-compiler.
++
+ # Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
+ AUTOMAKE_OPTIONS = foreign -Wno-portability
+ 
+-- 
+2.31.1
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2021-07-24 20:57 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2021-07-24 20:57 UTC (permalink / raw
  To: gentoo-commits

commit:     bc2a10f35b091063cf84b9cfd5300b6c0f0cf428
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 24 19:40:41 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 24 19:40:41 2021 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=bc2a10f3

Add libctf soversion patches

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...ibctf-optionally-a-gentoo-specific-sovers.patch | 177 +++++++++++++++++++++
 ...-soversion-suffix-then-we-also-use-the-bd.patch | 111 +++++++++++++
 2 files changed, 288 insertions(+)

diff --git a/9999/0007-Give-also-libctf-optionally-a-gentoo-specific-sovers.patch b/9999/0007-Give-also-libctf-optionally-a-gentoo-specific-sovers.patch
new file mode 100644
index 0000000..6f1c6b3
--- /dev/null
+++ b/9999/0007-Give-also-libctf-optionally-a-gentoo-specific-sovers.patch
@@ -0,0 +1,177 @@
+From d3cd41f5c7e405a8db5e85a7be9dfc42d44ef1b8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Sat, 24 Jul 2021 15:20:16 +0200
+Subject: [PATCH 1/2] Give also libctf optionally a gentoo-specific soversion
+
+---
+ libctf/Makefile.am  | 13 ++++++++++++-
+ libctf/Makefile.in  |  8 +++++++-
+ libctf/configure    | 31 +++++++++++++++++++++++++++++--
+ libctf/configure.ac |  8 ++++++++
+ 4 files changed, 56 insertions(+), 4 deletions(-)
+
+diff --git a/libctf/Makefile.am b/libctf/Makefile.am
+index e586d25fb37..eabc7fa8394 100644
+--- a/libctf/Makefile.am
++++ b/libctf/Makefile.am
+@@ -21,6 +21,8 @@ ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
+ 
+ AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex
+ 
++EXTRA_SOVERSION_SUFFIX = @EXTRA_SOVERSION_SUFFIX@
++
+ # This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
+ # -I../zlib, unless we were configured with --with-system-zlib, in which
+ # case both are empty.
+@@ -41,8 +43,17 @@ include_HEADERS =
+ noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
+ endif
+ 
++# libctf by default uses libtool versioning. Unfortunately that keeps us from adding
++# a supplement to the soversion. So we need to switch tracks and be creative.
++
++if HAVE_EXTRA_SOVERSION_SUFFIX
++gentoo_ctf_soversion = 0.0.0.$(EXTRA_SOVERSION_SUFFIX)
++else
++gentoo_ctf_soversion = 0.0.0
++endif
++
+ libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
+-libctf_nobfd_la_LDFLAGS = -version-info 0:0:0 @SHARED_LDFLAGS@ @VERSION_FLAGS@
++libctf_nobfd_la_LDFLAGS = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@ @VERSION_FLAGS@
+ libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
+ libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
+ 			  ctf-hash.c ctf-labels.c ctf-dedup.c ctf-link.c ctf-lookup.c \
+diff --git a/libctf/Makefile.in b/libctf/Makefile.in
+index 5cfa100f9cc..b528781af97 100644
+--- a/libctf/Makefile.in
++++ b/libctf/Makefile.in
+@@ -338,6 +338,7 @@ EXEEXT = @EXEEXT@
+ 
+ # Setup the testing framework, if you have one
+ EXPECT = expect
++EXTRA_SOVERSION_SUFFIX = @EXTRA_SOVERSION_SUFFIX@
+ FGREP = @FGREP@
+ GENCAT = @GENCAT@
+ GMSGFMT = @GMSGFMT@
+@@ -469,8 +470,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
+ @INSTALL_LIBBFD_FALSE@include_HEADERS = 
+ @INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
+ @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
++@HAVE_EXTRA_SOVERSION_SUFFIX_FALSE@gentoo_ctf_soversion = 0.0.0
++
++# libctf by default uses libtool versioning. Unfortunately that keeps us from adding
++# a supplement to the soversion. So we need to switch tracks and be creative.
++@HAVE_EXTRA_SOVERSION_SUFFIX_TRUE@gentoo_ctf_soversion = 0.0.0.$(EXTRA_SOVERSION_SUFFIX)
+ libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
+-libctf_nobfd_la_LDFLAGS = -version-info 0:0:0 @SHARED_LDFLAGS@ @VERSION_FLAGS@
++libctf_nobfd_la_LDFLAGS = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@ @VERSION_FLAGS@
+ libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
+ libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
+ 	ctf-decl.c ctf-error.c ctf-hash.c ctf-labels.c ctf-dedup.c \
+diff --git a/libctf/configure b/libctf/configure
+index 82bcf13a606..e961f637a69 100755
+--- a/libctf/configure
++++ b/libctf/configure
+@@ -643,6 +643,9 @@ CTF_LIBADD
+ SHARED_LDFLAGS
+ NEED_CTF_QSORT_R_FALSE
+ NEED_CTF_QSORT_R_TRUE
++HAVE_EXTRA_SOVERSION_SUFFIX_FALSE
++HAVE_EXTRA_SOVERSION_SUFFIX_TRUE
++EXTRA_SOVERSION_SUFFIX
+ ENABLE_LIBCTF_HASH_DEBUGGING_FALSE
+ ENABLE_LIBCTF_HASH_DEBUGGING_TRUE
+ zlibinc
+@@ -804,6 +807,7 @@ enable_maintainer_mode
+ enable_install_libbfd
+ with_system_zlib
+ enable_libctf_hash_debugging
++with_extra_soversion_suffix
+ '
+       ac_precious_vars='build_alias
+ host_alias
+@@ -1461,6 +1465,8 @@ Optional Packages:
+                           both]
+   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+   --with-system-zlib      use installed libz
++  --with-extra-soversion-suffix=SUFFIX
++                          Append '.SUFFIX' to SONAME [[default=]]
+ 
+ Some influential environment variables:
+   CC          C compiler command
+@@ -11586,7 +11592,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11589 "configure"
++#line 11607 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11692,7 +11698,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11695 "configure"
++#line 11713 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -12899,6 +12905,23 @@ else
+ fi
+ 
+ 
++EXTRA_SOVERSION_SUFFIX=
++
++# Check whether --with-extra-soversion-suffix was given.
++if test "${with_extra_soversion_suffix+set}" = set; then :
++  withval=$with_extra_soversion_suffix; EXTRA_SOVERSION_SUFFIX="${withval}"
++fi
++
++
++ if test -n "${with_extra_soversion_suffix}"; then
++  HAVE_EXTRA_SOVERSION_SUFFIX_TRUE=
++  HAVE_EXTRA_SOVERSION_SUFFIX_FALSE='#'
++else
++  HAVE_EXTRA_SOVERSION_SUFFIX_TRUE='#'
++  HAVE_EXTRA_SOVERSION_SUFFIX_FALSE=
++fi
++
++
+ # Similar to GDB_AC_CHECK_BFD.
+ OLD_CFLAGS=$CFLAGS
+ OLD_LDFLAGS=$LDFLAGS
+@@ -13657,6 +13680,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
+   as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
++if test -z "${HAVE_EXTRA_SOVERSION_SUFFIX_TRUE}" && test -z "${HAVE_EXTRA_SOVERSION_SUFFIX_FALSE}"; then
++  as_fn_error $? "conditional \"HAVE_EXTRA_SOVERSION_SUFFIX\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
++fi
+ 
+ if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; then
+   as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined.
+diff --git a/libctf/configure.ac b/libctf/configure.ac
+index 80644b89d67..f7e6180afd8 100644
+--- a/libctf/configure.ac
++++ b/libctf/configure.ac
+@@ -77,6 +77,14 @@ if test "${enable_libctf_hash_debugging}" = yes; then
+ fi
+ AM_CONDITIONAL(ENABLE_LIBCTF_HASH_DEBUGGING, test "${enable_libctf_hash_debugging}" = yes)
+ 
++EXTRA_SOVERSION_SUFFIX=
++AC_ARG_WITH(extra-soversion-suffix,
++  AS_HELP_STRING([--with-extra-soversion-suffix=SUFFIX],
++                 [Append '.SUFFIX' to SONAME [[default=]]]),
++[EXTRA_SOVERSION_SUFFIX="${withval}"])
++AC_SUBST(EXTRA_SOVERSION_SUFFIX)
++AM_CONDITIONAL([HAVE_EXTRA_SOVERSION_SUFFIX], [test -n "${with_extra_soversion_suffix}"])
++
+ # Similar to GDB_AC_CHECK_BFD.
+ OLD_CFLAGS=$CFLAGS
+ OLD_LDFLAGS=$LDFLAGS
+-- 
+2.31.1
+

diff --git a/9999/0008-If-we-use-a-soversion-suffix-then-we-also-use-the-bd.patch b/9999/0008-If-we-use-a-soversion-suffix-then-we-also-use-the-bd.patch
new file mode 100644
index 0000000..b88f50e
--- /dev/null
+++ b/9999/0008-If-we-use-a-soversion-suffix-then-we-also-use-the-bd.patch
@@ -0,0 +1,111 @@
+From 235448cc5c53641417e17fd39ced95a21053c8ca Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Sat, 24 Jul 2021 19:25:32 +0200
+Subject: [PATCH 2/2] If we use a soversion suffix, then we also use the bdf
+ version as soversion
+
+---
+ libctf/Makefile.am  | 3 ++-
+ libctf/Makefile.in  | 3 ++-
+ libctf/configure    | 8 ++++++--
+ libctf/configure.ac | 2 ++
+ 4 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/libctf/Makefile.am b/libctf/Makefile.am
+index eabc7fa8394..e1304e8e89b 100644
+--- a/libctf/Makefile.am
++++ b/libctf/Makefile.am
+@@ -22,6 +22,7 @@ ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
+ AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex
+ 
+ EXTRA_SOVERSION_SUFFIX = @EXTRA_SOVERSION_SUFFIX@
++BFD_VERSION = @BFD_VERSION@
+ 
+ # This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
+ # -I../zlib, unless we were configured with --with-system-zlib, in which
+@@ -47,7 +48,7 @@ endif
+ # a supplement to the soversion. So we need to switch tracks and be creative.
+ 
+ if HAVE_EXTRA_SOVERSION_SUFFIX
+-gentoo_ctf_soversion = 0.0.0.$(EXTRA_SOVERSION_SUFFIX)
++gentoo_ctf_soversion = "$(BFD_VERSION).$(EXTRA_SOVERSION_SUFFIX)"
+ else
+ gentoo_ctf_soversion = 0.0.0
+ endif
+diff --git a/libctf/Makefile.in b/libctf/Makefile.in
+index b528781af97..18d482411e8 100644
+--- a/libctf/Makefile.in
++++ b/libctf/Makefile.in
+@@ -316,6 +316,7 @@ AUTOCONF = @AUTOCONF@
+ AUTOHEADER = @AUTOHEADER@
+ AUTOMAKE = @AUTOMAKE@
+ AWK = @AWK@
++BFD_VERSION = @BFD_VERSION@
+ CATALOGS = @CATALOGS@
+ CATOBJEXT = @CATOBJEXT@
+ CC = @CC@
+@@ -474,7 +475,7 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
+ 
+ # libctf by default uses libtool versioning. Unfortunately that keeps us from adding
+ # a supplement to the soversion. So we need to switch tracks and be creative.
+-@HAVE_EXTRA_SOVERSION_SUFFIX_TRUE@gentoo_ctf_soversion = 0.0.0.$(EXTRA_SOVERSION_SUFFIX)
++@HAVE_EXTRA_SOVERSION_SUFFIX_TRUE@gentoo_ctf_soversion = "$(BFD_VERSION).$(EXTRA_SOVERSION_SUFFIX)"
+ libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
+ libctf_nobfd_la_LDFLAGS = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@ @VERSION_FLAGS@
+ libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
+diff --git a/libctf/configure b/libctf/configure
+index e961f637a69..520d3a5cb3e 100755
+--- a/libctf/configure
++++ b/libctf/configure
+@@ -643,6 +643,7 @@ CTF_LIBADD
+ SHARED_LDFLAGS
+ NEED_CTF_QSORT_R_FALSE
+ NEED_CTF_QSORT_R_TRUE
++BFD_VERSION
+ HAVE_EXTRA_SOVERSION_SUFFIX_FALSE
+ HAVE_EXTRA_SOVERSION_SUFFIX_TRUE
+ EXTRA_SOVERSION_SUFFIX
+@@ -11592,7 +11593,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11607 "configure"
++#line 11608 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11698,7 +11699,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11713 "configure"
++#line 11714 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -12922,6 +12923,9 @@ else
+ fi
+ 
+ 
++BFD_VERSION=$(${srcdir}/../bfd/configure --version | sed -n -e '1s,.* ,,p')
++
++
+ # Similar to GDB_AC_CHECK_BFD.
+ OLD_CFLAGS=$CFLAGS
+ OLD_LDFLAGS=$LDFLAGS
+diff --git a/libctf/configure.ac b/libctf/configure.ac
+index f7e6180afd8..5306e5499ec 100644
+--- a/libctf/configure.ac
++++ b/libctf/configure.ac
+@@ -85,6 +85,8 @@ AC_ARG_WITH(extra-soversion-suffix,
+ AC_SUBST(EXTRA_SOVERSION_SUFFIX)
+ AM_CONDITIONAL([HAVE_EXTRA_SOVERSION_SUFFIX], [test -n "${with_extra_soversion_suffix}"])
+ 
++AC_SUBST(BFD_VERSION, $(${srcdir}/../bfd/configure --version | sed -n -e '1s,.* ,,p'), [Version of the accompanying bfd linker])
++
+ # Similar to GDB_AC_CHECK_BFD.
+ OLD_CFLAGS=$CFLAGS
+ OLD_LDFLAGS=$LDFLAGS
+-- 
+2.31.1
+


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2021-07-20 19:50 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2021-07-20 19:50 UTC (permalink / raw
  To: gentoo-commits

commit:     3aebcafb84cf90109ca2b1b942ed0b71f30b8bd2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 20 19:22:10 2021 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 20 19:22:10 2021 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=3aebcafb

9999: Refresh patches at 2.37 release

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch | 63 ++++++++++++----------
 ...iberty-install-PIC-version-of-libiberty.a.patch | 10 ++--
 ...des-link-against-libbfd.la-for-rpath-deps.patch | 14 ++---
 ...oo-add-with-extra-soversion-suffix-option.patch | 35 ++++++------
 ...nable-new-dtags-by-default-for-linux-gnu-.patch |  9 ++--
 9999/0009-Gentoo-Pass-hash-style-sysv.patch        | 20 +++----
 6 files changed, 81 insertions(+), 70 deletions(-)

diff --git a/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index 964946c..f7443bf 100644
--- a/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,8 +1,11 @@
-From c251ab646d98b3f0e8f8b1ae5e94c672325477e2 Mon Sep 17 00:00:00 2001
+From 8a82f64de912f26e840b20eec9d8a463fd0e242b Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
-Date: Tue, 10 Oct 2017 22:53:53 +0200
-Subject: [PATCH 3/9] Gentoo: gold/ld: add support for poisoned system
+Date: Tue, 20 Jul 2021 21:08:31 +0200
+Subject: [PATCH 1/6] Gentoo: gold/ld: add support for poisoned system 
  directories
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
 
 This is based on the old CodeSourcery patch written by Joseph Myers to add
 support to the link for detecting & rejecting bad -L paths when using a
@@ -23,6 +26,8 @@ TEST=x86_64-cros-linux-gnu-ld throws warnings when using -L/lib (gold & bfd)
 
 Reviewed-on: https://chromium-review.googlesource.com/272083
 (cherry picked from commit f92dbf35c00ab13cee36f6be8ae5ca46454d9000)
+
+Ported to binutils 2.37 Andreas K. Hütte <dilfridge@gentoo.org>
 ---
  gold/options.cc | 33 +++++++++++++++++++++++++++++++++
  gold/options.h  |  7 +++++++
@@ -38,10 +43,10 @@ Reviewed-on: https://chromium-review.googlesource.com/272083
  11 files changed, 146 insertions(+)
 
 diff --git a/gold/options.cc b/gold/options.cc
-index 94867b361a..704d5d089e 100644
+index 5a55bd8ba6d..f7940c75f5a 100644
 --- a/gold/options.cc
 +++ b/gold/options.cc
-@@ -1290,6 +1290,39 @@ General_options::finalize()
+@@ -1355,6 +1355,39 @@ General_options::finalize()
    // in the path, as appropriate.
    this->add_sysroot();
  
@@ -82,10 +87,10 @@ index 94867b361a..704d5d089e 100644
    if (this->shared() && this->is_static())
      gold_fatal(_("-shared and -static are incompatible"));
 diff --git a/gold/options.h b/gold/options.h
-index b2059d984c..b60f802754 100644
+index 757ebf18fec..490b4cbd7d4 100644
 --- a/gold/options.h
 +++ b/gold/options.h
-@@ -1375,6 +1375,13 @@ class General_options
+@@ -1394,6 +1394,13 @@ class General_options
    DEFINE_bool(warn_multiple_gp, options::TWO_DASHES, '\0', false,
  	      N_("Ignored"), NULL);
  
@@ -100,10 +105,10 @@ index b2059d984c..b60f802754 100644
  	      N_("Warn when skipping an incompatible library"),
  	      N_("Don't warn when skipping an incompatible library"));
 diff --git a/ld/config.in b/ld/config.in
-index d93c9b0830..5da2742bea 100644
+index 26d55a00d47..ffad464783c 100644
 --- a/ld/config.in
 +++ b/ld/config.in
-@@ -31,6 +31,9 @@
+@@ -43,6 +43,9 @@
     language is requested. */
  #undef ENABLE_NLS
  
@@ -114,10 +119,10 @@ index d93c9b0830..5da2742bea 100644
  #undef EXTRA_SHLIB_EXTENSION
  
 diff --git a/ld/configure b/ld/configure
-index e1dbc95747..460078f6e8 100755
+index c197aaef3cb..882263aa43f 100755
 --- a/ld/configure
 +++ b/ld/configure
-@@ -826,6 +826,7 @@ with_lib_path
+@@ -829,6 +829,7 @@ with_lib_path
  enable_targets
  enable_64_bit_bfd
  with_sysroot
@@ -125,8 +130,8 @@ index e1dbc95747..460078f6e8 100755
  enable_gold
  enable_got
  enable_compressed_debug_sections
-@@ -1491,6 +1492,8 @@ Optional Features:
-   --disable-largefile     omit support for large files
+@@ -1498,6 +1499,8 @@ Optional Features:
+   --enable-checking       enable run-time checks
    --enable-targets        alternative target configurations
    --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
 +  --enable-poison-system-directories
@@ -134,7 +139,7 @@ index e1dbc95747..460078f6e8 100755
    --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
    --enable-got=<type>     GOT handling scheme (target, single, negative,
                            multigot)
-@@ -15809,7 +15812,18 @@ else
+@@ -15236,7 +15239,18 @@ else
  fi
  
  
@@ -154,10 +159,10 @@ index e1dbc95747..460078f6e8 100755
  # Check whether --enable-got was given.
  if test "${enable_got+set}" = set; then :
 diff --git a/ld/configure.ac b/ld/configure.ac
-index b5e849d84a..22e022ec03 100644
+index 8ea97c43cd4..0f246db67d8 100644
 --- a/ld/configure.ac
 +++ b/ld/configure.ac
-@@ -94,6 +94,16 @@ AC_SUBST(use_sysroot)
+@@ -106,6 +106,16 @@ AC_SUBST(use_sysroot)
  AC_SUBST(TARGET_SYSTEM_ROOT)
  AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
  
@@ -175,10 +180,10 @@ index b5e849d84a..22e022ec03 100644
  dnl "install_as_default" is set to false if gold is the default linker.
  dnl "installed_linker" is the installed BFD linker name.
 diff --git a/ld/ld.h b/ld/ld.h
-index 71fd781267..a6ea2ae69e 100644
+index 35fafebfaed..4152278b8f4 100644
 --- a/ld/ld.h
 +++ b/ld/ld.h
-@@ -166,6 +166,13 @@ typedef struct
+@@ -162,6 +162,13 @@ typedef struct
       in the linker script.  */
    bool force_group_allocation;
  
@@ -193,10 +198,10 @@ index 71fd781267..a6ea2ae69e 100644
    enum endian_enum endian;
  
 diff --git a/ld/ld.texi b/ld/ld.texi
-index 621d05dc05..cbbbc687d0 100644
+index dd8f571d4e4..0aee4a4e9f1 100644
 --- a/ld/ld.texi
 +++ b/ld/ld.texi
-@@ -2609,6 +2609,24 @@ string identifying the original linked file does not change.
+@@ -2863,6 +2863,24 @@ string identifying the original linked file does not change.
  
  Passing @code{none} for @var{style} disables the setting from any
  @code{--build-id} options earlier on the command line.
@@ -222,7 +227,7 @@ index 621d05dc05..cbbbc687d0 100644
  
  @c man end
 diff --git a/ld/ldfile.c b/ld/ldfile.c
-index 53112c8694..eb357e66a9 100644
+index 9d0af06f1f6..f4a83acca93 100644
 --- a/ld/ldfile.c
 +++ b/ld/ldfile.c
 @@ -117,6 +117,26 @@ ldfile_add_library_path (const char *name, bool cmdline)
@@ -253,10 +258,10 @@ index 53112c8694..eb357e66a9 100644
  
  /* Try to open a BFD for a lang_input_statement.  */
 diff --git a/ld/ldlex.h b/ld/ldlex.h
-index aeaea4dfee..b8d43da37f 100644
+index 9e8bf5fb835..3baed822a22 100644
 --- a/ld/ldlex.h
 +++ b/ld/ldlex.h
-@@ -142,6 +142,9 @@ enum option_values
+@@ -148,6 +148,9 @@ enum option_values
    OPTION_PRINT_OUTPUT_FORMAT,
    OPTION_PRINT_SYSROOT,
    OPTION_IGNORE_UNRESOLVED_SYMBOL,
@@ -267,10 +272,10 @@ index aeaea4dfee..b8d43da37f 100644
    OPTION_POP_STATE,
    OPTION_DISABLE_MULTIPLE_DEFS_ABS,
 diff --git a/ld/ldmain.c b/ld/ldmain.c
-index c3f473f661..c45012dbbd 100644
+index 42660eb9a3c..c78009b760c 100644
 --- a/ld/ldmain.c
 +++ b/ld/ldmain.c
-@@ -273,6 +273,13 @@ main (int argc, char **argv)
+@@ -321,6 +321,13 @@ main (int argc, char **argv)
    command_line.warn_mismatch = true;
    command_line.warn_search_mismatch = true;
    command_line.check_section_addresses = -1;
@@ -285,10 +290,10 @@ index c3f473f661..c45012dbbd 100644
    /* We initialize DEMANGLING based on the environment variable
       COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
 diff --git a/ld/lexsup.c b/ld/lexsup.c
-index c5edc25793..c20c0bb0d8 100644
+index 00274c500d0..a19cce9967c 100644
 --- a/ld/lexsup.c
 +++ b/ld/lexsup.c
-@@ -540,6 +540,18 @@ static const struct ld_option ld_options[] =
+@@ -566,6 +566,18 @@ static const struct ld_option ld_options[] =
      OPTION_IGNORE_UNRESOLVED_SYMBOL},
      '\0', N_("SYMBOL"),
      N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
@@ -307,7 +312,7 @@ index c5edc25793..c20c0bb0d8 100644
    { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
      '\0', NULL, N_("Push state of flags governing input file handling"),
      TWO_DASHES },
-@@ -1563,6 +1575,18 @@ parse_args (unsigned argc, char **argv)
+@@ -1643,6 +1655,18 @@ parse_args (unsigned argc, char **argv)
  	  }
  	  break;
  
@@ -327,5 +332,5 @@ index c5edc25793..c20c0bb0d8 100644
  	  input_flags.pushed = xmemdup (&input_flags,
  					sizeof (input_flags),
 -- 
-2.26.2
+2.31.1
 

diff --git a/9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index a7f8448..4d5ed11 100644
--- a/9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,7 +1,7 @@
-From c11463f5dbeb53c2a600a5b4a3982368ad149ba1 Mon Sep 17 00:00:00 2001
+From 6536761c1e2756ec39fdc33c400757be3744510c Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
-Subject: [PATCH 4/9] Gentoo: libiberty: install PIC version of libiberty.a
+Subject: [PATCH 2/6] Gentoo: libiberty: install PIC version of libiberty.a
 
 This will install a PIC version of libiberty.a by overwriting the non-PIC
 version of libiberty.a while compiling.  We do this because there is no
@@ -18,10 +18,10 @@ general are fairly low, and we'd rather have things work for all of them.
  1 file changed, 1 insertion(+)
 
 diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
-index d6b302e02f..8d84a09f1d 100644
+index d19e14a2aca..cd02be1c2fb 100644
 --- a/libiberty/Makefile.in
 +++ b/libiberty/Makefile.in
-@@ -256,6 +256,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
+@@ -257,6 +257,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
  	  $(AR) $(AR_FLAGS) $(TARGETLIB) \
  	    $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
  	  $(RANLIB) $(TARGETLIB); \
@@ -30,5 +30,5 @@ index d6b302e02f..8d84a09f1d 100644
  	else true; fi; \
  	if [ x"$(NOASANFLAG)" != x ]; then \
 -- 
-2.26.2
+2.31.1
 

diff --git a/9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch b/9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
index d236727..f3c9f8e 100644
--- a/9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
+++ b/9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
@@ -1,7 +1,7 @@
-From b4c9e06c3fb0ede497bcc51dde6c9756efe124ad Mon Sep 17 00:00:00 2001
+From c55536c61ec7e4c2e983e15f51f56f7a7c340889 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 5 Jul 2016 20:24:00 +0545
-Subject: [PATCH 5/9] Gentoo: opcodes: link against libbfd.la for rpath deps
+Subject: [PATCH 3/6] Gentoo: opcodes: link against libbfd.la for rpath deps
 
 The reason opcodes doesn't link against libbfd.la is to workaround a
 libtool bug where it uses installed -L paths ahead of DESTDIR paths.
@@ -19,10 +19,10 @@ URL: https://bugs.gentoo.org/563934
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/opcodes/configure b/opcodes/configure
-index 42be5febad..7b8ee51cc3 100755
+index a3da5987f1b..22a05245286 100755
 --- a/opcodes/configure
 +++ b/opcodes/configure
-@@ -12797,7 +12797,7 @@ if test "$enable_shared" = "yes"; then
+@@ -12142,7 +12142,7 @@ if test "$enable_shared" = "yes"; then
            SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
  	  ;;
  	*)
@@ -32,10 +32,10 @@ index 42be5febad..7b8ee51cc3 100755
        esac
        SHARED_DEPENDENCIES="../bfd/libbfd.la"
 diff --git a/opcodes/configure.ac b/opcodes/configure.ac
-index 00be9c88be..b7a511ac58 100644
+index e564f067334..fb6254cd69d 100644
 --- a/opcodes/configure.ac
 +++ b/opcodes/configure.ac
-@@ -188,7 +188,7 @@ changequote([,])dnl
+@@ -203,7 +203,7 @@ if test "$enable_shared" = "yes"; then
            SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
  	  ;;
  	*)
@@ -45,5 +45,5 @@ index 00be9c88be..b7a511ac58 100644
        esac
        SHARED_DEPENDENCIES="../bfd/libbfd.la"
 -- 
-2.26.2
+2.31.1
 

diff --git a/9999/0006-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0006-Gentoo-add-with-extra-soversion-suffix-option.patch
index d7f696c..1051543 100644
--- a/9999/0006-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0006-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,7 +1,10 @@
-From eefafabed03c163287326afaadc4cc0e5840ea7b Mon Sep 17 00:00:00 2001
+From 235f1f862fb9bf77e2b9f62c24db0ca801c4a057 Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Wed, 12 Sep 2018 23:44:29 +0100
-Subject: [PATCH 6/9] Gentoo: add --with-extra-soversion-suffix= option
+Date: Tue, 20 Jul 2021 21:12:38 +0200
+Subject: [PATCH 4/6] Gentoo: add --with-extra-soversion-suffix= option
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
 
 --with-extra-soversion-suffix= will allow Gentoo to
 distinct libbfd.so and libopcodes.so to have more precise
@@ -21,6 +24,8 @@ built with different flags (see https://bugs.gentoo.org/663690).
 
 Bug: https://bugs.gentoo.org/666100
 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+Ported to binutils 2.37 Andreas K. Hüttel <dilfridge@gentoo.org>
 ---
  bfd/Makefile.am  |  5 +++++
  bfd/Makefile.in  |  4 ++++
@@ -29,7 +34,7 @@ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  4 files changed, 29 insertions(+)
 
 diff --git a/bfd/Makefile.am b/bfd/Makefile.am
-index b6088a3c4a..3f5cf81ca4 100644
+index ed2f701805d..dab3bfc8ed7 100644
 --- a/bfd/Makefile.am
 +++ b/bfd/Makefile.am
 @@ -59,6 +59,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
@@ -41,7 +46,7 @@ index b6088a3c4a..3f5cf81ca4 100644
  # bfd.h goes here, for now
  BFD_H = bfd.h
  
-@@ -958,6 +960,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -952,6 +954,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -52,7 +57,7 @@ index b6088a3c4a..3f5cf81ca4 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/Makefile.in b/bfd/Makefile.in
-index dd3474d92b..911232212b 100644
+index 12807d99760..572df143487 100644
 --- a/bfd/Makefile.in
 +++ b/bfd/Makefile.in
 @@ -318,6 +318,7 @@ ECHO_T = @ECHO_T@
@@ -63,7 +68,7 @@ index dd3474d92b..911232212b 100644
  FGREP = @FGREP@
  GENCAT = @GENCAT@
  GMSGFMT = @GMSGFMT@
-@@ -2071,6 +2072,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+@@ -2063,6 +2064,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
  	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
  	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
  	fi ;\
@@ -74,7 +79,7 @@ index dd3474d92b..911232212b 100644
  	    -e "s,@bfd_version_string@,$$bfd_version_string," \
  	    -e "s,@bfd_version_package@,$$bfd_version_package," \
 diff --git a/bfd/configure b/bfd/configure
-index 59b867bbbf..fa34069f2a 100755
+index 41586f00f93..f0acf160913 100755
 --- a/bfd/configure
 +++ b/bfd/configure
 @@ -696,6 +696,7 @@ WARN_CFLAGS
@@ -85,7 +90,7 @@ index 59b867bbbf..fa34069f2a 100755
  DEBUGDIR
  PLUGINS_FALSE
  PLUGINS_TRUE
-@@ -833,6 +834,7 @@ enable_secureplt
+@@ -835,6 +836,7 @@ enable_secureplt
  enable_separate_code
  enable_leading_mingw64_underscores
  with_separate_debug_dir
@@ -93,7 +98,7 @@ index 59b867bbbf..fa34069f2a 100755
  with_pkgversion
  with_bugurl
  enable_werror
-@@ -1508,6 +1510,8 @@ Optional Packages:
+@@ -1511,6 +1513,8 @@ Optional Packages:
    --with-separate-debug-dir=DIR
                            Look for global separate debug info in DIR
                            [[default=LIBDIR/debug]]
@@ -102,7 +107,7 @@ index 59b867bbbf..fa34069f2a 100755
    --with-pkgversion=PKG   Use PKG in the version string in place of "GNU
                            Binutils"
    --with-bugurl=URL       Direct users to URL to report a bug
-@@ -12516,6 +12520,15 @@ fi
+@@ -11913,6 +11917,15 @@ fi
  
  
  
@@ -119,10 +124,10 @@ index 59b867bbbf..fa34069f2a 100755
  
  # Check whether --with-pkgversion was given.
 diff --git a/bfd/configure.ac b/bfd/configure.ac
-index 0528e54c3b..50b2b4e06e 100644
+index fec067b2135..8c9ef9a04c0 100644
 --- a/bfd/configure.ac
 +++ b/bfd/configure.ac
-@@ -133,6 +133,13 @@ AC_ARG_WITH(separate-debug-dir,
+@@ -169,6 +169,13 @@ AC_ARG_WITH(separate-debug-dir,
  [DEBUGDIR="${withval}"])
  AC_SUBST(DEBUGDIR)
  
@@ -134,8 +139,8 @@ index 0528e54c3b..50b2b4e06e 100644
 +AC_SUBST(EXTRA_SOVERSION_SUFFIX)
 +
  ACX_PKGVERSION([GNU Binutils])
- ACX_BUGURL([http://www.sourceware.org/bugzilla/])
+ ACX_BUGURL([https://www.sourceware.org/bugzilla/])
  
 -- 
-2.26.2
+2.31.1
 

diff --git a/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch b/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
index f16e13d..c6e5299 100644
--- a/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
+++ b/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
@@ -1,7 +1,8 @@
-From 7cefac2aa8ff79d6e2eff1fb4c94346314563fc8 Mon Sep 17 00:00:00 2001
+From f4ecba77ec1eb0576b8731c749336ea3889eba73 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sun, 13 Oct 2019 05:25:28 +0200
-Subject: [PATCH] Gentoo: ld: enable new dtags by default for linux/gnu targets
+Subject: [PATCH 5/6] Gentoo: ld: enable new dtags by default for linux/gnu
+ targets
 
 Original author: Mike Frysinger <vapier@gentoo.org>
 
@@ -23,7 +24,7 @@ and GNU targets, enable them by default.
  1 file changed, 10 insertions(+)
 
 diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
-index 356f34538b..579e52253e 100644
+index bfaf8130a3e..c4c42b7371a 100644
 --- a/ld/emultempl/elf.em
 +++ b/ld/emultempl/elf.em
 @@ -81,6 +81,16 @@ gld${EMULATION_NAME}_before_parse (void)
@@ -44,5 +45,5 @@ index 356f34538b..579e52253e 100644
  EOF
  if test -n "$COMMONPAGESIZE"; then
 -- 
-2.26.2
+2.31.1
 

diff --git a/9999/0009-Gentoo-Pass-hash-style-sysv.patch b/9999/0009-Gentoo-Pass-hash-style-sysv.patch
index 7610d78..41b6a33 100644
--- a/9999/0009-Gentoo-Pass-hash-style-sysv.patch
+++ b/9999/0009-Gentoo-Pass-hash-style-sysv.patch
@@ -1,7 +1,7 @@
-From 2055e278cb6e984760dbf8627efef2158e215449 Mon Sep 17 00:00:00 2001
+From 905bf3c180f4f7fd07024eb9ff7851898593f3f8 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Wed, 18 Oct 2017 00:44:49 +0200
-Subject: Gentoo: Pass --hash-style=sysv to ld in the testsuite
+Date: Tue, 20 Jul 2021 21:15:24 +0200
+Subject: [PATCH 6/6] Gentoo: Pass --hash-style=sysv to ld in the testsuite
 
 ---
  binutils/testsuite/lib/binutils-common.exp |  2 +-
@@ -9,10 +9,10 @@ Subject: Gentoo: Pass --hash-style=sysv to ld in the testsuite
  2 files changed, 15 insertions(+), 3 deletions(-)
 
 diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
-index b9e3c6d817..bb4ef987b3 100644
+index 59e25df99b0..401a05b5c32 100644
 --- a/binutils/testsuite/lib/binutils-common.exp
 +++ b/binutils/testsuite/lib/binutils-common.exp
-@@ -1125,7 +1125,7 @@ proc run_dump_test { name {extra_options {}} } {
+@@ -1279,7 +1279,7 @@ proc run_dump_test { name {extra_options {}} } {
  
  	    # Add -L$srcdir/$subdir so that the linker command can use
  	    # linker scripts in the source directory.
@@ -20,12 +20,12 @@ index b9e3c6d817..bb4ef987b3 100644
 +	    set cmd "$LD --hash-style=sysv $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
  		   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
  
-	    # If needed then check for, or add a -Map option.
+ 	    # If needed then check for, or add a -Map option.
 diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index 015eda6eb9..0b945b539d 100644
+index 8fd14afc63e..adbeaa3bd08 100644
 --- a/ld/testsuite/lib/ld-lib.exp
 +++ b/ld/testsuite/lib/ld-lib.exp
-@@ -165,7 +165,7 @@ proc default_ld_relocate { ld target objects } {
+@@ -167,7 +167,7 @@ proc default_ld_relocate { ld target objects } {
      global HOSTING_EMU
  
      remote_file host delete $target
@@ -34,7 +34,7 @@ index 015eda6eb9..0b945b539d 100644
  }
  
  # Check to see if ld is being invoked with a non-endian output format
-@@ -196,8 +196,20 @@ proc default_ld_link { ld target objects } {
+@@ -198,8 +198,20 @@ proc default_ld_link { ld target objects } {
  	set flags [big_or_little_endian]
      }
  
@@ -57,5 +57,5 @@ index 015eda6eb9..0b945b539d 100644
  
      # We don't care if we get a warning about a non-existent start
 -- 
-2.26.2
+2.31.1
 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2021-07-06  7:04 Sergei Trofimovich
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Trofimovich @ 2021-07-06  7:04 UTC (permalink / raw
  To: gentoo-commits

commit:     1e1ee03c239f2b763a1a37f864f6cb420a5487f0
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  6 06:56:04 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jul  6 07:02:43 2021 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=1e1ee03c

9999: refresh 0009-...-Pass-hash-style-sysv-...patch

Closes: https://bugs.gentoo.org/800254
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 9999/0009-Gentoo-Pass-hash-style-sysv.patch | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/9999/0009-Gentoo-Pass-hash-style-sysv.patch b/9999/0009-Gentoo-Pass-hash-style-sysv.patch
index 8ebb911..7610d78 100644
--- a/9999/0009-Gentoo-Pass-hash-style-sysv.patch
+++ b/9999/0009-Gentoo-Pass-hash-style-sysv.patch
@@ -14,13 +14,13 @@ index b9e3c6d817..bb4ef987b3 100644
 +++ b/binutils/testsuite/lib/binutils-common.exp
 @@ -1125,7 +1125,7 @@ proc run_dump_test { name {extra_options {}} } {
  
-             # Add -L$srcdir/$subdir so that the linker command can use
-             # linker scripts in the source directory.
--            set cmd "$LD $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
-+            set cmd "$LD --hash-style=sysv $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
+ 	    # Add -L$srcdir/$subdir so that the linker command can use
+ 	    # linker scripts in the source directory.
+-	    set cmd "$LD $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
++	    set cmd "$LD --hash-style=sysv $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
  		   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
  
-             # If needed then check for, or add a -Map option.
+	    # If needed then check for, or add a -Map option.
 diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
 index 015eda6eb9..0b945b539d 100644
 --- a/ld/testsuite/lib/ld-lib.exp


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2021-07-06  7:04 Sergei Trofimovich
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Trofimovich @ 2021-07-06  7:04 UTC (permalink / raw
  To: gentoo-commits

commit:     2fb3fe47ca8e417f56687d05fc91a112ae08b813
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  6 06:50:56 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jul  6 07:02:43 2021 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=2fb3fe47

9999: refresh 0007-...-ld-enable-new-dtags-...patch

Closes: https://bugs.gentoo.org/800254
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 ...-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch b/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
index b4c5a74..f16e13d 100644
--- a/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
+++ b/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
@@ -27,20 +27,20 @@ index 356f34538b..579e52253e 100644
 --- a/ld/emultempl/elf.em
 +++ b/ld/emultempl/elf.em
 @@ -81,6 +81,16 @@ gld${EMULATION_NAME}_before_parse (void)
-   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
-   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
-   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
+   input_flags.dynamic = ${DYNAMIC_LINK-true};
+   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
+   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
 +EOF
 +
 +case ${target} in
 +  *-*-linux-* | *-*-k*bsd*-* | *-*-gnu* | *-*-nacl*)
 +    fragment <<EOF
-+  link_info.new_dtags = TRUE;
++  link_info.new_dtags = true;
 +EOF
 +    ;;
 +esac
 +fragment <<EOF
-   link_info.check_relocs_after_open_input = TRUE;
+   link_info.check_relocs_after_open_input = true;
  EOF
  if test -n "$COMMONPAGESIZE"; then
 -- 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2021-07-06  7:04 Sergei Trofimovich
  0 siblings, 0 replies; 51+ messages in thread
From: Sergei Trofimovich @ 2021-07-06  7:04 UTC (permalink / raw
  To: gentoo-commits

commit:     da0c7a071390e6bda1d5fb8c31ce3ff37671db7e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  6 07:00:56 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jul  6 07:02:43 2021 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=da0c7a07

9999: refresh 0003-...-poisoned-system-direc-...patch

Closes: https://bugs.gentoo.org/800254
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 ...-ld-add-support-for-poisoned-system-direc.patch | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index 1446352..964946c 100644
--- a/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -180,14 +180,14 @@ index 71fd781267..a6ea2ae69e 100644
 +++ b/ld/ld.h
 @@ -166,6 +166,13 @@ typedef struct
       in the linker script.  */
-   bfd_boolean force_group_allocation;
+   bool force_group_allocation;
  
-+  /* If TRUE warn for uses of system directories when cross linking.  */
-+  bfd_boolean warn_poison_system_directories;
++  /* If true warn for uses of system directories when cross linking.  */
++  bool warn_poison_system_directories;
 +
-+  /* If TRUE (default FALSE) give an error for uses of system
++  /* If true (default false) give an error for uses of system
 +     directories when cross linking instead of a warning.  */
-+  bfd_boolean error_poison_system_directories;
++  bool error_poison_system_directories;
 +
    /* Big or little endian as set on command line.  */
    enum endian_enum endian;
@@ -225,7 +225,7 @@ diff --git a/ld/ldfile.c b/ld/ldfile.c
 index 53112c8694..eb357e66a9 100644
 --- a/ld/ldfile.c
 +++ b/ld/ldfile.c
-@@ -117,6 +117,26 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
+@@ -117,6 +117,26 @@ ldfile_add_library_path (const char *name, bool cmdline)
      new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
    else
      new_dirs->name = xstrdup (name);
@@ -271,16 +271,16 @@ index c3f473f661..c45012dbbd 100644
 --- a/ld/ldmain.c
 +++ b/ld/ldmain.c
 @@ -273,6 +273,13 @@ main (int argc, char **argv)
-   command_line.warn_mismatch = TRUE;
-   command_line.warn_search_mismatch = TRUE;
+   command_line.warn_mismatch = true;
+   command_line.warn_search_mismatch = true;
    command_line.check_section_addresses = -1;
 +  command_line.warn_poison_system_directories =
 +#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
-+    TRUE;
++    true;
 +#else
-+    FALSE;
++    false;
 +#endif
-+  command_line.error_poison_system_directories = FALSE;
++  command_line.error_poison_system_directories = false;
  
    /* We initialize DEMANGLING based on the environment variable
       COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
@@ -312,15 +312,15 @@ index c5edc25793..c20c0bb0d8 100644
  	  break;
  
 +   case OPTION_WARN_POISON_SYSTEM_DIRECTORIES:
-+     command_line.warn_poison_system_directories = TRUE;
++     command_line.warn_poison_system_directories = true;
 +     break;
 +
 +   case OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES:
-+     command_line.warn_poison_system_directories = FALSE;
++     command_line.warn_poison_system_directories = false;
 +     break;
 +
 +   case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
-+     command_line.error_poison_system_directories = TRUE;
++     command_line.error_poison_system_directories = true;
 +     break;
 +
  	case OPTION_PUSH_STATE:


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2020-07-25 17:27 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2020-07-25 17:27 UTC (permalink / raw
  To: gentoo-commits

commit:     f9c7687232df3334a7191920915e2d9ab27b133b
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 25 17:26:51 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 25 17:26:51 2020 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=f9c76872

Update patch for zero fuzz

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch b/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
index 0b0cbfe..b4c5a74 100644
--- a/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
+++ b/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
@@ -1,8 +1,7 @@
-From cf8983d602c56eb31ee0e356df670d9c2876ce15 Mon Sep 17 00:00:00 2001
+From 7cefac2aa8ff79d6e2eff1fb4c94346314563fc8 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sun, 13 Oct 2019 05:25:28 +0200
-Subject: [PATCH 7/9] Gentoo: ld: enable new dtags by default for linux/gnu
- targets
+Subject: [PATCH] Gentoo: ld: enable new dtags by default for linux/gnu targets
 
 Original author: Mike Frysinger <vapier@gentoo.org>
 
@@ -24,7 +23,7 @@ and GNU targets, enable them by default.
  1 file changed, 10 insertions(+)
 
 diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
-index eac2ce2f4c..7f92134070 100644
+index 356f34538b..579e52253e 100644
 --- a/ld/emultempl/elf.em
 +++ b/ld/emultempl/elf.em
 @@ -81,6 +81,16 @@ gld${EMULATION_NAME}_before_parse (void)
@@ -42,8 +41,8 @@ index eac2ce2f4c..7f92134070 100644
 +esac
 +fragment <<EOF
    link_info.check_relocs_after_open_input = TRUE;
-   link_info.relro = DEFAULT_LD_Z_RELRO;
-   link_info.separate_code = DEFAULT_LD_Z_SEPARATE_CODE;
+ EOF
+ if test -n "$COMMONPAGESIZE"; then
 -- 
 2.26.2
 


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2020-07-25 12:26 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2020-07-25 12:26 UTC (permalink / raw
  To: gentoo-commits

commit:     a74c34d8ec1f197f9c80861e0d6271ac63403993
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 25 12:25:51 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 25 12:25:51 2020 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=a74c34d8

Textrel warnings have been enabled upstream, drop patches (3)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...red-textr.patch => 0009-Gentoo-Pass-hash-style-sysv.patch} | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/9999/0009-Gentoo-Pass-hash-style-sysv-and-no-warn-shared-textr.patch b/9999/0009-Gentoo-Pass-hash-style-sysv.patch
similarity index 85%
rename from 9999/0009-Gentoo-Pass-hash-style-sysv-and-no-warn-shared-textr.patch
rename to 9999/0009-Gentoo-Pass-hash-style-sysv.patch
index 4ff406f..8ebb911 100644
--- a/9999/0009-Gentoo-Pass-hash-style-sysv-and-no-warn-shared-textr.patch
+++ b/9999/0009-Gentoo-Pass-hash-style-sysv.patch
@@ -1,8 +1,7 @@
 From 2055e278cb6e984760dbf8627efef2158e215449 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Wed, 18 Oct 2017 00:44:49 +0200
-Subject: [PATCH 9/9] Gentoo: Pass --hash-style=sysv and
- --no-warn-shared-textrel to ld in the testsuite
+Subject: Gentoo: Pass --hash-style=sysv to ld in the testsuite
 
 ---
  binutils/testsuite/lib/binutils-common.exp |  2 +-
@@ -18,7 +17,7 @@ index b9e3c6d817..bb4ef987b3 100644
              # Add -L$srcdir/$subdir so that the linker command can use
              # linker scripts in the source directory.
 -            set cmd "$LD $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
-+            set cmd "$LD --hash-style=sysv --no-warn-shared-textrel $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
++            set cmd "$LD --hash-style=sysv $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
  		   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
  
              # If needed then check for, or add a -Map option.
@@ -31,7 +30,7 @@ index 015eda6eb9..0b945b539d 100644
  
      remote_file host delete $target
 -    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
-+    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv --no-warn-shared-textrel -o $target -r $objects"]
++    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv -o $target -r $objects"]
  }
  
  # Check to see if ld is being invoked with a non-endian output format
@@ -46,9 +45,9 @@ index 015eda6eb9..0b945b539d 100644
 +    # - ld-new         -> we're working with the new linker
 +    # - otherwise      -> we're likely working with the system compiler
 +    if {[regexp {ld-new$} $ld]} {
-+      set gentoosysv "--hash-style=sysv --no-warn-shared-textrel"
++      set gentoosysv "--hash-style=sysv"
 +    } else {
-+      set gentoosysv "-Wl,--hash-style=sysv -Wl,--no-warn-shared-textrel"
++      set gentoosysv "-Wl,--hash-style=sysv"
 +    }
 +
      remote_file host delete $target


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2020-07-25 12:23 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2020-07-25 12:23 UTC (permalink / raw
  To: gentoo-commits

commit:     e4b8746852919960969944904c59334cecddfe25
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 25 12:23:12 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 25 12:23:12 2020 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=e4b87468

Textrel warnings have been enabled upstream, drop patches (2)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...ore-TEXTREL-warnings-for-non-shared-objec.patch | 45 ----------------------
 1 file changed, 45 deletions(-)

diff --git a/9999/0008-Gentoo-Restore-TEXTREL-warnings-for-non-shared-objec.patch b/9999/0008-Gentoo-Restore-TEXTREL-warnings-for-non-shared-objec.patch
deleted file mode 100644
index 8e0e091..0000000
--- a/9999/0008-Gentoo-Restore-TEXTREL-warnings-for-non-shared-objec.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 74afb38257f4a35d681883348ef54317674827e3 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Thu, 1 Mar 2018 12:35:03 +0100
-Subject: [PATCH 8/9] Gentoo: Restore TEXTREL warnings for non-shared objects
-
----
- bfd/elflink.c                | 4 ++--
- ld/testsuite/ld-i386/warn1.d | 2 +-
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/bfd/elflink.c b/bfd/elflink.c
-index 90ada7a1cc..b4636885aa 100644
---- a/bfd/elflink.c
-+++ b/bfd/elflink.c
-@@ -12934,7 +12934,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
- 	goto error_return;
- 
-       /* Check for DT_TEXTREL (late, in case the backend removes it).  */
--      if (((info->warn_shared_textrel && bfd_link_pic (info))
-+      if ((info->warn_shared_textrel
- 	   || info->error_textrel)
- 	  && (o = bfd_get_linker_section (dynobj, ".dynamic")) != NULL)
- 	{
-@@ -12955,7 +12955,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
- 		      (_("%P%X: read-only segment has dynamic relocations\n"));
- 		  else
- 		    info->callbacks->einfo
--		      (_("%P: warning: creating a DT_TEXTREL in a shared object\n"));
-+		      (_("%P: warning: creating a DT_TEXTREL in object\n"));
- 		  break;
- 		}
- 	    }
-diff --git a/ld/testsuite/ld-i386/warn1.d b/ld/testsuite/ld-i386/warn1.d
-index 3c78f31efd..49bcb5171f 100644
---- a/ld/testsuite/ld-i386/warn1.d
-+++ b/ld/testsuite/ld-i386/warn1.d
-@@ -1,4 +1,4 @@
- #name: --warn-shared-textrel --fatal-warnings
- #as: --32
- #ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
--#error: .*warning: creating a DT_TEXTREL in a shared object
-+#error: .*warning: creating a DT_TEXTREL in object
--- 
-2.26.2
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2020-07-25 12:20 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2020-07-25 12:20 UTC (permalink / raw
  To: gentoo-commits

commit:     47b8db23ff55dd29992198dfbadda53984a4ab2d
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 25 12:20:24 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Jul 25 12:20:24 2020 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=47b8db23

Textrel warnings have been enabled upstream, drop patches

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...oo-ld-always-warn-about-textrels-in-files.patch | 30 ----------
 ...an-option-no-warn-shared-textrel-self-exp.patch | 66 ----------------------
 2 files changed, 96 deletions(-)

diff --git a/9999/0001-Gentoo-ld-always-warn-about-textrels-in-files.patch b/9999/0001-Gentoo-ld-always-warn-about-textrels-in-files.patch
deleted file mode 100644
index d60b0a1..0000000
--- a/9999/0001-Gentoo-ld-always-warn-about-textrels-in-files.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 5e2144e41600a83f6127eb44d739ed170d78ac7f Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Mon, 16 May 2005 22:10:19 -0400
-Subject: [PATCH 1/9] Gentoo: ld: always warn about textrels in files
-
-textrels are bad for forcing copy-on-write (this affects everyone), and for
-security/runtime code generation, this affects security ppl.  But in either
-case, it doesn't matter who needs textrels, it's the very fact that they're
-needed at all.
-
-(cherry picked from commit cd6411ad57aab78686f67cbbc1ed70ee810ad335)
----
- ld/ldmain.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/ld/ldmain.c b/ld/ldmain.c
-index 04a3f7a511..c3f473f661 100644
---- a/ld/ldmain.c
-+++ b/ld/ldmain.c
-@@ -299,6 +299,7 @@ main (int argc, char **argv)
-   link_info.dynamic_undefined_weak = -1;
-   link_info.pei386_auto_import = -1;
-   link_info.spare_dynamic_tags = 5;
-+  link_info.warn_shared_textrel = TRUE;
-   link_info.path_separator = ':';
- #ifdef DEFAULT_FLAG_COMPRESS_DEBUG
-   link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
--- 
-2.26.2
-

diff --git a/9999/0002-Gentoo-Add-an-option-no-warn-shared-textrel-self-exp.patch b/9999/0002-Gentoo-Add-an-option-no-warn-shared-textrel-self-exp.patch
deleted file mode 100644
index 5457b83..0000000
--- a/9999/0002-Gentoo-Add-an-option-no-warn-shared-textrel-self-exp.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 19ecd671bddd33f3afff169f26c55101c90c4afc Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Sun, 3 Jun 2018 21:12:16 +0200
-Subject: [PATCH 2/9] Gentoo: Add an option --no-warn-shared-textrel
- (self-explanatory)
-
----
- ld/ld.texi  | 4 ++++
- ld/ldlex.h  | 1 +
- ld/lexsup.c | 6 ++++++
- 3 files changed, 11 insertions(+)
-
-diff --git a/ld/ld.texi b/ld/ld.texi
-index 4dc78e65fa..621d05dc05 100644
---- a/ld/ld.texi
-+++ b/ld/ld.texi
-@@ -2408,6 +2408,10 @@ the section (@pxref{SECTIONS}).
- @item --warn-shared-textrel
- Warn if the linker adds a DT_TEXTREL to a shared object.
- 
-+@kindex --no-warn-shared-textrel
-+@item --no-warn-shared-textrel
-+Do not warn if the linker adds a DT_TEXTREL to a shared object.
-+
- @kindex --warn-alternate-em
- @item --warn-alternate-em
- Warn if an object has alternate ELF machine code.
-diff --git a/ld/ldlex.h b/ld/ldlex.h
-index 22b928d2d9..aeaea4dfee 100644
---- a/ld/ldlex.h
-+++ b/ld/ldlex.h
-@@ -131,6 +131,7 @@ enum option_values
-   OPTION_WARN_UNRESOLVED_SYMBOLS,
-   OPTION_ERROR_UNRESOLVED_SYMBOLS,
-   OPTION_WARN_SHARED_TEXTREL,
-+  OPTION_NO_WARN_SHARED_TEXTREL,
-   OPTION_WARN_ALTERNATE_EM,
-   OPTION_REDUCE_MEMORY_OVERHEADS,
- #ifdef ENABLE_PLUGINS
-diff --git a/ld/lexsup.c b/ld/lexsup.c
-index c02041d5f1..c5edc25793 100644
---- a/ld/lexsup.c
-+++ b/ld/lexsup.c
-@@ -519,6 +519,9 @@ static const struct ld_option ld_options[] =
-   { {"warn-shared-textrel", no_argument, NULL, OPTION_WARN_SHARED_TEXTREL},
-     '\0', NULL, N_("Warn if shared object has DT_TEXTREL"),
-     TWO_DASHES },
-+  { {"no-warn-shared-textrel", no_argument, NULL, OPTION_NO_WARN_SHARED_TEXTREL},
-+    '\0', NULL, N_("Do not warn if shared object has DT_TEXTREL"),
-+    TWO_DASHES },
-   { {"warn-alternate-em", no_argument, NULL, OPTION_WARN_ALTERNATE_EM},
-     '\0', NULL, N_("Warn if an object has alternate ELF machine code"),
-     TWO_DASHES },
-@@ -1449,6 +1452,9 @@ parse_args (unsigned argc, char **argv)
- 	case OPTION_WARN_SHARED_TEXTREL:
- 	  link_info.warn_shared_textrel = TRUE;
- 	  break;
-+	case OPTION_NO_WARN_SHARED_TEXTREL:
-+	  link_info.warn_shared_textrel = FALSE;
-+	  break;
- 	case OPTION_WARN_ALTERNATE_EM:
- 	  link_info.warn_alternate_em = TRUE;
- 	  break;
--- 
-2.26.2
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread
* [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/
@ 2020-05-19 21:12 Andreas K. Hüttel
  0 siblings, 0 replies; 51+ messages in thread
From: Andreas K. Hüttel @ 2020-05-19 21:12 UTC (permalink / raw
  To: gentoo-commits

commit:     b3b149f3d1d004f29ce9b3fdf1a636aae92c5d6f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue May 19 21:10:06 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 19 21:11:57 2020 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=b3b149f3

Consolidate patches

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 ...oo-ld-always-warn-about-textrels-in-files.patch |   2 +-
 ...an-option-no-warn-shared-textrel-self-exp.patch |   2 +-
 ...-ld-add-support-for-poisoned-system-direc.patch |   2 +-
 ...iberty-install-PIC-version-of-libiberty.a.patch |   2 +-
 ...des-link-against-libbfd.la-for-rpath-deps.patch |   2 +-
 ...ss-hash-style-sysv-to-ld-in-its-testsuite.patch | 807 ---------------------
 ...o-add-with-extra-soversion-suffix-option.patch} |   4 +-
 ...-no-warn-shared-textrel-to-ld-in-its-test.patch |  47 --
 ...able-new-dtags-by-default-for-linux-gnu-.patch} |   4 +-
 ...ore-TEXTREL-warnings-for-non-shared-objec.patch |  19 +-
 ...test-for-precise-textrel-warning-message-.patch |  24 -
 ...-hash-style-sysv-and-no-warn-shared-textr.patch |  62 ++
 ...10-Gentoo-Fix-textrel-warning-format-test.patch |  22 -
 ...entoo-Add-patch-tarball-generation-script.patch | 217 ------
 ...ve-block-mistakenly-duplicated-in-1222895.patch | 777 --------------------
 ...t-generic-test-library-to-our-linker-sett.patch |  26 -
 ...regexp-of-hilarious-ld-detection-heuristi.patch |  30 -
 17 files changed, 86 insertions(+), 1963 deletions(-)

diff --git a/9999/0001-Gentoo-ld-always-warn-about-textrels-in-files.patch b/9999/0001-Gentoo-ld-always-warn-about-textrels-in-files.patch
index 83377a5..d60b0a1 100644
--- a/9999/0001-Gentoo-ld-always-warn-about-textrels-in-files.patch
+++ b/9999/0001-Gentoo-ld-always-warn-about-textrels-in-files.patch
@@ -1,7 +1,7 @@
 From 5e2144e41600a83f6127eb44d739ed170d78ac7f Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Mon, 16 May 2005 22:10:19 -0400
-Subject: [PATCH 01/16] Gentoo: ld: always warn about textrels in files
+Subject: [PATCH 1/9] Gentoo: ld: always warn about textrels in files
 
 textrels are bad for forcing copy-on-write (this affects everyone), and for
 security/runtime code generation, this affects security ppl.  But in either

diff --git a/9999/0002-Gentoo-Add-an-option-no-warn-shared-textrel-self-exp.patch b/9999/0002-Gentoo-Add-an-option-no-warn-shared-textrel-self-exp.patch
index 7786ab3..5457b83 100644
--- a/9999/0002-Gentoo-Add-an-option-no-warn-shared-textrel-self-exp.patch
+++ b/9999/0002-Gentoo-Add-an-option-no-warn-shared-textrel-self-exp.patch
@@ -1,7 +1,7 @@
 From 19ecd671bddd33f3afff169f26c55101c90c4afc Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sun, 3 Jun 2018 21:12:16 +0200
-Subject: [PATCH 02/16] Gentoo: Add an option --no-warn-shared-textrel
+Subject: [PATCH 2/9] Gentoo: Add an option --no-warn-shared-textrel
  (self-explanatory)
 
 ---

diff --git a/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch b/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
index 3349c0e..1446352 100644
--- a/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
+++ b/9999/0003-Gentoo-gold-ld-add-support-for-poisoned-system-direc.patch
@@ -1,7 +1,7 @@
 From c251ab646d98b3f0e8f8b1ae5e94c672325477e2 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 10 Oct 2017 22:53:53 +0200
-Subject: [PATCH 03/16] Gentoo: gold/ld: add support for poisoned system
+Subject: [PATCH 3/9] Gentoo: gold/ld: add support for poisoned system
  directories
 
 This is based on the old CodeSourcery patch written by Joseph Myers to add

diff --git a/9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch b/9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
index 54e5fdf..a7f8448 100644
--- a/9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
+++ b/9999/0004-Gentoo-libiberty-install-PIC-version-of-libiberty.a.patch
@@ -1,7 +1,7 @@
 From c11463f5dbeb53c2a600a5b4a3982368ad149ba1 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Fri, 7 Jan 2005 00:15:53 -0500
-Subject: [PATCH 04/16] Gentoo: libiberty: install PIC version of libiberty.a
+Subject: [PATCH 4/9] Gentoo: libiberty: install PIC version of libiberty.a
 
 This will install a PIC version of libiberty.a by overwriting the non-PIC
 version of libiberty.a while compiling.  We do this because there is no

diff --git a/9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch b/9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
index 2ec1013..d236727 100644
--- a/9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
+++ b/9999/0005-Gentoo-opcodes-link-against-libbfd.la-for-rpath-deps.patch
@@ -1,7 +1,7 @@
 From b4c9e06c3fb0ede497bcc51dde6c9756efe124ad Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <vapier@gentoo.org>
 Date: Tue, 5 Jul 2016 20:24:00 +0545
-Subject: [PATCH 05/16] Gentoo: opcodes: link against libbfd.la for rpath deps
+Subject: [PATCH 5/9] Gentoo: opcodes: link against libbfd.la for rpath deps
 
 The reason opcodes doesn't link against libbfd.la is to workaround a
 libtool bug where it uses installed -L paths ahead of DESTDIR paths.

diff --git a/9999/0006-Gentoo-Pass-hash-style-sysv-to-ld-in-its-testsuite.patch b/9999/0006-Gentoo-Pass-hash-style-sysv-to-ld-in-its-testsuite.patch
deleted file mode 100644
index 30f207b..0000000
--- a/9999/0006-Gentoo-Pass-hash-style-sysv-to-ld-in-its-testsuite.patch
+++ /dev/null
@@ -1,807 +0,0 @@
-From 65535cdfae964cce89a7c03ad720f80c61e09217 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Wed, 18 Oct 2017 00:44:49 +0200
-Subject: [PATCH 06/16] Gentoo: Pass --hash-style=sysv to ld in its testsuite
-
----
- ld/testsuite/lib/ld-lib.exp | 769 +++++++++++++++++++++++++++++++++++-
- 1 file changed, 767 insertions(+), 2 deletions(-)
-
-diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index 015eda6eb9..853a4d87e6 100644
---- a/ld/testsuite/lib/ld-lib.exp
-+++ b/ld/testsuite/lib/ld-lib.exp
-@@ -165,7 +165,7 @@ proc default_ld_relocate { ld target objects } {
-     global HOSTING_EMU
- 
-     remote_file host delete $target
--    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
-+    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv -o $target -r $objects"]
- }
- 
- # Check to see if ld is being invoked with a non-endian output format
-@@ -196,8 +196,20 @@ proc default_ld_link { ld target objects } {
- 	set flags [big_or_little_endian]
-     }
- 
-+    # Hilariously, this procedure is called sometimes with $CC and sometimes
-+    # with $ld as parameter. If we want to change the default behaviour, we
-+    # need to take the different option formats into account.
-+    # We check the $ld parameter for
-+    # - .*ld/ld-new    -> we're working with the new linker
-+    # - otherwise      -> we're likely working with the system compiler
-+    if {[regexp {ld/ld-new$} $ld]} {
-+      set gentoosysv "--hash-style=sysv"
-+    } else {
-+      set gentoosysv "-Wl,--hash-style=sysv"
-+    }
-+
-     remote_file host delete $target
--    set exec_output [run_host_cmd "$ld" "$flags -o $target $objects"]
-+    set exec_output [run_host_cmd "$ld" "$gentoosysv $flags -o $target $objects"]
-     set exec_output [prune_warnings $exec_output]
- 
-     # We don't care if we get a warning about a non-existent start
-@@ -409,6 +421,759 @@ proc ld_link_defsyms {} {
-     return $flags
- }
- 
-+# run_dump_test FILE (optional:) EXTRA_OPTIONS
-+# Copied from gas testsuite, tweaked and further extended.
-+#
-+# Assemble a .s file, then run some utility on it and check the output.
-+#
-+# There should be an assembly language file named FILE.s in the test
-+# suite directory, and a pattern file called FILE.d.  `run_dump_test'
-+# will assemble FILE.s, run some tool like `objdump', `objcopy', or
-+# `nm' on the .o file to produce textual output, and then analyze that
-+# with regexps.  The FILE.d file specifies what program to run, and
-+# what to expect in its output.
-+#
-+# The FILE.d file begins with zero or more option lines, which specify
-+# flags to pass to the assembler, the program to run to dump the
-+# assembler's output, and the options it wants.  The option lines have
-+# the syntax:
-+#
-+#         # OPTION: VALUE
-+#
-+# OPTION is the name of some option, like "name" or "objdump", and
-+# VALUE is OPTION's value.  The valid options are described below.
-+# Whitespace is ignored everywhere, except within VALUE.  The option
-+# list ends with the first line that doesn't match the above syntax
-+# (hmm, not great for error detection).
-+#
-+# The optional EXTRA_OPTIONS argument to `run_dump_test' is a list of
-+# two-element lists.  The first element of each is an option name, and
-+# the second additional arguments to be added on to the end of the
-+# option list as given in FILE.d.  (If omitted, no additional options
-+# are added.)
-+#
-+# The interesting options are:
-+#
-+#   name: TEST-NAME
-+#	The name of this test, passed to DejaGNU's `pass' and `fail'
-+#       commands.  If omitted, this defaults to FILE, the root of the
-+#       .s and .d files' names.
-+#
-+#   as: FLAGS
-+#	When assembling, pass FLAGS to the assembler.
-+#       If assembling several files, you can pass different assembler
-+#       options in the "source" directives.  See below.
-+#
-+#   ld: FLAGS
-+#       Link assembled files using FLAGS, in the order of the "source"
-+#       directives, when using multiple files.
-+#
-+#   ld_after_inputfiles: FLAGS
-+#       Similar to "ld", but put after all input files.
-+#
-+#   objcopy_objects: FLAGS
-+#	Run objcopy with the specified flags after assembling any source
-+#	that has the special marker RUN_OBJCOPY in the source specific
-+#	flags.
-+#
-+#   objcopy_linked_file: FLAGS
-+#	Run objcopy on the linked file with the specified flags.
-+#	This lets you transform the linked file using objcopy, before the
-+#	result is analyzed by an analyzer program specified below (which
-+#	may in turn *also* be objcopy).
-+#
-+#   PROG: PROGRAM-NAME
-+#       The name of the program to run to analyze the .o file produced
-+#       by the assembler or the linker output.  This can be omitted;
-+#       run_dump_test will guess which program to run by seeing which of
-+#       the flags options below is present.
-+#
-+#   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
-+#	consistent sorting of symbols.
-+#
-+#   source: SOURCE [FLAGS]
-+#	Assemble the file SOURCE.s using the flags in the "as" directive
-+#       and the (optional) FLAGS.  If omitted, the source defaults to
-+#       FILE.s.
-+#       This is useful if several .d files want to share a .s file.
-+#       More than one "source" directive can be given, which is useful
-+#       when testing linking.
-+#
-+#   dump: DUMP
-+#	Match against DUMP.d.  If omitted, this defaults to FILE.d.  This
-+#	is useful if several .d files differ by options only.  Options are
-+#	always read from FILE.d.
-+#
-+#   xfail: TARGET
-+#       The test is expected to fail on TARGET.  This may occur more than
-+#       once.
-+#
-+#   target: TARGET
-+#	Only run the test for TARGET.
-+#	You may provide target name "cfi" for any target supporting the
-+#	CFI statements.  You may provide target name "shared" for any
-+#	target supporting shared libraries.  Otherwise TARGET is called
-+#	as a TCL procedure if surrounded by square brackets, or passed
-+#	to "istarget" if not.
-+#	This may occur more than once; the target being tested must match
-+#	at least one.  Otherwise the test will be marked unsupported.
-+#
-+#   alltargets: TARGET
-+#	Only run the test for TARGET.
-+#	The syntax for TARGET is as with 'target'.
-+#	This may occur more than once; the target being tested must match
-+#	all of them.  Otherwise the test will be marked unsupported.
-+#
-+#   notarget: TARGET
-+#	Do not run the test for TARGET.
-+#	The syntax for TARGET is as with 'target'.
-+#	This may occur more than once; the target being tested must not
-+#	match any of them.  Otherwise the test will be marked unsupported.
-+#
-+#   skip: TARGET
-+#   anyskip: TARGET
-+#   noskip: TARGET
-+#	These are exactly the same as "notarget", "alltargets" and
-+#	"target" respectively, except that they do nothing at all if the
-+#	check fails.  They should only be used in groups, to construct a
-+#	single test which is run on all targets but with variant options
-+#	or expected output on some targets.  (For example, see
-+#	gas/arm/inst.d and gas/arm/wince_inst.d.)
-+#
-+#   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
-+#	no meaning and need not be supplied if this is present.  Multiple
-+#	"error" directives append to the expected linker error message.
-+#
-+#   error_output: FILE
-+#       Means the same as 'error', except the regular expression lines
-+#       are contains in FILE.
-+#
-+#   warning: REGEX
-+#	Expect a linker warning matching REGEX.  It is an error to issue
-+#	both "error" and "warning".  Multiple "warning" directives
-+#	append to the expected linker warning message.
-+#
-+#   warning_output: FILE
-+#       Means the same as 'warning', except the regular expression
-+#       lines are contains in FILE.
-+#
-+#   map: FILE
-+#       Adding this option will cause the linker to generate a linker
-+#       map file, using the -Map=MAPFILE command line option.  If
-+#       there is no -Map=MAPFILE in the 'ld: FLAGS' then one will be
-+#       added to the linker command line.  The contents of the
-+#       generated MAPFILE are then compared against the regexp lines
-+#       in FILE using `regexp_diff' (see below for details).
-+#
-+# Each option may occur at most once unless otherwise mentioned.
-+#
-+# After the option lines come regexp lines.  `run_dump_test' calls
-+# `regexp_diff' to compare the output of the dumping tool against the
-+# regexps in FILE.d.  `regexp_diff' is defined in binutils-common.exp;
-+# see further comments there.
-+#
-+proc run_dump_test { name {extra_options {}} } {
-+    global subdir srcdir
-+    global OBJDUMP NM AS OBJCOPY READELF LD
-+    global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS LDFLAGS
-+    global host_triplet runtests
-+    global env verbose
-+    global ld_elf_shared_opt
-+
-+    if { [is_elf_format] && [check_shared_lib_support] } {
-+	set ld_extra_opt "$ld_elf_shared_opt"
-+    } else {
-+	set ld_extra_opt ""
-+    }
-+
-+    if [string match "*/*" $name] {
-+	set file $name
-+	set name [file tail $name]
-+    } else {
-+	set file "$srcdir/$subdir/$name"
-+    }
-+
-+    if ![runtest_file_p $runtests $name] then {
-+	return
-+    }
-+
-+    set opt_array [slurp_options "${file}.d"]
-+    if { $opt_array == -1 } {
-+	perror "error reading options from $file.d"
-+	unresolved $subdir/$name
-+	return
-+    }
-+    set dumpfile tmpdir/dump.out
-+    set run_ld 0
-+    set run_objcopy 0
-+    set objfile_names {}
-+    set opts(as) {}
-+    set opts(ld) {}
-+    set opts(ld_after_inputfiles) {}
-+    set opts(xfail) {}
-+    set opts(target) {}
-+    set opts(alltargets) {}
-+    set opts(notarget) {}
-+    set opts(skip) {}
-+    set opts(anyskip) {}
-+    set opts(noskip) {}
-+    set opts(objdump) {}
-+    set opts(nm) {}
-+    set opts(objcopy) {}
-+    set opts(readelf) {}
-+    set opts(name) {}
-+    set opts(PROG) {}
-+    set opts(source) {}
-+    set opts(dump) {}
-+    set opts(error) {}
-+    set opts(warning) {}
-+    set opts(error_output) {}
-+    set opts(warning_output) {}
-+    set opts(objcopy_linked_file) {}
-+    set opts(objcopy_objects) {}
-+    set opts(map) {}
-+
-+    foreach i $opt_array {
-+	set opt_name [lindex $i 0]
-+	set opt_val [lindex $i 1]
-+	if ![info exists opts($opt_name)] {
-+	    perror "unknown option $opt_name in file $file.d"
-+	    unresolved $subdir/$name
-+	    return
-+	}
-+
-+	switch -- $opt_name {
-+	    xfail {}
-+	    target {}
-+	    alltargets {}
-+	    notarget {}
-+	    skip {}
-+	    anyskip {}
-+	    noskip {}
-+	    warning {}
-+	    error {}
-+	    source {
-+		# Move any source-specific as-flags to a separate list to
-+		# simplify processing.
-+		if { [llength $opt_val] > 1 } {
-+		    lappend asflags [lrange $opt_val 1 end]
-+		    set opt_val [lindex $opt_val 0]
-+		} else {
-+		    lappend asflags {}
-+		}
-+
-+                # Create the object file name based on nothing but the source
-+                # file name.
-+                set new_objfile \
-+                    [concat tmpdir/[file rootname [file tail [lindex $opt_val 0]]].o]
-+                # But, sometimes, we have the exact same source filename in
-+                # different directories (foo/src.s bar/src.s) which would lead
-+                # us to try and create two src.o files.  We detect this
-+                # conflict here, and instead create src.o and src1.o.
-+                set j 0
-+                while { [lsearch $objfile_names $new_objfile] != -1 } {
-+                    incr j
-+                    set new_objfile \
-+                        [concat tmpdir/[file rootname [file tail  [lindex $opt_val 0]]]${j}.o]
-+                }
-+		lappend objfile_names $new_objfile
-+	    }
-+	    default {
-+		if [string length $opts($opt_name)] {
-+		    perror "option $opt_name multiply set in $file.d"
-+		    unresolved $subdir/$name
-+		    return
-+		}
-+
-+		# A single "# ld:" with no options should do the right thing.
-+		if { $opt_name == "ld" } {
-+		    set run_ld 1
-+		}
-+		# Likewise objcopy_linked_file.
-+		if { $opt_name == "objcopy_linked_file" } {
-+		    set run_objcopy 1
-+		}
-+	    }
-+	}
-+	if { $opt_name == "as" || $opt_name == "ld" } {
-+	    set opt_val [subst $opt_val]
-+	}
-+
-+	# Append differently whether it's a message (without space) or
-+	# an option or list (with space).
-+	switch -- $opt_name {
-+	    warning -
-+	    error {
-+		append opts($opt_name) $opt_val
-+	    }
-+	    default {
-+		set opts($opt_name) [concat $opts($opt_name) $opt_val]
-+	    }
-+	}
-+    }
-+
-+    foreach i $extra_options {
-+	set opt_name [lindex $i 0]
-+	set opt_val [lindex $i 1]
-+	if ![info exists opts($opt_name)] {
-+	    perror "unknown option $opt_name given in extra_opts"
-+	    unresolved $subdir/$name
-+	    return
-+	}
-+	# Add extra option to end of existing option, adding space
-+	# if necessary.
-+	if { ![regexp "warning|error" $opt_name]
-+	     && [string length $opts($opt_name)] } {
-+	    append opts($opt_name) " "
-+	}
-+	append opts($opt_name) $opt_val
-+    }
-+
-+    foreach opt { as ld } {
-+	regsub {\[big_or_little_endian\]} $opts($opt) \
-+	    [big_or_little_endian] opts($opt)
-+    }
-+
-+    if { $opts(name) == "" } {
-+	set testname "$subdir/$name"
-+    } else {
-+	set testname $opts(name)
-+    }
-+
-+    # Decide early whether we should run the test for this target.
-+    if { [llength $opts(noskip)] > 0 } {
-+	set targmatch 0
-+	foreach targ $opts(noskip) {
-+	    if [match_target $targ] {
-+		set targmatch 1
-+		break
-+	    }
-+	}
-+	if { $targmatch == 0 } {
-+	    return
-+	}
-+    }
-+    foreach targ $opts(anyskip) {
-+	if ![match_target $targ] {
-+	    return
-+	}
-+    }
-+    foreach targ $opts(skip) {
-+	if [match_target $targ] {
-+	    return
-+	}
-+    }
-+    if { [llength $opts(target)] > 0 } {
-+	set targmatch 0
-+	foreach targ $opts(target) {
-+	    if [match_target $targ] {
-+		set targmatch 1
-+		break
-+	    }
-+	}
-+	if { $targmatch == 0 } {
-+	    unsupported $testname
-+	    return
-+	}
-+    }
-+    foreach targ $opts(alltargets) {
-+	if ![match_target $targ] {
-+	    unsupported $testname
-+	    return
-+	}
-+    }
-+    foreach targ $opts(notarget) {
-+	if [match_target $targ] {
-+	    unsupported $testname
-+	    return
-+	}
-+    }
-+
-+    set program ""
-+    # It's meaningless to require an output-testing method when we
-+    # expect an error.
-+    if { $opts(error) == "" && $opts(error_output) == "" } {
-+	if {$opts(PROG) != ""} {
-+	    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"
-+		  unresolved $testname
-+		  return }
-+	    }
-+	} else {
-+	# Guess which program to run, by seeing which option was specified.
-+	    foreach p {objdump objcopy nm readelf} {
-+		if {$opts($p) != ""} {
-+		    if {$program != ""} {
-+			perror "ambiguous dump program in $file.d"
-+			unresolved $testname
-+			return
-+		    } else {
-+			set program $p
-+		    }
-+		}
-+	    }
-+	}
-+	if { $program == "" \
-+                 && $opts(map) == "" \
-+                 && $opts(warning) == "" \
-+                 && $opts(warning_output) == "" \
-+                 && $opts(error) == "" \
-+                 && $opts(error_output) == "" } {
-+	    perror "dump program unspecified in $file.d"
-+	    unresolved $testname
-+	    return
-+	}
-+    }
-+
-+    if { $opts(source) == "" } {
-+	set sourcefiles [list ${file}.s]
-+	set asflags [list ""]
-+	set objfile_names [list tmpdir/[file tail ${file}].o]
-+    } else {
-+	set sourcefiles {}
-+	foreach sf $opts(source) {
-+	    if { [string match "/*" $sf] } {
-+		lappend sourcefiles "$sf"
-+	    } else {
-+		lappend sourcefiles "$srcdir/$subdir/$sf"
-+	    }
-+	}
-+    }
-+
-+    if { $opts(dump) == "" } {
-+	set dfile ${file}.d
-+    } else {
-+	set dfile $srcdir/$subdir/$opts(dump)
-+    }
-+
-+    # Time to setup xfailures.
-+    foreach targ $opts(xfail) {
-+	setup_xfail $targ
-+    }
-+
-+    # Assemble each file.
-+    set objfiles {}
-+    for { set i 0 } { $i < [llength $sourcefiles] } { incr i } {
-+	set sourcefile [lindex $sourcefiles $i]
-+	set sourceasflags [lindex $asflags $i]
-+	set run_objcopy_objects 0
-+
-+	if { [string match "*RUN_OBJCOPY*" $sourceasflags] } {
-+	    set run_objcopy_objects 1
-+	}
-+	regsub "RUN_OBJCOPY" $sourceasflags "" sourceasflags
-+
-+	set objfile [lindex $objfile_names $i]
-+	catch "exec rm -f $objfile" exec_output
-+	lappend objfiles $objfile
-+	set cmd "$AS $ASFLAGS $opts(as) $sourceasflags -o $objfile $sourcefile"
-+
-+	send_log "$cmd\n"
-+	set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
-+	remote_upload host "ld.tmp"
-+	set comp_output [prune_warnings [file_contents "ld.tmp"]]
-+	remote_file host delete "ld.tmp"
-+	remote_file build delete "ld.tmp"
-+
-+	if { [lindex $cmdret 0] != 0 || ![string match "" $comp_output] } then {
-+	    send_log -- "$comp_output\n"
-+	    verbose "$comp_output" 3
-+
-+	    set exitstat "succeeded"
-+	    if { $cmdret != 0 } { set exitstat "failed" }
-+	    verbose -log "$exitstat with: <$comp_output>"
-+	    fail $testname
-+	    return
-+	}
-+
-+	if { $run_objcopy_objects } {
-+	    set cmd "$OBJCOPY $opts(objcopy_objects) $objfile"
-+
-+	    send_log "$cmd\n"
-+	    set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] \
-+			"" "/dev/null" "objcopy.tmp"]
-+	    remote_upload host "objcopy.tmp"
-+	    set comp_output [prune_warnings [file_contents "objcopy.tmp"]]
-+	    remote_file host delete "objcopy.tmp"
-+	    remote_file build delete "objcopy.tmp"
-+
-+	    if { [lindex $cmdret 0] != 0 \
-+		  || ![string match "" $comp_output] } {
-+		send_log -- "$comp_output\n"
-+		verbose "$comp_output" 3
-+
-+		set exitstat "succeeded"
-+		if { $cmdret != 0 } { set exitstat "failed" }
-+		verbose -log "$exitstat with: <$comp_output>"
-+		fail $testname
-+		return
-+	    }
-+	}
-+    }
-+
-+    if { (($opts(warning) != "") && ($opts(error) != "")) \
-+	 || (($opts(warning) != "") && ($opts(error_output) != "")) \
-+	 || (($opts(warning) != "") && ($opts(warning_output) != "")) \
-+	 || (($opts(error) != "") && ($opts(warning_output) != "")) \
-+	 || (($opts(error) != "") && ($opts(error_output) != "")) \
-+	 || (($opts(warning_output) != "") && ($opts(error_output) != "")) } {
-+	perror "$testname: bad mix of warning, error, warning_output, and error_output test-directives"
-+	unresolved $testname
-+	return
-+    }
-+
-+    set check_ld(source) ""
-+    set check_ld(terminal) 0
-+    if { $opts(error) != "" \
-+         || $opts(warning) != "" \
-+         || $opts(error_output) != "" \
-+         || $opts(warning_output) != "" } {
-+
-+        if { $opts(error) != "" || $opts(error_output) != "" } {
-+            set check_ld(terminal) 1
-+        } else {
-+            set check_ld(terminal) 0
-+        }
-+
-+        if { $opts(error) != "" || $opts(warning) != "" } {
-+            set check_ld(source) "regex"
-+            if { $opts(error) != "" } {
-+                set check_ld(regex) $opts(error)
-+            } else {
-+                set check_ld(regex) $opts(warning)
-+            }
-+        } else {
-+            set check_ld(source) "file"
-+            if { $opts(error_output) != "" } {
-+                set check_ld(file) $opts(error_output)
-+            } else {
-+                set check_ld(file) $opts(warning_output)
-+            }
-+        }
-+    }
-+
-+    # Perhaps link the file(s).
-+    if { $run_ld } {
-+	set objfile "tmpdir/dump"
-+	catch "exec rm -f $objfile" exec_output
-+
-+	# Add -L$srcdir/$subdir so that the linker command can use
-+	# linker scripts in the source directory.
-+	set cmd "$LD --hash-style=sysv $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
-+		   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
-+
-+        # If needed then check for, or add a -Map option.
-+        set mapfile ""
-+        if { $opts(map) != "" } then {
-+            if { [regexp -- "-Map=(\[^ \]+)" $cmd all mapfile] } then {
-+                # Found existing mapfile option
-+                verbose -log "Existing mapfile '$mapfile' found"
-+            } else {
-+                # No mapfile option.
-+                set mapfile "tmpdir/dump.map"
-+                verbose -log "Adding mapfile '$mapfile'"
-+                set cmd "$cmd -Map=$mapfile"
-+            }
-+        }
-+
-+	send_log "$cmd\n"
-+	set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
-+	remote_upload host "ld.tmp"
-+	set comp_output [file_contents "ld.tmp"]
-+	remote_file host delete "ld.tmp"
-+	remote_file build delete "ld.tmp"
-+	set cmdret [lindex $cmdret 0]
-+
-+	if { $cmdret == 0 && $run_objcopy } {
-+	    set infile $objfile
-+	    set objfile "tmpdir/dump1"
-+	    remote_file host delete $objfile
-+
-+	    # Note that we don't use OBJCOPYFLAGS here; any flags must be
-+	    # explicitly specified.
-+	    set cmd "$OBJCOPY $opts(objcopy_linked_file) $infile $objfile"
-+
-+	    send_log "$cmd\n"
-+	    set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
-+	    remote_upload host "ld.tmp"
-+	    append comp_output [file_contents "ld.tmp"]
-+	    remote_file host delete "ld.tmp"
-+	    remote_file build delete "ld.tmp"
-+	    set cmdret [lindex $cmdret 0]
-+	}
-+
-+	regsub "\n$" $comp_output "" comp_output
-+	if { $cmdret != 0 || $comp_output != "" || $check_ld(source) != "" } then {
-+	    set exitstat "succeeded"
-+	    if { $cmdret != 0 } { set exitstat "failed" }
-+
-+            if { $check_ld(source) == "regex" } {
-+                verbose -log "$exitstat with: <$comp_output>, expected: <$check_ld(regex)>"
-+            } elseif { $check_ld(source) == "file" } {
-+                verbose -log "$exitstat with: <$comp_output>, expected in file $check_ld(file)"
-+                set_file_contents "tmpdir/ld.messages" "$comp_output"
-+            } else {
-+                verbose -log "$exitstat with: <$comp_output>, no expected output"
-+            }
-+	    send_log -- "$comp_output\n"
-+	    verbose "$comp_output" 3
-+
-+	    if { (($check_ld(source) == "") == ($comp_output == "")) \
-+                 && (($cmdret == 0) == ($check_ld(terminal) == 0)) \
-+                 && ((($check_ld(source) == "regex") \
-+                      && ($check_ld(regex) == "") == ($comp_output == "") \
-+                      && [regexp -- $check_ld(regex) $comp_output]) \
-+                     || (($check_ld(source) == "file") \
-+                         && (![regexp_diff "tmpdir/ld.messages" "$srcdir/$subdir/$check_ld(file)"]))) } {
-+                # We have the expected output from ld.
-+		if { $check_ld(terminal) || $program == "" } {
-+		    pass $testname
-+		    return
-+		}
-+	    } else {
-+		fail $testname
-+		return
-+	    }
-+	}
-+
-+        if { $opts(map) != "" } then {
-+            # Check the map file matches.
-+            set map_pattern_file $srcdir/$subdir/$opts(map)
-+            verbose -log "Compare '$mapfile' against '$map_pattern_file'"
-+            if { [regexp_diff $mapfile $map_pattern_file] } then {
-+                fail "$testname (map file check)"
-+            } else {
-+                pass "$testname (map file check)"
-+            }
-+
-+            if { $program == "" } then {
-+                return
-+            }
-+        }
-+    } else {
-+	set objfile [lindex $objfiles 0]
-+    }
-+
-+    # We must not have expected failure if we get here.
-+    if { $opts(error) != "" } {
-+	fail $testname
-+	return
-+    }
-+
-+    set progopts1 $opts($program)
-+    eval set progopts \$[string toupper $program]FLAGS
-+    eval set binary \$[string toupper $program]
-+
-+    if { ![is_remote host] && [which $binary] == 0 } {
-+	untested $testname
-+	return
-+    }
-+
-+    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)]} {
-+	set old_lc_all $env(LC_ALL)
-+    }
-+    set env(LC_ALL) "C"
-+    send_log "$cmd\n"
-+    set cmdret [remote_exec host [concat sh -c [list "$cmd 2>ld.tmp"]] "" "/dev/null"]
-+    set cmdret [lindex $cmdret 0]
-+    remote_upload host "ld.tmp"
-+    set comp_output [prune_warnings [file_contents "ld.tmp"]]
-+    remote_file host delete "ld.tmp"
-+    remote_file build delete "ld.tmp"
-+    if {[info exists old_lc_all]} {
-+	set env(LC_ALL) $old_lc_all
-+    } else {
-+	unset env(LC_ALL)
-+    }
-+    if { $cmdret != 0 || $comp_output != "" } {
-+	send_log "exited abnormally with $cmdret, output:$comp_output\n"
-+	fail $testname
-+	return
-+    }
-+
-+    if { $verbose > 2 } then { verbose "output is [file_contents $dumpfile]" 3 }
-+    if { [regexp_diff $dumpfile "${dfile}"] } then {
-+	fail $testname
-+	if { $verbose == 2 } then { verbose "output is [file_contents $dumpfile]" 2 }
-+	return
-+    }
-+
-+    pass $testname
-+}
-+
-+proc slurp_options { file } {
-+    # If options_regsub(foo) is set to {a b}, then the contents of a
-+    # "#foo:" line will have regsub -all applied to replace a with b.
-+    global options_regsub
-+
-+    if [catch { set f [open $file r] } x] {
-+	#perror "couldn't open `$file': $x"
-+	perror "$x"
-+	return -1
-+    }
-+    set opt_array {}
-+    # whitespace expression
-+    set ws  {[ 	]*}
-+    set nws {[^ 	]*}
-+    # whitespace is ignored anywhere except within the options list;
-+    # option names are alphabetic plus underscore only.
-+    set pat "^#${ws}(\[a-zA-Z_\]*)$ws:${ws}(.*)$ws\$"
-+    while { [gets $f line] != -1 } {
-+	set line [string trim $line]
-+	# Whitespace here is space-tab.
-+	if [regexp $pat $line xxx opt_name opt_val] {
-+	    # match!
-+	    if [info exists options_regsub($opt_name)] {
-+		set subst $options_regsub($opt_name)
-+		regsub -all -- [lindex $subst 0] $opt_val [lindex $subst 1] \
-+		    opt_val
-+	    }
-+	    lappend opt_array [list $opt_name $opt_val]
-+	} else {
-+	    break
-+	}
-+    }
-+    close $f
-+    return $opt_array
-+}
-+
-+proc file_contents { filename } {
-+    set file [open $filename r]
-+    set contents [read $file]
-+    close $file
-+    return $contents
-+}
-+
-+proc set_file_contents { filename contents } {
-+    set file [open $filename w]
-+    puts $file "$contents"
-+    close $file
-+}
-+
- # Create an archive using ar
- #
- proc ar_simple_create { ar aropts target objects } {
--- 
-2.26.2
-

diff --git a/9999/0011-Gentoo-add-with-extra-soversion-suffix-option.patch b/9999/0006-Gentoo-add-with-extra-soversion-suffix-option.patch
similarity index 97%
rename from 9999/0011-Gentoo-add-with-extra-soversion-suffix-option.patch
rename to 9999/0006-Gentoo-add-with-extra-soversion-suffix-option.patch
index cc9f0cc..d7f696c 100644
--- a/9999/0011-Gentoo-add-with-extra-soversion-suffix-option.patch
+++ b/9999/0006-Gentoo-add-with-extra-soversion-suffix-option.patch
@@ -1,7 +1,7 @@
-From f1d34965ce140071bb77313bbca01914ace59e27 Mon Sep 17 00:00:00 2001
+From eefafabed03c163287326afaadc4cc0e5840ea7b Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Wed, 12 Sep 2018 23:44:29 +0100
-Subject: [PATCH 11/16] Gentoo: add --with-extra-soversion-suffix= option
+Subject: [PATCH 6/9] Gentoo: add --with-extra-soversion-suffix= option
 
 --with-extra-soversion-suffix= will allow Gentoo to
 distinct libbfd.so and libopcodes.so to have more precise

diff --git a/9999/0007-Gentoo-Pass-no-warn-shared-textrel-to-ld-in-its-test.patch b/9999/0007-Gentoo-Pass-no-warn-shared-textrel-to-ld-in-its-test.patch
deleted file mode 100644
index 74f96cf..0000000
--- a/9999/0007-Gentoo-Pass-no-warn-shared-textrel-to-ld-in-its-test.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 221b8f6dfdfcb5e9d04069fdc2fb1aa6a881cb60 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Sun, 3 Jun 2018 21:40:36 +0200
-Subject: [PATCH 07/16] Gentoo: Pass --no-warn-shared-textrel to ld in its
- testsuite
-
----
- ld/testsuite/lib/ld-lib.exp | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index 853a4d87e6..ec123e2fc1 100644
---- a/ld/testsuite/lib/ld-lib.exp
-+++ b/ld/testsuite/lib/ld-lib.exp
-@@ -165,7 +165,7 @@ proc default_ld_relocate { ld target objects } {
-     global HOSTING_EMU
- 
-     remote_file host delete $target
--    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv -o $target -r $objects"]
-+    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv --no-warn-shared-textrel -o $target -r $objects"]
- }
- 
- # Check to see if ld is being invoked with a non-endian output format
-@@ -203,9 +203,9 @@ proc default_ld_link { ld target objects } {
-     # - .*ld/ld-new    -> we're working with the new linker
-     # - otherwise      -> we're likely working with the system compiler
-     if {[regexp {ld/ld-new$} $ld]} {
--      set gentoosysv "--hash-style=sysv"
-+      set gentoosysv "--hash-style=sysv --no-warn-shared-textrel"
-     } else {
--      set gentoosysv "-Wl,--hash-style=sysv"
-+      set gentoosysv "-Wl,--hash-style=sysv -Wl,--no-warn-shared-textrel"
-     }
- 
-     remote_file host delete $target
-@@ -972,7 +972,7 @@ proc run_dump_test { name {extra_options {}} } {
- 
- 	# Add -L$srcdir/$subdir so that the linker command can use
- 	# linker scripts in the source directory.
--	set cmd "$LD --hash-style=sysv $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
-+	set cmd "$LD --hash-style=sysv --no-warn-shared-textrel $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
- 		   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
- 
-         # If needed then check for, or add a -Map option.
--- 
-2.26.2
-

diff --git a/9999/0013-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch b/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
similarity index 91%
rename from 9999/0013-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
rename to 9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
index 713a0a9..0b0cbfe 100644
--- a/9999/0013-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
+++ b/9999/0007-Gentoo-ld-enable-new-dtags-by-default-for-linux-gnu-.patch
@@ -1,7 +1,7 @@
-From 14ba11502cbc93e938e0b43e9648aedb7462ddeb Mon Sep 17 00:00:00 2001
+From cf8983d602c56eb31ee0e356df670d9c2876ce15 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
 Date: Sun, 13 Oct 2019 05:25:28 +0200
-Subject: [PATCH 13/16] Gentoo: ld: enable new dtags by default for linux/gnu
+Subject: [PATCH 7/9] Gentoo: ld: enable new dtags by default for linux/gnu
  targets
 
 Original author: Mike Frysinger <vapier@gentoo.org>

diff --git a/9999/0008-Gentoo-Restore-TEXTREL-warnings-for-non-shared-objec.patch b/9999/0008-Gentoo-Restore-TEXTREL-warnings-for-non-shared-objec.patch
index e54ccd1..8e0e091 100644
--- a/9999/0008-Gentoo-Restore-TEXTREL-warnings-for-non-shared-objec.patch
+++ b/9999/0008-Gentoo-Restore-TEXTREL-warnings-for-non-shared-objec.patch
@@ -1,11 +1,12 @@
-From 3439646abc93066af8cc651940f30fd0f9b99760 Mon Sep 17 00:00:00 2001
+From 74afb38257f4a35d681883348ef54317674827e3 Mon Sep 17 00:00:00 2001
 From: Sergei Trofimovich <slyfox@gentoo.org>
 Date: Thu, 1 Mar 2018 12:35:03 +0100
-Subject: [PATCH 08/16] Gentoo: Restore TEXTREL warnings for non-shared objects
+Subject: [PATCH 8/9] Gentoo: Restore TEXTREL warnings for non-shared objects
 
 ---
- bfd/elflink.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
+ bfd/elflink.c                | 4 ++--
+ ld/testsuite/ld-i386/warn1.d | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/bfd/elflink.c b/bfd/elflink.c
 index 90ada7a1cc..b4636885aa 100644
@@ -29,6 +30,16 @@ index 90ada7a1cc..b4636885aa 100644
  		  break;
  		}
  	    }
+diff --git a/ld/testsuite/ld-i386/warn1.d b/ld/testsuite/ld-i386/warn1.d
+index 3c78f31efd..49bcb5171f 100644
+--- a/ld/testsuite/ld-i386/warn1.d
++++ b/ld/testsuite/ld-i386/warn1.d
+@@ -1,4 +1,4 @@
+ #name: --warn-shared-textrel --fatal-warnings
+ #as: --32
+ #ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
+-#error: .*warning: creating a DT_TEXTREL in a shared object
++#error: .*warning: creating a DT_TEXTREL in object
 -- 
 2.26.2
 

diff --git a/9999/0009-Gentoo-Fix-test-for-precise-textrel-warning-message-.patch b/9999/0009-Gentoo-Fix-test-for-precise-textrel-warning-message-.patch
deleted file mode 100644
index e87a82d..0000000
--- a/9999/0009-Gentoo-Fix-test-for-precise-textrel-warning-message-.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 61cc50292e7cc3f8871946f0720ff039ddf7a2be Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Sun, 3 Jun 2018 22:36:40 +0200
-Subject: [PATCH 09/16] Gentoo: Fix test for precise textrel warning message,
- after non-shared object change
-
-(Broken by "Gentoo: Restore TEXTREL warnings for non-shared objects")
----
- ld/testsuite/ld-i386/warn1.d | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ld/testsuite/ld-i386/warn1.d b/ld/testsuite/ld-i386/warn1.d
-index 3c78f31efd..3319308d33 100644
---- a/ld/testsuite/ld-i386/warn1.d
-+++ b/ld/testsuite/ld-i386/warn1.d
-@@ -1,4 +1,4 @@
- #name: --warn-shared-textrel --fatal-warnings
- #as: --32
- #ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
--#error: .*warning: creating a DT_TEXTREL in a shared object
-+#error: .*warning: creating a DT_TEXTREL in object.
--- 
-2.26.2
-

diff --git a/9999/0009-Gentoo-Pass-hash-style-sysv-and-no-warn-shared-textr.patch b/9999/0009-Gentoo-Pass-hash-style-sysv-and-no-warn-shared-textr.patch
new file mode 100644
index 0000000..4ff406f
--- /dev/null
+++ b/9999/0009-Gentoo-Pass-hash-style-sysv-and-no-warn-shared-textr.patch
@@ -0,0 +1,62 @@
+From 2055e278cb6e984760dbf8627efef2158e215449 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Wed, 18 Oct 2017 00:44:49 +0200
+Subject: [PATCH 9/9] Gentoo: Pass --hash-style=sysv and
+ --no-warn-shared-textrel to ld in the testsuite
+
+---
+ binutils/testsuite/lib/binutils-common.exp |  2 +-
+ ld/testsuite/lib/ld-lib.exp                | 16 ++++++++++++++--
+ 2 files changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
+index b9e3c6d817..bb4ef987b3 100644
+--- a/binutils/testsuite/lib/binutils-common.exp
++++ b/binutils/testsuite/lib/binutils-common.exp
+@@ -1125,7 +1125,7 @@ proc run_dump_test { name {extra_options {}} } {
+ 
+             # Add -L$srcdir/$subdir so that the linker command can use
+             # linker scripts in the source directory.
+-            set cmd "$LD $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
++            set cmd "$LD --hash-style=sysv --no-warn-shared-textrel $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
+ 		   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
+ 
+             # If needed then check for, or add a -Map option.
+diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
+index 015eda6eb9..0b945b539d 100644
+--- a/ld/testsuite/lib/ld-lib.exp
++++ b/ld/testsuite/lib/ld-lib.exp
+@@ -165,7 +165,7 @@ proc default_ld_relocate { ld target objects } {
+     global HOSTING_EMU
+ 
+     remote_file host delete $target
+-    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
++    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv --no-warn-shared-textrel -o $target -r $objects"]
+ }
+ 
+ # Check to see if ld is being invoked with a non-endian output format
+@@ -196,8 +196,20 @@ proc default_ld_link { ld target objects } {
+ 	set flags [big_or_little_endian]
+     }
+ 
++    # Hilariously, this procedure is called sometimes with $CC and sometimes
++    # with $ld as parameter. If we want to change the default behaviour, we
++    # need to take the different option formats into account.
++    # We check the $ld parameter for
++    # - ld-new         -> we're working with the new linker
++    # - otherwise      -> we're likely working with the system compiler
++    if {[regexp {ld-new$} $ld]} {
++      set gentoosysv "--hash-style=sysv --no-warn-shared-textrel"
++    } else {
++      set gentoosysv "-Wl,--hash-style=sysv -Wl,--no-warn-shared-textrel"
++    }
++
+     remote_file host delete $target
+-    set exec_output [run_host_cmd "$ld" "$flags -o $target $objects"]
++    set exec_output [run_host_cmd "$ld" "$gentoosysv $flags -o $target $objects"]
+     set exec_output [prune_warnings $exec_output]
+ 
+     # We don't care if we get a warning about a non-existent start
+-- 
+2.26.2
+

diff --git a/9999/0010-Gentoo-Fix-textrel-warning-format-test.patch b/9999/0010-Gentoo-Fix-textrel-warning-format-test.patch
deleted file mode 100644
index f29ae7f..0000000
--- a/9999/0010-Gentoo-Fix-textrel-warning-format-test.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From fab9a66210e065ff5a14d4bc70841406cdecc62e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Mon, 16 Jul 2018 12:20:37 +0200
-Subject: [PATCH 10/16] Gentoo: Fix textrel warning format test
-
----
- ld/testsuite/ld-i386/warn1.d | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ld/testsuite/ld-i386/warn1.d b/ld/testsuite/ld-i386/warn1.d
-index 3319308d33..49bcb5171f 100644
---- a/ld/testsuite/ld-i386/warn1.d
-+++ b/ld/testsuite/ld-i386/warn1.d
-@@ -1,4 +1,4 @@
- #name: --warn-shared-textrel --fatal-warnings
- #as: --32
- #ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
--#error: .*warning: creating a DT_TEXTREL in object.
-+#error: .*warning: creating a DT_TEXTREL in object
--- 
-2.26.2
-

diff --git a/9999/0012-no-patch-Gentoo-Add-patch-tarball-generation-script.patch b/9999/0012-no-patch-Gentoo-Add-patch-tarball-generation-script.patch
deleted file mode 100644
index a60bb9c..0000000
--- a/9999/0012-no-patch-Gentoo-Add-patch-tarball-generation-script.patch
+++ /dev/null
@@ -1,217 +0,0 @@
-From 7343f154ae6bc08bd2c3c051f039824af3d917e5 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Wed, 11 Oct 2017 21:56:53 +0200
-Subject: [PATCH 12/16] [no patch] Gentoo: Add patch tarball generation script
-
-(cherry picked from commit 90427abb2aac0cc4ebcb73397cc3ad574c6fec5d)
----
- scripts/gentoo/0000-Gentoo-Git-is-development |  12 ++
- scripts/gentoo/9999-Gentoo-We-make-a-release  |  12 ++
- scripts/gentoo/README.Gentoo.patches          |  31 +++++
- scripts/gentoo/make-tarball.sh                | 118 ++++++++++++++++++
- 4 files changed, 173 insertions(+)
- create mode 100644 scripts/gentoo/0000-Gentoo-Git-is-development
- create mode 100644 scripts/gentoo/9999-Gentoo-We-make-a-release
- create mode 100644 scripts/gentoo/README.Gentoo.patches
- create mode 100755 scripts/gentoo/make-tarball.sh
-
-diff --git a/scripts/gentoo/0000-Gentoo-Git-is-development b/scripts/gentoo/0000-Gentoo-Git-is-development
-new file mode 100644
-index 0000000000..2b9482d033
---- /dev/null
-+++ b/scripts/gentoo/0000-Gentoo-Git-is-development
-@@ -0,0 +1,12 @@
-+Gentoo: Git is development
-+
-+--- a/bfd/development.sh
-++++ b/bfd/development.sh
-+@@ -16,5 +16,5 @@
-+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+ 
-+ # Controls whether to enable development-mode features by default.
-+-development=false
-++development=true
-+ 
-+
-diff --git a/scripts/gentoo/9999-Gentoo-We-make-a-release b/scripts/gentoo/9999-Gentoo-We-make-a-release
-new file mode 100644
-index 0000000000..fea66d97b4
---- /dev/null
-+++ b/scripts/gentoo/9999-Gentoo-We-make-a-release
-@@ -0,0 +1,12 @@
-+Gentoo: We make a release, so switch development flag off
-+
-+--- a/bfd/development.sh
-++++ b/bfd/development.sh
-+@@ -16,5 +16,5 @@
-+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+ 
-+ # Controls whether to enable development-mode features by default.
-+-development=true
-++development=false
-+ 
-+
-diff --git a/scripts/gentoo/README.Gentoo.patches b/scripts/gentoo/README.Gentoo.patches
-new file mode 100644
-index 0000000000..504dc67127
---- /dev/null
-+++ b/scripts/gentoo/README.Gentoo.patches
-@@ -0,0 +1,31 @@
-+ ============
-+ === What ===
-+ ============
-+
-+Gentoo patchsets for binutils are maintained as vendor branches of the upstream
-+binutils-glb git repository. From there, we bundle all the commits into a tarball
-+and distribute it via our public mirroring system.
-+
-+If you want specific info about a patch (like what it does or whose great idea 
-+it was to change the code), read the patch!  We try to fill out the commit
-+messages with useful info such as what it does, why it's needed, bug reports, 
-+original creators, etc...  
-+
-+ =============
-+ === Where ===
-+ =============
-+
-+Currently, https://github.com/gentoo/binutils-gdb
-+
-+ ===========
-+ === How ===
-+ ===========
-+ 
-+The patch naming convention is precisely as generated by "git format-patch".
-+
-+All patches should apply with -p1 (so they can be used both with the legacy
-+epatch function and the new, more strict eapply function).
-+
-+Commits where the commit message starts with "[no patch]" will not be included
-+in the patch tarball. This is useful for changes to the tarball generation
-+script, or for the addition of extra files that are not patches.
-diff --git a/scripts/gentoo/make-tarball.sh b/scripts/gentoo/make-tarball.sh
-new file mode 100755
-index 0000000000..575f48bf6a
---- /dev/null
-+++ b/scripts/gentoo/make-tarball.sh
-@@ -0,0 +1,118 @@
-+#!/bin/bash
-+
-+PN="binutils"
-+PV=$1
-+pver=$2
-+
-+if [[ -z ${PV} ]] ; then
-+	echo "Usage: $0 binutils-version patchset-version-to-be-created"
-+	echo "Please read the script before trying to use it :)"
-+	exit 1
-+fi
-+
-+# check that we're in the root of a binutils-gdb git repo
-+
-+if [[ ! -f COPYING.LIBGLOSS ]] || [[ ! -d .git ]] ; then
-+	echo "Error: You need to call this script in the main directory of a Gentoo binutils-gdb git clone"
-+	exit 1
-+fi
-+
-+# check that we're on a branch gentoo/${PV}
-+
-+mybranchinfo=$(git status --porcelain -b|grep '^##')
-+mybranch=$(echo ${mybranchinfo}|sed -e 's:^## ::' -e 's:\.\.\..*$::')
-+if [[ ! "gentoo/binutils-${PV}" == "${mybranch}" ]] ; then
-+	echo "Error: Your git repository is on the incorrect branch ${mybranch}; should be gentoo/binutils-${PV}"
-+	exit 1
-+fi
-+
-+# check that the working directory is clean
-+
-+mystatusinfo=$(git status --porcelain)
-+if [[ ! -z "${mystatusinfo}" ]] ; then
-+	echo "Error: Your working directory is not clean"
-+	exit 1
-+fi
-+
-+# check if the tag already exists
-+
-+mytaginfo=$(git tag -l|grep "gentoo/binutils-${PV}-${pver}")
-+if [[ ! -z "${mytaginfo}" ]] ; then
-+	echo "Error: A tag corresponding to this patch level already exists (gentoo/binutils-${PV}-${pver})"
-+	exit 1
-+fi
-+
-+# luckily binutils git has no /tmp dir and no tar.xz files, but let's better check and be pathologically careful
-+
-+if [[ -e tmp ]] || [[ -e ${PN}-${PV}-patches-${pver}.tar.xz ]] ; then
-+	echo "Error: tmp or ${PN}-${PV}-patches-${pver}.tar.xz exists in git"
-+	exit 1
-+fi
-+rm -rf tmp
-+rm -f ${PN}-${PV}-*.tar.bz2
-+
-+for myname in 0*.patch ; do
-+	if [[ -e "${myname}" ]]; then
-+		echo "Error: ${myname} exists in git"
-+		exit 1
-+	fi
-+done
-+rm -f 0*.patch
-+
-+# check if we have to override the upstream tag
-+
-+mytaginfo=$(git tag -l|grep "gentoo/binutils-${PV}-upstream")
-+if [[ ! -z "${mytaginfo}" ]] ; then
-+	starttag="gentoo/binutils-${PV}-upstream"
-+else
-+	starttag="binutils-${PV//./_}"
-+fi
-+if [[ "${PV}" == "9999" ]]; then
-+	starttag="master"
-+fi
-+echo "Starting from tag ${starttag}"
-+
-+mkdir -p tmp/patch
-+
-+# copy README.Gentoo.patches
-+
-+cp scripts/gentoo/README.Gentoo.patches tmp/ || exit 1
-+
-+# create and rename patches
-+
-+git format-patch ${starttag}..HEAD > /dev/null || exit 1
-+
-+# remove all patches where the summary line starts with:
-+# - [no-tarball]: not related to upstream tarball
-+# - [no-patch]: not related to upstream patches
-+# - "Automatic date update in version.in": daily bumps
-+rm -f 0???-no-tarball-*.patch
-+rm -f 0???-no-patch-*.patch
-+rm -f 0???-Automatic-date-update-in-version.in.patch
-+
-+for myname in 0*.patch ; do
-+	mv ${myname} tmp/patch/ || exit 1
-+done
-+
-+# add the extra patch if needed
-+
-+if [[ "${PV}" != "9999" ]]; then
-+	cp scripts/gentoo/0000-Gentoo-Git-is-development tmp/patch/0000-Gentoo-Git-is-development.patch || exit 1
-+	cp scripts/gentoo/9999-Gentoo-We-make-a-release tmp/patch/9999-Gentoo-We-make-a-release.patch || exit 1
-+fi
-+
-+# add a history file
-+
-+git log --stat --decorate ${starttag}..HEAD > tmp/patch/README.history || exit 1
-+
-+# package everything up
-+
-+tar -Jcf ${PN}-${PV}-patches-${pver}.tar.xz \
-+	-C tmp patch README.Gentoo.patches || exit 1
-+rm -r tmp
-+
-+du -b *.tar.xz
-+
-+# tag the commit
-+
-+git tag -s -m "Gentoo patchset binutils-${PV}-${pver}" "gentoo/binutils-${PV}-${pver}"
--- 
-2.26.2
-

diff --git a/9999/0014-Gentoo-Remove-block-mistakenly-duplicated-in-1222895.patch b/9999/0014-Gentoo-Remove-block-mistakenly-duplicated-in-1222895.patch
deleted file mode 100644
index 20dbdd1..0000000
--- a/9999/0014-Gentoo-Remove-block-mistakenly-duplicated-in-1222895.patch
+++ /dev/null
@@ -1,777 +0,0 @@
-From e54cd834e32160ac588add78a2990648328c2f06 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Sun, 10 May 2020 20:13:43 +0300
-Subject: [PATCH 14/16] Gentoo: Remove block mistakenly duplicated in
- 1222895ec55f34a97fb2cbcd80d421e24308f618
-
----
- ld/testsuite/lib/ld-lib.exp | 753 ------------------------------------
- 1 file changed, 753 deletions(-)
-
-diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index ec123e2fc1..ae72f21d72 100644
---- a/ld/testsuite/lib/ld-lib.exp
-+++ b/ld/testsuite/lib/ld-lib.exp
-@@ -421,759 +421,6 @@ proc ld_link_defsyms {} {
-     return $flags
- }
- 
--# run_dump_test FILE (optional:) EXTRA_OPTIONS
--# Copied from gas testsuite, tweaked and further extended.
--#
--# Assemble a .s file, then run some utility on it and check the output.
--#
--# There should be an assembly language file named FILE.s in the test
--# suite directory, and a pattern file called FILE.d.  `run_dump_test'
--# will assemble FILE.s, run some tool like `objdump', `objcopy', or
--# `nm' on the .o file to produce textual output, and then analyze that
--# with regexps.  The FILE.d file specifies what program to run, and
--# what to expect in its output.
--#
--# The FILE.d file begins with zero or more option lines, which specify
--# flags to pass to the assembler, the program to run to dump the
--# assembler's output, and the options it wants.  The option lines have
--# the syntax:
--#
--#         # OPTION: VALUE
--#
--# OPTION is the name of some option, like "name" or "objdump", and
--# VALUE is OPTION's value.  The valid options are described below.
--# Whitespace is ignored everywhere, except within VALUE.  The option
--# list ends with the first line that doesn't match the above syntax
--# (hmm, not great for error detection).
--#
--# The optional EXTRA_OPTIONS argument to `run_dump_test' is a list of
--# two-element lists.  The first element of each is an option name, and
--# the second additional arguments to be added on to the end of the
--# option list as given in FILE.d.  (If omitted, no additional options
--# are added.)
--#
--# The interesting options are:
--#
--#   name: TEST-NAME
--#	The name of this test, passed to DejaGNU's `pass' and `fail'
--#       commands.  If omitted, this defaults to FILE, the root of the
--#       .s and .d files' names.
--#
--#   as: FLAGS
--#	When assembling, pass FLAGS to the assembler.
--#       If assembling several files, you can pass different assembler
--#       options in the "source" directives.  See below.
--#
--#   ld: FLAGS
--#       Link assembled files using FLAGS, in the order of the "source"
--#       directives, when using multiple files.
--#
--#   ld_after_inputfiles: FLAGS
--#       Similar to "ld", but put after all input files.
--#
--#   objcopy_objects: FLAGS
--#	Run objcopy with the specified flags after assembling any source
--#	that has the special marker RUN_OBJCOPY in the source specific
--#	flags.
--#
--#   objcopy_linked_file: FLAGS
--#	Run objcopy on the linked file with the specified flags.
--#	This lets you transform the linked file using objcopy, before the
--#	result is analyzed by an analyzer program specified below (which
--#	may in turn *also* be objcopy).
--#
--#   PROG: PROGRAM-NAME
--#       The name of the program to run to analyze the .o file produced
--#       by the assembler or the linker output.  This can be omitted;
--#       run_dump_test will guess which program to run by seeing which of
--#       the flags options below is present.
--#
--#   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
--#	consistent sorting of symbols.
--#
--#   source: SOURCE [FLAGS]
--#	Assemble the file SOURCE.s using the flags in the "as" directive
--#       and the (optional) FLAGS.  If omitted, the source defaults to
--#       FILE.s.
--#       This is useful if several .d files want to share a .s file.
--#       More than one "source" directive can be given, which is useful
--#       when testing linking.
--#
--#   dump: DUMP
--#	Match against DUMP.d.  If omitted, this defaults to FILE.d.  This
--#	is useful if several .d files differ by options only.  Options are
--#	always read from FILE.d.
--#
--#   xfail: TARGET
--#       The test is expected to fail on TARGET.  This may occur more than
--#       once.
--#
--#   target: TARGET
--#	Only run the test for TARGET.
--#	You may provide target name "cfi" for any target supporting the
--#	CFI statements.  You may provide target name "shared" for any
--#	target supporting shared libraries.  Otherwise TARGET is called
--#	as a TCL procedure if surrounded by square brackets, or passed
--#	to "istarget" if not.
--#	This may occur more than once; the target being tested must match
--#	at least one.  Otherwise the test will be marked unsupported.
--#
--#   alltargets: TARGET
--#	Only run the test for TARGET.
--#	The syntax for TARGET is as with 'target'.
--#	This may occur more than once; the target being tested must match
--#	all of them.  Otherwise the test will be marked unsupported.
--#
--#   notarget: TARGET
--#	Do not run the test for TARGET.
--#	The syntax for TARGET is as with 'target'.
--#	This may occur more than once; the target being tested must not
--#	match any of them.  Otherwise the test will be marked unsupported.
--#
--#   skip: TARGET
--#   anyskip: TARGET
--#   noskip: TARGET
--#	These are exactly the same as "notarget", "alltargets" and
--#	"target" respectively, except that they do nothing at all if the
--#	check fails.  They should only be used in groups, to construct a
--#	single test which is run on all targets but with variant options
--#	or expected output on some targets.  (For example, see
--#	gas/arm/inst.d and gas/arm/wince_inst.d.)
--#
--#   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
--#	no meaning and need not be supplied if this is present.  Multiple
--#	"error" directives append to the expected linker error message.
--#
--#   error_output: FILE
--#       Means the same as 'error', except the regular expression lines
--#       are contains in FILE.
--#
--#   warning: REGEX
--#	Expect a linker warning matching REGEX.  It is an error to issue
--#	both "error" and "warning".  Multiple "warning" directives
--#	append to the expected linker warning message.
--#
--#   warning_output: FILE
--#       Means the same as 'warning', except the regular expression
--#       lines are contains in FILE.
--#
--#   map: FILE
--#       Adding this option will cause the linker to generate a linker
--#       map file, using the -Map=MAPFILE command line option.  If
--#       there is no -Map=MAPFILE in the 'ld: FLAGS' then one will be
--#       added to the linker command line.  The contents of the
--#       generated MAPFILE are then compared against the regexp lines
--#       in FILE using `regexp_diff' (see below for details).
--#
--# Each option may occur at most once unless otherwise mentioned.
--#
--# After the option lines come regexp lines.  `run_dump_test' calls
--# `regexp_diff' to compare the output of the dumping tool against the
--# regexps in FILE.d.  `regexp_diff' is defined in binutils-common.exp;
--# see further comments there.
--#
--proc run_dump_test { name {extra_options {}} } {
--    global subdir srcdir
--    global OBJDUMP NM AS OBJCOPY READELF LD
--    global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS LDFLAGS
--    global host_triplet runtests
--    global env verbose
--    global ld_elf_shared_opt
--
--    if { [is_elf_format] && [check_shared_lib_support] } {
--	set ld_extra_opt "$ld_elf_shared_opt"
--    } else {
--	set ld_extra_opt ""
--    }
--
--    if [string match "*/*" $name] {
--	set file $name
--	set name [file tail $name]
--    } else {
--	set file "$srcdir/$subdir/$name"
--    }
--
--    if ![runtest_file_p $runtests $name] then {
--	return
--    }
--
--    set opt_array [slurp_options "${file}.d"]
--    if { $opt_array == -1 } {
--	perror "error reading options from $file.d"
--	unresolved $subdir/$name
--	return
--    }
--    set dumpfile tmpdir/dump.out
--    set run_ld 0
--    set run_objcopy 0
--    set objfile_names {}
--    set opts(as) {}
--    set opts(ld) {}
--    set opts(ld_after_inputfiles) {}
--    set opts(xfail) {}
--    set opts(target) {}
--    set opts(alltargets) {}
--    set opts(notarget) {}
--    set opts(skip) {}
--    set opts(anyskip) {}
--    set opts(noskip) {}
--    set opts(objdump) {}
--    set opts(nm) {}
--    set opts(objcopy) {}
--    set opts(readelf) {}
--    set opts(name) {}
--    set opts(PROG) {}
--    set opts(source) {}
--    set opts(dump) {}
--    set opts(error) {}
--    set opts(warning) {}
--    set opts(error_output) {}
--    set opts(warning_output) {}
--    set opts(objcopy_linked_file) {}
--    set opts(objcopy_objects) {}
--    set opts(map) {}
--
--    foreach i $opt_array {
--	set opt_name [lindex $i 0]
--	set opt_val [lindex $i 1]
--	if ![info exists opts($opt_name)] {
--	    perror "unknown option $opt_name in file $file.d"
--	    unresolved $subdir/$name
--	    return
--	}
--
--	switch -- $opt_name {
--	    xfail {}
--	    target {}
--	    alltargets {}
--	    notarget {}
--	    skip {}
--	    anyskip {}
--	    noskip {}
--	    warning {}
--	    error {}
--	    source {
--		# Move any source-specific as-flags to a separate list to
--		# simplify processing.
--		if { [llength $opt_val] > 1 } {
--		    lappend asflags [lrange $opt_val 1 end]
--		    set opt_val [lindex $opt_val 0]
--		} else {
--		    lappend asflags {}
--		}
--
--                # Create the object file name based on nothing but the source
--                # file name.
--                set new_objfile \
--                    [concat tmpdir/[file rootname [file tail [lindex $opt_val 0]]].o]
--                # But, sometimes, we have the exact same source filename in
--                # different directories (foo/src.s bar/src.s) which would lead
--                # us to try and create two src.o files.  We detect this
--                # conflict here, and instead create src.o and src1.o.
--                set j 0
--                while { [lsearch $objfile_names $new_objfile] != -1 } {
--                    incr j
--                    set new_objfile \
--                        [concat tmpdir/[file rootname [file tail  [lindex $opt_val 0]]]${j}.o]
--                }
--		lappend objfile_names $new_objfile
--	    }
--	    default {
--		if [string length $opts($opt_name)] {
--		    perror "option $opt_name multiply set in $file.d"
--		    unresolved $subdir/$name
--		    return
--		}
--
--		# A single "# ld:" with no options should do the right thing.
--		if { $opt_name == "ld" } {
--		    set run_ld 1
--		}
--		# Likewise objcopy_linked_file.
--		if { $opt_name == "objcopy_linked_file" } {
--		    set run_objcopy 1
--		}
--	    }
--	}
--	if { $opt_name == "as" || $opt_name == "ld" } {
--	    set opt_val [subst $opt_val]
--	}
--
--	# Append differently whether it's a message (without space) or
--	# an option or list (with space).
--	switch -- $opt_name {
--	    warning -
--	    error {
--		append opts($opt_name) $opt_val
--	    }
--	    default {
--		set opts($opt_name) [concat $opts($opt_name) $opt_val]
--	    }
--	}
--    }
--
--    foreach i $extra_options {
--	set opt_name [lindex $i 0]
--	set opt_val [lindex $i 1]
--	if ![info exists opts($opt_name)] {
--	    perror "unknown option $opt_name given in extra_opts"
--	    unresolved $subdir/$name
--	    return
--	}
--	# Add extra option to end of existing option, adding space
--	# if necessary.
--	if { ![regexp "warning|error" $opt_name]
--	     && [string length $opts($opt_name)] } {
--	    append opts($opt_name) " "
--	}
--	append opts($opt_name) $opt_val
--    }
--
--    foreach opt { as ld } {
--	regsub {\[big_or_little_endian\]} $opts($opt) \
--	    [big_or_little_endian] opts($opt)
--    }
--
--    if { $opts(name) == "" } {
--	set testname "$subdir/$name"
--    } else {
--	set testname $opts(name)
--    }
--
--    # Decide early whether we should run the test for this target.
--    if { [llength $opts(noskip)] > 0 } {
--	set targmatch 0
--	foreach targ $opts(noskip) {
--	    if [match_target $targ] {
--		set targmatch 1
--		break
--	    }
--	}
--	if { $targmatch == 0 } {
--	    return
--	}
--    }
--    foreach targ $opts(anyskip) {
--	if ![match_target $targ] {
--	    return
--	}
--    }
--    foreach targ $opts(skip) {
--	if [match_target $targ] {
--	    return
--	}
--    }
--    if { [llength $opts(target)] > 0 } {
--	set targmatch 0
--	foreach targ $opts(target) {
--	    if [match_target $targ] {
--		set targmatch 1
--		break
--	    }
--	}
--	if { $targmatch == 0 } {
--	    unsupported $testname
--	    return
--	}
--    }
--    foreach targ $opts(alltargets) {
--	if ![match_target $targ] {
--	    unsupported $testname
--	    return
--	}
--    }
--    foreach targ $opts(notarget) {
--	if [match_target $targ] {
--	    unsupported $testname
--	    return
--	}
--    }
--
--    set program ""
--    # It's meaningless to require an output-testing method when we
--    # expect an error.
--    if { $opts(error) == "" && $opts(error_output) == "" } {
--	if {$opts(PROG) != ""} {
--	    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"
--		  unresolved $testname
--		  return }
--	    }
--	} else {
--	# Guess which program to run, by seeing which option was specified.
--	    foreach p {objdump objcopy nm readelf} {
--		if {$opts($p) != ""} {
--		    if {$program != ""} {
--			perror "ambiguous dump program in $file.d"
--			unresolved $testname
--			return
--		    } else {
--			set program $p
--		    }
--		}
--	    }
--	}
--	if { $program == "" \
--                 && $opts(map) == "" \
--                 && $opts(warning) == "" \
--                 && $opts(warning_output) == "" \
--                 && $opts(error) == "" \
--                 && $opts(error_output) == "" } {
--	    perror "dump program unspecified in $file.d"
--	    unresolved $testname
--	    return
--	}
--    }
--
--    if { $opts(source) == "" } {
--	set sourcefiles [list ${file}.s]
--	set asflags [list ""]
--	set objfile_names [list tmpdir/[file tail ${file}].o]
--    } else {
--	set sourcefiles {}
--	foreach sf $opts(source) {
--	    if { [string match "/*" $sf] } {
--		lappend sourcefiles "$sf"
--	    } else {
--		lappend sourcefiles "$srcdir/$subdir/$sf"
--	    }
--	}
--    }
--
--    if { $opts(dump) == "" } {
--	set dfile ${file}.d
--    } else {
--	set dfile $srcdir/$subdir/$opts(dump)
--    }
--
--    # Time to setup xfailures.
--    foreach targ $opts(xfail) {
--	setup_xfail $targ
--    }
--
--    # Assemble each file.
--    set objfiles {}
--    for { set i 0 } { $i < [llength $sourcefiles] } { incr i } {
--	set sourcefile [lindex $sourcefiles $i]
--	set sourceasflags [lindex $asflags $i]
--	set run_objcopy_objects 0
--
--	if { [string match "*RUN_OBJCOPY*" $sourceasflags] } {
--	    set run_objcopy_objects 1
--	}
--	regsub "RUN_OBJCOPY" $sourceasflags "" sourceasflags
--
--	set objfile [lindex $objfile_names $i]
--	catch "exec rm -f $objfile" exec_output
--	lappend objfiles $objfile
--	set cmd "$AS $ASFLAGS $opts(as) $sourceasflags -o $objfile $sourcefile"
--
--	send_log "$cmd\n"
--	set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
--	remote_upload host "ld.tmp"
--	set comp_output [prune_warnings [file_contents "ld.tmp"]]
--	remote_file host delete "ld.tmp"
--	remote_file build delete "ld.tmp"
--
--	if { [lindex $cmdret 0] != 0 || ![string match "" $comp_output] } then {
--	    send_log -- "$comp_output\n"
--	    verbose "$comp_output" 3
--
--	    set exitstat "succeeded"
--	    if { $cmdret != 0 } { set exitstat "failed" }
--	    verbose -log "$exitstat with: <$comp_output>"
--	    fail $testname
--	    return
--	}
--
--	if { $run_objcopy_objects } {
--	    set cmd "$OBJCOPY $opts(objcopy_objects) $objfile"
--
--	    send_log "$cmd\n"
--	    set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] \
--			"" "/dev/null" "objcopy.tmp"]
--	    remote_upload host "objcopy.tmp"
--	    set comp_output [prune_warnings [file_contents "objcopy.tmp"]]
--	    remote_file host delete "objcopy.tmp"
--	    remote_file build delete "objcopy.tmp"
--
--	    if { [lindex $cmdret 0] != 0 \
--		  || ![string match "" $comp_output] } {
--		send_log -- "$comp_output\n"
--		verbose "$comp_output" 3
--
--		set exitstat "succeeded"
--		if { $cmdret != 0 } { set exitstat "failed" }
--		verbose -log "$exitstat with: <$comp_output>"
--		fail $testname
--		return
--	    }
--	}
--    }
--
--    if { (($opts(warning) != "") && ($opts(error) != "")) \
--	 || (($opts(warning) != "") && ($opts(error_output) != "")) \
--	 || (($opts(warning) != "") && ($opts(warning_output) != "")) \
--	 || (($opts(error) != "") && ($opts(warning_output) != "")) \
--	 || (($opts(error) != "") && ($opts(error_output) != "")) \
--	 || (($opts(warning_output) != "") && ($opts(error_output) != "")) } {
--	perror "$testname: bad mix of warning, error, warning_output, and error_output test-directives"
--	unresolved $testname
--	return
--    }
--
--    set check_ld(source) ""
--    set check_ld(terminal) 0
--    if { $opts(error) != "" \
--         || $opts(warning) != "" \
--         || $opts(error_output) != "" \
--         || $opts(warning_output) != "" } {
--
--        if { $opts(error) != "" || $opts(error_output) != "" } {
--            set check_ld(terminal) 1
--        } else {
--            set check_ld(terminal) 0
--        }
--
--        if { $opts(error) != "" || $opts(warning) != "" } {
--            set check_ld(source) "regex"
--            if { $opts(error) != "" } {
--                set check_ld(regex) $opts(error)
--            } else {
--                set check_ld(regex) $opts(warning)
--            }
--        } else {
--            set check_ld(source) "file"
--            if { $opts(error_output) != "" } {
--                set check_ld(file) $opts(error_output)
--            } else {
--                set check_ld(file) $opts(warning_output)
--            }
--        }
--    }
--
--    # Perhaps link the file(s).
--    if { $run_ld } {
--	set objfile "tmpdir/dump"
--	catch "exec rm -f $objfile" exec_output
--
--	# Add -L$srcdir/$subdir so that the linker command can use
--	# linker scripts in the source directory.
--	set cmd "$LD --hash-style=sysv --no-warn-shared-textrel $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
--		   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
--
--        # If needed then check for, or add a -Map option.
--        set mapfile ""
--        if { $opts(map) != "" } then {
--            if { [regexp -- "-Map=(\[^ \]+)" $cmd all mapfile] } then {
--                # Found existing mapfile option
--                verbose -log "Existing mapfile '$mapfile' found"
--            } else {
--                # No mapfile option.
--                set mapfile "tmpdir/dump.map"
--                verbose -log "Adding mapfile '$mapfile'"
--                set cmd "$cmd -Map=$mapfile"
--            }
--        }
--
--	send_log "$cmd\n"
--	set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
--	remote_upload host "ld.tmp"
--	set comp_output [file_contents "ld.tmp"]
--	remote_file host delete "ld.tmp"
--	remote_file build delete "ld.tmp"
--	set cmdret [lindex $cmdret 0]
--
--	if { $cmdret == 0 && $run_objcopy } {
--	    set infile $objfile
--	    set objfile "tmpdir/dump1"
--	    remote_file host delete $objfile
--
--	    # Note that we don't use OBJCOPYFLAGS here; any flags must be
--	    # explicitly specified.
--	    set cmd "$OBJCOPY $opts(objcopy_linked_file) $infile $objfile"
--
--	    send_log "$cmd\n"
--	    set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
--	    remote_upload host "ld.tmp"
--	    append comp_output [file_contents "ld.tmp"]
--	    remote_file host delete "ld.tmp"
--	    remote_file build delete "ld.tmp"
--	    set cmdret [lindex $cmdret 0]
--	}
--
--	regsub "\n$" $comp_output "" comp_output
--	if { $cmdret != 0 || $comp_output != "" || $check_ld(source) != "" } then {
--	    set exitstat "succeeded"
--	    if { $cmdret != 0 } { set exitstat "failed" }
--
--            if { $check_ld(source) == "regex" } {
--                verbose -log "$exitstat with: <$comp_output>, expected: <$check_ld(regex)>"
--            } elseif { $check_ld(source) == "file" } {
--                verbose -log "$exitstat with: <$comp_output>, expected in file $check_ld(file)"
--                set_file_contents "tmpdir/ld.messages" "$comp_output"
--            } else {
--                verbose -log "$exitstat with: <$comp_output>, no expected output"
--            }
--	    send_log -- "$comp_output\n"
--	    verbose "$comp_output" 3
--
--	    if { (($check_ld(source) == "") == ($comp_output == "")) \
--                 && (($cmdret == 0) == ($check_ld(terminal) == 0)) \
--                 && ((($check_ld(source) == "regex") \
--                      && ($check_ld(regex) == "") == ($comp_output == "") \
--                      && [regexp -- $check_ld(regex) $comp_output]) \
--                     || (($check_ld(source) == "file") \
--                         && (![regexp_diff "tmpdir/ld.messages" "$srcdir/$subdir/$check_ld(file)"]))) } {
--                # We have the expected output from ld.
--		if { $check_ld(terminal) || $program == "" } {
--		    pass $testname
--		    return
--		}
--	    } else {
--		fail $testname
--		return
--	    }
--	}
--
--        if { $opts(map) != "" } then {
--            # Check the map file matches.
--            set map_pattern_file $srcdir/$subdir/$opts(map)
--            verbose -log "Compare '$mapfile' against '$map_pattern_file'"
--            if { [regexp_diff $mapfile $map_pattern_file] } then {
--                fail "$testname (map file check)"
--            } else {
--                pass "$testname (map file check)"
--            }
--
--            if { $program == "" } then {
--                return
--            }
--        }
--    } else {
--	set objfile [lindex $objfiles 0]
--    }
--
--    # We must not have expected failure if we get here.
--    if { $opts(error) != "" } {
--	fail $testname
--	return
--    }
--
--    set progopts1 $opts($program)
--    eval set progopts \$[string toupper $program]FLAGS
--    eval set binary \$[string toupper $program]
--
--    if { ![is_remote host] && [which $binary] == 0 } {
--	untested $testname
--	return
--    }
--
--    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)]} {
--	set old_lc_all $env(LC_ALL)
--    }
--    set env(LC_ALL) "C"
--    send_log "$cmd\n"
--    set cmdret [remote_exec host [concat sh -c [list "$cmd 2>ld.tmp"]] "" "/dev/null"]
--    set cmdret [lindex $cmdret 0]
--    remote_upload host "ld.tmp"
--    set comp_output [prune_warnings [file_contents "ld.tmp"]]
--    remote_file host delete "ld.tmp"
--    remote_file build delete "ld.tmp"
--    if {[info exists old_lc_all]} {
--	set env(LC_ALL) $old_lc_all
--    } else {
--	unset env(LC_ALL)
--    }
--    if { $cmdret != 0 || $comp_output != "" } {
--	send_log "exited abnormally with $cmdret, output:$comp_output\n"
--	fail $testname
--	return
--    }
--
--    if { $verbose > 2 } then { verbose "output is [file_contents $dumpfile]" 3 }
--    if { [regexp_diff $dumpfile "${dfile}"] } then {
--	fail $testname
--	if { $verbose == 2 } then { verbose "output is [file_contents $dumpfile]" 2 }
--	return
--    }
--
--    pass $testname
--}
--
--proc slurp_options { file } {
--    # If options_regsub(foo) is set to {a b}, then the contents of a
--    # "#foo:" line will have regsub -all applied to replace a with b.
--    global options_regsub
--
--    if [catch { set f [open $file r] } x] {
--	#perror "couldn't open `$file': $x"
--	perror "$x"
--	return -1
--    }
--    set opt_array {}
--    # whitespace expression
--    set ws  {[ 	]*}
--    set nws {[^ 	]*}
--    # whitespace is ignored anywhere except within the options list;
--    # option names are alphabetic plus underscore only.
--    set pat "^#${ws}(\[a-zA-Z_\]*)$ws:${ws}(.*)$ws\$"
--    while { [gets $f line] != -1 } {
--	set line [string trim $line]
--	# Whitespace here is space-tab.
--	if [regexp $pat $line xxx opt_name opt_val] {
--	    # match!
--	    if [info exists options_regsub($opt_name)] {
--		set subst $options_regsub($opt_name)
--		regsub -all -- [lindex $subst 0] $opt_val [lindex $subst 1] \
--		    opt_val
--	    }
--	    lappend opt_array [list $opt_name $opt_val]
--	} else {
--	    break
--	}
--    }
--    close $f
--    return $opt_array
--}
--
--proc file_contents { filename } {
--    set file [open $filename r]
--    set contents [read $file]
--    close $file
--    return $contents
--}
--
--proc set_file_contents { filename contents } {
--    set file [open $filename w]
--    puts $file "$contents"
--    close $file
--}
--
- # Create an archive using ar
- #
- proc ar_simple_create { ar aropts target objects } {
--- 
-2.26.2
-

diff --git a/9999/0015-Gentoo-Adapt-generic-test-library-to-our-linker-sett.patch b/9999/0015-Gentoo-Adapt-generic-test-library-to-our-linker-sett.patch
deleted file mode 100644
index 8ac5654..0000000
--- a/9999/0015-Gentoo-Adapt-generic-test-library-to-our-linker-sett.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 782c17148cc2a663778c03bb6f78412e79593df4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Sun, 10 May 2020 20:24:33 +0300
-Subject: [PATCH 15/16] Gentoo: Adapt generic test library to our linker
- settings
-
----
- binutils/testsuite/lib/binutils-common.exp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
-index b9e3c6d817..bb4ef987b3 100644
---- a/binutils/testsuite/lib/binutils-common.exp
-+++ b/binutils/testsuite/lib/binutils-common.exp
-@@ -1125,7 +1125,7 @@ proc run_dump_test { name {extra_options {}} } {
- 
-             # Add -L$srcdir/$subdir so that the linker command can use
-             # linker scripts in the source directory.
--            set cmd "$LD $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
-+            set cmd "$LD --hash-style=sysv --no-warn-shared-textrel $ld_extra_opt $LDFLAGS -L$srcdir/$subdir \
- 		   $opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
- 
-             # If needed then check for, or add a -Map option.
--- 
-2.26.2
-

diff --git a/9999/0016-Gentoo-Fix-regexp-of-hilarious-ld-detection-heuristi.patch b/9999/0016-Gentoo-Fix-regexp-of-hilarious-ld-detection-heuristi.patch
deleted file mode 100644
index be9f677..0000000
--- a/9999/0016-Gentoo-Fix-regexp-of-hilarious-ld-detection-heuristi.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 6e0ff9dfef58d03eacc05ef381ef1d5fc7ad072d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Sun, 10 May 2020 20:59:05 +0300
-Subject: [PATCH 16/16] Gentoo: Fix regexp of hilarious ld detection heuristic
-
-The new linker used to be called as "ld/ld-new" but is now called as "./ld-new"
-Test for just "ld-new" and hope that the compiler binary never looks like this.
----
- ld/testsuite/lib/ld-lib.exp | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
-index ae72f21d72..0b945b539d 100644
---- a/ld/testsuite/lib/ld-lib.exp
-+++ b/ld/testsuite/lib/ld-lib.exp
-@@ -200,9 +200,9 @@ proc default_ld_link { ld target objects } {
-     # with $ld as parameter. If we want to change the default behaviour, we
-     # need to take the different option formats into account.
-     # We check the $ld parameter for
--    # - .*ld/ld-new    -> we're working with the new linker
-+    # - ld-new         -> we're working with the new linker
-     # - otherwise      -> we're likely working with the system compiler
--    if {[regexp {ld/ld-new$} $ld]} {
-+    if {[regexp {ld-new$} $ld]} {
-       set gentoosysv "--hash-style=sysv --no-warn-shared-textrel"
-     } else {
-       set gentoosysv "-Wl,--hash-style=sysv -Wl,--no-warn-shared-textrel"
--- 
-2.26.2
-


^ permalink raw reply related	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2025-05-14  7:14 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-20 19:53 [gentoo-commits] proj/toolchain/binutils-patches:master commit in: 9999/ Andreas K. Hüttel
  -- strict thread matches above, loose matches on Subject: below --
2025-05-14  7:14 Sam James
2025-05-14  3:59 Sam James
2025-05-05  9:46 Sam James
2025-05-05  3:06 Sam James
2025-05-04 10:15 Sam James
2025-04-10 17:35 Sam James
2025-04-09  2:24 Sam James
2025-04-08  0:36 Sam James
2025-03-29 14:18 Sam James
2025-03-12 20:21 Sam James
2025-03-06 12:54 Sam James
2025-03-06  4:54 Sam James
2025-02-03 18:02 Andreas K. Hüttel
2025-01-14  2:09 Sam James
2025-01-13  6:11 Sam James
2025-01-02 13:48 Sam James
2025-01-01 14:05 Sam James
2024-12-26  1:21 Sam James
2024-12-24  6:27 Sam James
2024-12-21  0:09 Sam James
2024-08-03 22:43 Andreas K. Hüttel
2024-06-29 17:05 Andreas K. Hüttel
2024-06-29 16:32 Andreas K. Hüttel
2024-06-29 16:32 Andreas K. Hüttel
2024-06-28 21:48 Andreas K. Hüttel
2023-10-27  0:44 Sam James
2023-10-27  0:44 Sam James
2023-07-30 14:49 Andreas K. Hüttel
2023-07-28 16:23 Andreas K. Hüttel
2023-06-30  9:21 WANG Xuerui
2023-04-02 11:44 Andreas K. Hüttel
2023-01-05 16:22 Andreas K. Hüttel
2023-01-05 16:21 Andreas K. Hüttel
2023-01-03 23:03 Andreas K. Hüttel
2023-01-02 23:50 Andreas K. Hüttel
2022-10-08 12:15 WANG Xuerui
2022-07-29  7:55 WANG Xuerui
2022-01-15 22:27 Andreas K. Hüttel
2021-08-17 20:07 Andreas K. Hüttel
2021-07-30 23:25 Andreas K. Hüttel
2021-07-24 20:57 Andreas K. Hüttel
2021-07-20 19:50 Andreas K. Hüttel
2021-07-06  7:04 Sergei Trofimovich
2021-07-06  7:04 Sergei Trofimovich
2021-07-06  7:04 Sergei Trofimovich
2020-07-25 17:27 Andreas K. Hüttel
2020-07-25 12:26 Andreas K. Hüttel
2020-07-25 12:23 Andreas K. Hüttel
2020-07-25 12:20 Andreas K. Hüttel
2020-05-19 21:12 Andreas K. Hüttel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox