FC4 x84_64, GCC4.0 link error

Jakub Jelinek jakub at redhat.com
Mon Jul 4 16:48:43 UTC 2005


On Mon, Jul 04, 2005 at 09:41:01AM -0700, Jim Hayward wrote:
> Hi All,
> 
> Can anyone give me an good, understandable explanation of exactly what
> this error means and how it might be fixed. I did a google search, I get
> quite a few hits, but nothing that gives a really good explanation. If I
> add -fPIC and recompile it does work around the compile problem. But I
> would like to know why.
> 
> /usr/bin/ld: cap.o: relocation R_X86_64_32 can not be used when making
> a shared object; recompile with -fPIC cap.o: could not read symbols:
> Bad value collect2: ld returned 1 exit status

Including position dependent code in shared libraries is wrong on all
architectures.  On some architectures it is only slow, insecure and
prohibits sharing of shared library code pages, but works unless SELinux
prohibits it (e.g. i386), on some architectures the same applies, but
it only sort of works (i.e. you have to be lucky that libraries are
mapped close to each other, e.g. ppc32).  On other architectures
non-PIC code is forbidden altogether in shared libraries (e.g. x86-64).

	Jakub




More information about the devel mailing list