This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: PR 1025: binutils failed to build gcc 4.0.1 20050619
On Thu, Jun 23, 2005 at 06:51:45AM -0700, H. J. Lu wrote:
> On Thu, Jun 23, 2005 at 06:37:03AM -0700, H. J. Lu wrote:
> > On Thu, Jun 23, 2005 at 11:26:49AM +0930, Alan Modra wrote:
> > > On Mon, Jun 20, 2005 at 11:15:33AM -0700, H. J. Lu wrote:
> > > > PR 1025
> > > > * elf-m10300.c (mn10300_elf_check_relocs): Handle indirect
> > > > symbol.
> > > [snip]
> > > > --- bfd/elf-m10300.c.got 2005-05-07 06:58:08.000000000 -0700
> > > > +++ bfd/elf-m10300.c 2005-06-20 10:55:33.000000000 -0700
> > > > @@ -717,7 +717,12 @@ mn10300_elf_check_relocs (abfd, info, se
> > > > if (r_symndx < symtab_hdr->sh_info)
> > > > h = NULL;
> > > > else
> > > > - h = sym_hashes[r_symndx - symtab_hdr->sh_info];
> > > > + {
> > > > + h = sym_hashes[r_symndx - symtab_hdr->sh_info];
> > > > + while (h->root.type == bfd_link_hash_indirect
> > > > + || h->root.type == bfd_link_hash_warning)
> > > > + h = (struct elf_link_hash_entry *) h->root.u.i.link;
> > > > + }
> > > >
> > > > /* Some relocs require a global offset table. */
> > > > if (dynobj == NULL)
> > > [snip]
> > >
> > > Can you do the indirect sym lookup in elf_link_add_object_symbols
> > > instead? Seems like elf_link_add_object_symbols already tries to do
> > > this, but I guess doesn't get it right in all cases.
> > >
> >
> > The problem is
> >
> > [hjl@gnu-3 got]$ readelf -s --wide compatibility.o | grep
> > _ZNSi6ignoreEv
> > 83: 00000000 244 FUNC GLOBAL DEFAULT 68 _X_ZNSi6ignoreEv
> > 109: 00000000 244 FUNC GLOBAL DEFAULT 68 _Y_ZNSi6ignoreEv
> > 164: 00000000 244 FUNC WEAK DEFAULT 68 _ZNSi6ignoreEv
> > 188: 00000000 244 FUNC GLOBAL DEFAULT 68 _ZNSi6ignoreEv@GLIBCXX_3.4
> > 214: 00000000 244 FUNC GLOBAL DEFAULT 68 _ZNSi6ignoreEv@@GLIBCXX_3.4.5
> >
> > and the relocation is against _ZNSi6ignoreEv. elf_link_add_object_symbols
> > doesn't change it to ZNSi6ignoreEv@@GLIBCXX_3.4.5 when it turns
> > _ZNSi6ignoreEv from bfd_link_hash_defweak to bfd_link_hash_indirect.
> >
>
> I think it will be very expensive to update all hashes when we turn a
> symbol from bfd_link_hash_defweak to bfd_link_hash_indirect.
>
>
We missed this one when an indirect symbol is overridden by aother
one.
H.J.
-----
2005-06-23 H.J. Lu <hongjiu.lu@intel.com>
* elflink.c (_bfd_elf_add_default_symbol): Copy indirect symbol
when it is overridden by another symbol.
--- bfd/elflink.c.ind 2005-06-22 13:16:26.000000000 -0700
+++ bfd/elflink.c 2005-06-23 07:59:10.596317798 -0700
@@ -1430,6 +1430,8 @@ _bfd_elf_add_default_symbol (bfd *abfd,
0, name, FALSE, collect, &bh)))
return FALSE;
hi = (struct elf_link_hash_entry *) bh;
+ if (hi->root.type == bfd_link_hash_indirect)
+ (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
}
else
{