This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Bug in IA64 runtime linker
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Jakub Jelinek <jakub at redhat dot com>, binutils at sources dot redhat dot com
- Cc: Ed Connell <Ed dot Connell at sas dot com>, libc-alpha at sources dot redhat dot com
- Date: Fri, 2 Apr 2004 08:14:41 -0800
- Subject: Re: Bug in IA64 runtime linker
- References: <E0EA1095200B074CA58322B446C8D53904F3FA86@merc17.na.sas.com> <20040401225901.GA12488@lucon.org> <20040401211212.GH514@sunsite.ms.mff.cuni.cz>
On Thu, Apr 01, 2004 at 11:12:12PM +0200, Jakub Jelinek wrote:
> On Thu, Apr 01, 2004 at 02:59:01PM -0800, H. J. Lu wrote:
> > On Thu, Apr 01, 2004 at 05:36:48PM -0500, Ed Connell wrote:
> > > I have a small test case that I believe illustrates a bug in the
> > > IA64 runtime linker. If my shared library is loaded with RTLD_LAZY,
> > > things don't resolve correctly. The following can be observed on
> > > RHEL 3 for Itanium.
> > >
> > > $ as my_lib.s -o my_lib.o
> > > $ ld my_lib.o -o my_lib.so -shared
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> > Never, ever do that. You should use a compiler driver to create a
> > shared library. With gcc, it is
>
> Well, that's certainly true.
> Still, there seems to be a bug, either just in ld, or in both ld and glibc.
> This library when created in the improper way is special in that it has
> no PLT relocations.
> The problem is, that ld in this case creates 8 byte long .got (or with say:
> static long q;
> static long *p = &q;
> and linking with gcc -shared -O2 -fpic -nostdlib only 0 byte long .got),
> yet there is still IA_64_PLT_RESERVE dynamic tag covering first 24 bytes
> of .got.
> And ld.so unconditionally assumes that there is IA_64_PLT_RESERVE tag
> when lazy.
> So the option is either to change ld, so that it always reserves first
> 24 bytes of .got, not just when there are PLT relocs, or to omit
> IA_64_PLT_RESERVE dynamic tag in that case and change the dynamic linker
> to cope with the missing tag.
> Given how unusual shared libs without PLT relocs are and in the sake
> of compatibility, probably just reserving 3 .got words is better.
>
I will give it a try next week.
H.J.