R_PPC_REL24 relocation in shared libraries
Alan Modra
amodra@bigpond.net.au
Mon Feb 24 06:01:00 GMT 2003
On Sun, Feb 23, 2003 at 04:11:46PM +0100, Olaf Hering wrote:
> the linker does allow R_PPC_REL24 relocations in shared libraries. These
> relocs come from object files compiled without -fPIC. Code compiled
> without -fPIC is not supposed to work in shared libraries. I think that
> is true for every *-linux* architecture, but I'm mainly concerned about
> powerpc-linux.
Non-PIC code in shared libs is supported by binutils on some other
architectures, eg x86, so it's reasonable for the gas testsuite to
check that non-PIC shared libs work. Non-PIC shared libs do have some
disadvantages. eg. non-PIC shared libs might have relocations in
read-only segments, causing pages to become unshared, and as you know,
on powerpc-linux you might also run into problems with branches not
being able to reach their targets.
Note: There's a subtle difference between what I'm claiming above and
a claim that code compiled by gcc without -fpic/-fPIC will always
work on x86. That is because gcc -fpic/-fPIC does more than just
generate PIC code; For instance, without -fpic/-fPIC you might get
optimizations that cause ELF shared library symbol overriding to
break.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list