This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

PATCH: Reserve memory for ia64 ld.so (Bug in IA64 runtime linker)


On Fri, Apr 02, 2004 at 08:14:41AM -0800, H. J. Lu wrote:
> 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.
> 

Here is a patch.

H.J.

Attachment: bfd-ia64-plt-1.patch
Description: Text document


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