This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Linker failed to handle symbols with mismatched types
On Thu, Mar 09, 2006 at 06:30:12PM -0800, H. J. Lu wrote:
> On Thu, Mar 02, 2006 at 06:39:10AM -0800, H. J. Lu wrote:
> > On Thu, Mar 02, 2006 at 12:43:17PM +1030, Alan Modra wrote:
> > > On Tue, Feb 28, 2006 at 01:48:22PM -0800, H. J. Lu wrote:
> > > > PR ld/2404
> > > > * elflink.c (_bfd_elf_merge_symbol): Skip the default indirect
> > > > symbol from the dynamic definition with the default version if
> > > > its type and the type of exiting regular definition mismatch.
> > >
> > > I think the concept is reasonable, but I'd like to hear Ian's opinion
> > > before giving an OK. Also, I'm wondering if you should check for type
> > > mismatches earlier, to avoid errors with tls syms.
> >
> > Here is the updated patch.
> >
>
> Can someone please take a look at
>
> http://sourceware.org/ml/binutils/2006-03/msg00018.html
Here is the updated patch. We only skip the default indirect symbol if
the exiting regular definition won't be dynamic.
H.J.
----
2006-03-09 H.J. Lu <hongjiu.lu@intel.com>
PR ld/2404
* elflink.c (_bfd_elf_merge_symbol): Skip the default indirect
symbol from the dynamic definition with the default version if
its type and the type of exiting regular definition mismatch.
--- bfd/elflink.c.mis 2006-03-09 09:43:10.000000000 -0800
+++ bfd/elflink.c 2006-03-09 19:41:16.000000000 -0800
@@ -888,6 +888,26 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& h->root.type != bfd_link_hash_undefweak
&& h->root.type != bfd_link_hash_common);
+ /* When we try to create a default indirect symbol from the dynamic
+ definition with the default version, we skip it if its type and
+ the type of exiting regular definition mismatch. We only do it
+ if the exiting regular definition won't be dynamic. */
+ if (pold_alignment == NULL
+ && !info->shared
+ && !info->export_dynamic
+ && !h->ref_dynamic
+ && newdyn
+ && newdef
+ && !olddyn
+ && (olddef || h->root.type == bfd_link_hash_common)
+ && ELF_ST_TYPE (sym->st_info) != h->type
+ && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
+ && h->type != STT_NOTYPE)
+ {
+ *skip = TRUE;
+ return TRUE;
+ }
+
/* Check TLS symbol. We don't check undefined symbol introduced by
"ld -u". */
if ((ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS)