[binutils-gdb] Revert "objcopy fixes for commit 68bbe1183379"

Alan Modra amodra@sourceware.org
Tue Oct 8 05:26:59 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=22ad34b314b4597d6fb9a261891726c8d94f2893

commit 22ad34b314b4597d6fb9a261891726c8d94f2893
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Oct 8 09:47:47 2024 +1030

    Revert "objcopy fixes for commit 68bbe1183379"
    
    This reverts commit ef166f451fbc2c7b251a251ab23cd35b36c5ee23.

Diff:
---
 binutils/objcopy.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 2ed1afbb8cb..24e31cc5805 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1251,9 +1251,6 @@ is_specified_symbol_predicate (void **slot, void *data)
 static bool
 is_specified_symbol (const char *name, htab_t htab)
 {
-  if (name == NULL)
-    return false;
-
   if (wildcard)
     {
       struct is_specified_symbol_predicate_data data;
@@ -1579,9 +1576,6 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
       bool rem_leading_char;
       bool add_leading_char;
 
-      if (name == NULL)
-	continue;
-
       undefined = bfd_is_und_section (bfd_asymbol_section (sym));
 
       if (add_sym_list)
@@ -1596,14 +1590,14 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
 	{
 	  char *new_name;
 
-	  if (name[0] == '_'
+	  if (name != NULL
+	      && name[0] == '_'
 	      && name[1] == '_'
 	      && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
 	    {
-	      fatal (_("redefining symbols does not work"
-		       " on LTO-compiled object files"));
+	      fatal (_("redefining symbols does not work on LTO-compiled object files"));
 	    }
-
+	  
 	  new_name = (char *) lookup_sym_redefinition (name);
 	  if (new_name == name
 	      && (flags & BSF_SECTION_SYM) != 0)
@@ -2962,7 +2956,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
 	  pset = find_section_list (padd->name, false,
 				    SECTION_CONTEXT_SET_FLAGS);
 	  if (pset != NULL)
-	    {
+	    {	      
 	      flags = pset->flags | SEC_HAS_CONTENTS;
 	      flags = check_new_section_flags (flags, obfd, padd->name);
 	    }


More information about the Binutils-cvs mailing list