PATCH: Re: Versioned symbol linking bug

H. J. Lu hjl@lucon.org
Sat Apr 26 06:25:00 GMT 2003


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.
-------------- next part --------------
2003-04-25  H.J. Lu <hjl@gnu.org>

	* elflink.h (elf_merge_symbol): Also copy got.offset and
	plt.offset when we flip the indirection.

--- bfd/elflink.h.flip	2003-04-25 09:47:03.000000000 -0700
+++ bfd/elflink.h	2003-04-25 23:17:56.000000000 -0700
@@ -957,6 +957,8 @@ elf_merge_symbol (abfd, info, name, sym,
 	 case, we make the versioned symbol point to the normal one.  */
       flip->root.type = h->root.type;
       flip->root.u.undef.abfd = h->root.u.undef.abfd;
+      flip->got.offset = h->got.offset;
+      flip->plt.offset = h->plt.offset;
       h->root.type = bfd_link_hash_indirect;
       h->root.u.i.link = (struct bfd_link_hash_entry *) flip;
       if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)


More information about the Binutils mailing list