This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR ld/18720: Properly merge hidden versioned symbol
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Tue, 22 Nov 2016 10:44:15 +1030
- Subject: Re: [PATCH] PR ld/18720: Properly merge hidden versioned symbol
- Authentication-results: sourceware.org; auth=none
- References: <20150726221550.GA16472@gmail.com> <20150801140704.GA23091@gmail.com> <CAMe9rOq5JxRTi8g8LX3TxjjL-g9+W-2voin2cvaoESPBNDNvuQ@mail.gmail.com> <20161121030919.GD11815@bubble.grove.modra.org> <CAMe9rOqQjRNuaS-FvZ-3w6fNUNfwJq3CifmKkscSUCE_tcQfEw@mail.gmail.com>
On Mon, Nov 21, 2016 at 01:09:20PM -0800, H.J. Lu wrote:
> On Sun, Nov 20, 2016 at 7:09 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Wed, Aug 05, 2015 at 07:43:21PM -0700, H.J. Lu wrote:
> >> I will check it in this Friday unless there is an objection.
> >
> > HJ, git 6e33951edc change to elf_link_output_extsym where you
> > introduce local_bind, is broken. You can't change global syms to
> > STB_LOCAL that late, after _bfd_elf_link_renumber_dynsyms, as otherwise
> > you run the risk of ordering STB_LOCAL symbols after global symbols.
> > The ELF gABI is clear that "all symbols with STB_LOCAL binding precede
> > the weak and global symbols". (It's also wrong to test flags on a
> > bfd_link_hash_warning symbol.)
> >
> > I don't have a testcase for you. I noticed the bug when looking at
> > PR20828. Please revert the elf_link_output_extsym change and
> > implement by setting forced_local before the last run of
> > _bfd_elf_link_renumber_dynsyms.
> >
>
> How about this patch?
OK thanks, it looks almost the same as the one I threw together.
You could also move the code hiding weak undefined non-default
visibility symbols.
/* If a weak undefined symbol has non-default visibility, we also
hide it from the dynamic linker. */
if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
&& h->root.type == bfd_link_hash_undefweak)
(*bed->elf_backend_hide_symbol) (eif->info, h, TRUE);
/* A hidden versioned symbol in executable should be forced local if
it is is locally defined, not referenced by shared library and not
exported. */
else if (bfd_link_executable (eif->info)
etc.
--
Alan Modra
Australia Development Lab, IBM