This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/13962: Misleading error message when linking a library with an empty library
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Cc: Ian Lance Taylor <iant at google dot com>, Cary Coutant <ccoutant at google dot com>
- Date: Tue, 15 May 2012 20:44:01 -0700
- Subject: Re: PATCH: PR ld/13962: Misleading error message when linking a library with an empty library
- References: <20120514135029.GA22534@intel.com> <20120516033537.GG10674@bubble.grove.modra.org>
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.