This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: Fix flipping indirect symbol
On Sat, Apr 26, 2003 at 09:49:47PM -0700, H. J. Lu wrote:
> On Sat, Apr 26, 2003 at 12:20:23AM -0700, H. J. Lu wrote:
> > On Fri, Apr 25, 2003 at 11:25:34PM -0700, H. J. Lu wrote:
> > > On Fri, Apr 25, 2003 at 08:20:33AM -0700, H. J. Lu wrote:
> > > > On Fri, Apr 25, 2003 at 09:58:17AM -0400, Daniel Jacobowitz wrote:
> > > > > On Sat, Apr 19, 2003 at 08:50:48AM +0930, Alan Modra wrote:
> > > > > > On Thu, Apr 17, 2003 at 04:27:43PM -0400, Daniel Jacobowitz wrote:
> > > > > > > On Tue, Feb 25, 2003 at 01:28:12PM +1030, Alan Modra wrote:
> > > > > > > > Hi Daniel,
> > > > > > > > This patch cures your testcase, but I'm not game to install it
> > > > > > > > without a whole lot of testing, which I don't have time to do at
> > > > > > > > the moment.
> > > > > > >
> > > > > > > The logic seems right to me; what kind of testing can I do to increase
> > > > > > > your confidence? I'd like to pick this fix up for the next release.
> > > > > >
> > > > > > At the minimum, a glibc build and "make check". Preferably, a bunch
> > > > > > of other packages that build and use shared libs.
> > > > >
> > > > > It causes no regressions in the binutils or glibc testsuites on
> > > > > i686-pc-linux-gnu; Roland reported that it fixed his problem on
> > > > > powerpc-linux-gnu; and it fixes the vers25b2 testcase that HJ checked
> > > > > in a few days ago on i686-pc-linux-gnu. That's enough to convince me.
> > > > >
> > > >
> > > > I checked in it. We will fix it if it breaks anything, which I believe
> > > > is very unlikely.
> > > >
> > >
> > > I was right and also wrong. Alan's patch does fix the testcase. But it
> > > is incomplete. I have a weird large program. I got
> > >
> > > /export/build/gnu/binutils-debug/build-i686-linux/ld/ld-new: BFD 2.13.90
> > > 20030426 internal error, aborting at
> > > /export/gnu/src/binutils/binutils/bfd/elf32-i386.c line 2356 in
> > > elf_i386_relocate_section
> > >
> > > with the new linker. The patch enclosed here seems to fix it. I will
> > > try to come up with a small testcase later. The question is if my
> > > patch is enough and if I missed something else.
> > >
> > >
> > > H.J.
> >
> > > 2003-04-25 H.J. Lu <hjl at gnu dot org>
> > >
> > > * elflink.h (elf_merge_symbol): Also copy got.offset and
> > > plt.offset when we flip the indirection.
> > >
> >
>
> Alan, we need to add elf_backend_flip_indirect_symbol to flip an
> indirect symbol with a defintion since each backend may have
> additional information we need to copy. We should treat it
> similar to copying indirect symbol. I don't think backing out
> your current patch will make linker any better. But we need to
> fix it soon.
>
I believe this patch does the trick.
H.J.
---
2003-04-27 H.J. Lu <hjl at gnu dot org>
* elflink.h (elf_merge_symbol): Call elf_backend_copy_indirect_symbol
to copy any information related to dynamic linking when we flip
the indirection.
--- bfd/elflink.h.flip 2003-04-25 09:47:03.000000000 -0700
+++ bfd/elflink.h 2003-04-27 20:19:26.000000000 -0700
@@ -955,10 +955,12 @@ elf_merge_symbol (abfd, info, name, sym,
/* Handle the case where we had a versioned symbol in a dynamic
library and now find a definition in a normal object. In this
case, we make the versioned symbol point to the normal one. */
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
flip->root.type = h->root.type;
- flip->root.u.undef.abfd = h->root.u.undef.abfd;
h->root.type = bfd_link_hash_indirect;
h->root.u.i.link = (struct bfd_link_hash_entry *) flip;
+ (*bed->elf_backend_copy_indirect_symbol) (bed, flip, h);
+ flip->root.u.undef.abfd = h->root.u.undef.abfd;
if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
{
h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;