PATCH: PR ld/13962: Misleading error message when linking a library with an empty library
H.J. Lu
hjl.tools@gmail.com
Wed May 16 03:44:00 GMT 2012
On Tue, May 15, 2012 at 8:35 PM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, May 14, 2012 at 06:50:29AM -0700, H.J. Lu wrote:
>> Linker should ignore object without symbols. OK to install?
>
> No. elf_link_add_object_symbols does more than just read symbols.
> While it would be unusual to have relocs without symbols, or need to
> run check_directives without symbols, I think we should not ignore
> those possibilities.
>
> Also, having .dynsym sh_info == 1 when sh_size == 0 is somewhat
> broken. Ah yes, I knew I'd seen something like this before.
> http://sourceware.org/bugzilla/show_bug.cgi?id=7023 is the same
> problem but with .symtab. For that bug I grumpily decided to make ld
> reject the object file. We could do the same here, but I think GNU ld
> itself used to set sh_info wrongly, it's not too hard to fix the bad
> input, and I'm feeling generous. So..
>
> PR ld/13962
> PR ld/7023
> * elf.c (bfd_section_from_shdr): Fail when .dynsym sh_info is
> out of range. As a special case, fix sh_info for zero sh_size.
> Do the same for .symtab.
>
FWIW, gold accepts the DSO without dynamic symbols. ld and
gold should be consistent. Ian, Cary, what do you think?
--
H.J.
More information about the Binutils
mailing list