This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in IA64 runtime linker


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.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]