This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: -pie broken on ppc32
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 19 Feb 2004 16:07:06 -0800
- Subject: Re: -pie broken on ppc32
- References: <20040219182825.GS4581@sunsite.ms.mff.cuni.cz>
Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> With current GCC, any -pie binary will crash.
> The problem popped up after I've commited the change to avoid using
> both GOT and PLT slots for _Jv_RegisterClasses.
> Now all PIEs have
> 0001030c ffffff01 R_PPC_ADDR32 bad symbol index: 00ffffff
> relocation.
> Stripped down testcase is:
> .data
> .4byte _Jv_RegisterClasses
> .weak _Jv_RegisterClasses
> (or .8byte). gcc -nostdlib -o test test.s will not create any dynamic
> relocation here, gcc -nostdlib -shared -o test.so test.s will create
> dynamic relocation against undef weak _Jv_RegisterClasses.
> But with -pie, h->dynindx is -1 (this part of ld wants to handle it
> like normal executable) but then as !SYMBOL_REFERENCES_LOCAL (info, h)
> relocate section wants to create a dynamic relocation for it
> (in ppc32 or ppc64 case creates relocation with symbol -1,
> on e.g. amd64 it creates a bogus RELATIVE relocation).
> Note that gcc -pie -o test test.c -lgcj works (i.e. when _Jv_RegisterClasses
> is defined in one of the dependencies, then a dynamic relocation is
> created in all cases).
>
> Should ld in this case (on all arches) just skip the dynamic relocation
> and store 0?
I believe that the right thing to do is to create the dynamic
relocation. ld should assume that an undefined weak symbol is
actually defined in a shared library.
--
- Geoffrey Keating <geoffk@geoffk.org>