-pie broken on ppc32

Geoff Keating geoffk@geoffk.org
Fri Feb 20 00:07:00 GMT 2004


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>



More information about the Binutils mailing list