This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH, binutils, ELF 9/11] Add support for creating import libraries


Hi Thomas,

> - mipstx39-elf segfault.

The attached patch should fix this particular problem.  Plus stop an assertion
from triggering in the dlx target.  Please consider including this in your full 
patch to fix the other problems.

Cheers
  Nick

PS.  Sorry for not testing your patch locally before approving.  I looked over
  the new tests and they looked fine to me, but obviously I missed the problems
  that they would cause for some targets.

diff --git a/bfd/elf.c b/bfd/elf.c
index ebcf40a..2d5f69c 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3893,9 +3893,10 @@ _bfd_elf_filter_global_symbols (bfd *abfd, struct bfd_link_info *info,
 	continue;
 
       h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, FALSE);
+      if (h == NULL)
+	continue;
       if (h->type != bfd_link_hash_defined && h->type != bfd_link_hash_defweak)
 	continue;
-
       if (h->linker_def || h->ldscript_def)
 	continue;
 
@@ -7641,7 +7642,9 @@ error_return:
 		     section of a symbol to be a section that is
 		     actually in the output file.  */
 		  sec2 = bfd_get_section_by_name (abfd, sec->name);
-		  if (sec2 == NULL)
+		  if (sec2 != NULL)
+		    shndx = _bfd_elf_section_from_bfd_section (abfd, sec2);
+		  if (shndx == SHN_BAD)
 		    {
 		      _bfd_error_handler (_("\
 Unable to find equivalent output section for symbol '%s' from section '%s'"),
@@ -7650,9 +7653,6 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"),
 		      bfd_set_error (bfd_error_invalid_operation);
 		      goto error_return;
 		    }
-
-		  shndx = _bfd_elf_section_from_bfd_section (abfd, sec2);
-		  BFD_ASSERT (shndx != SHN_BAD);
 		}
 	    }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]