This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RFC PATCH, binutils, ELF 9/11] Add support for creating import libraries
- From: Nick Clifton <nickc at redhat dot com>
- To: Thomas Preudhomme <thomas dot preudhomme at foss dot arm dot com>
- Cc: Alan Modra <amodra at gmail dot com>, "Richard Earnshaw (lists)" <Richard dot Earnshaw at arm dot com>, binutils at sourceware dot org
- Date: Mon, 18 Jul 2016 12:00:31 +0100
- Subject: Re: [RFC PATCH, binutils, ELF 9/11] Add support for creating import libraries
- Authentication-results: sourceware.org; auth=none
- References: <005201d13d58$0d5314a0$27f93de0$@foss.arm.com> <4238174.utMsidehWI@e108577-lin> <20160716133852.GN1256@bubble.grove.modra.org> <20406296.IDmVSFSBlq@e108577-lin> <20160718103108.GQ1256@bubble.grove.modra.org>
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);
}
}