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]

Re: R_PPC_REL24 relocation in shared libraries


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


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