This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: R_PPC_REL24 relocation in shared libraries
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Olaf Hering <olh at suse dot de>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 24 Feb 2003 16:30:03 +1030
- Subject: Re: R_PPC_REL24 relocation in shared libraries
- References: <20030223151146.GA26115@suse.de>
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