This is the mail archive of the
mailing list for the binutils project.
Re: Fix 16846, LTO mismatched TLS reference
- 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: Thu, 17 Apr 2014 09:48:19 +0930
- Subject: Re: Fix 16846, LTO mismatched TLS reference
- Authentication-results: sourceware.org; auth=none
- References: <20140416094446 dot GZ13391 at bubble dot grove dot modra dot org> <CAMe9rOqhR1gcZKURkMFWB4YUu+TBrUxMdAfB8Qg9TX3hJ4MLGQ at mail dot gmail dot com>
On Wed, Apr 16, 2014 at 08:16:28AM -0700, H.J. Lu wrote:
> On Wed, Apr 16, 2014 at 2:44 AM, Alan Modra <email@example.com> wrote:
> > I think this is all we need to fix pr16848. HJ, do you see anything
> > more we should do here? I'm wondering why we have type_change_ok
> > when oldbfd is the plugin.
> It is because there is no symbol type in plugin.
That is precisely why you should *not* need to set type_change_ok!
If the old symbol is STT_NOTYPE, then it will not cause a warning
that "type of symbol ... changed". The following seems to be good,
but I wanted to ask you first since this is your code..
* elflink.c (_bfd_elf_merge_symbol): Ignore TLS mismatch when
current bfd is a plugin. Don't always set type_change_ok
when old bfd is a plugin.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 3de00e1..6756fb1 100644
@@ -1105,15 +1105,14 @@ _bfd_elf_merge_symbol (bfd *abfd,
- /* Plugin symbol type isn't currently set. Stop bogus errors. */
- if (oldbfd != NULL && (oldbfd->flags & BFD_PLUGIN) != 0)
- *type_change_ok = TRUE;
- /* Check TLS symbol. We don't check undefined symbol introduced by
- "ld -u". */
- else if (oldbfd != NULL
- && ELF_ST_TYPE (sym->st_info) != h->type
- && (ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS))
+ /* Check TLS symbols. We don't check undefined symbols introduced
+ by "ld -u" which have no type (and oldbfd NULL), and we don't
+ check symbols from plugins because they also have no type. */
+ if (oldbfd != NULL
+ && (oldbfd->flags & BFD_PLUGIN) == 0
+ && (abfd->flags & BFD_PLUGIN) == 0
+ && ELF_ST_TYPE (sym->st_info) != h->type
+ && (ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS))
bfd *ntbfd, *tbfd;
bfd_boolean ntdef, tdef;
Australia Development Lab, IBM