relocation error: R_AMD64_PC32
asyropoulos@aol.com
asyropoulos@aol.com
Fri Mar 11 17:06:00 GMT 2011
>There seems to be at least two things that can cause position
>dependent code to be created when the -fPIC option is used.
>
> * Assembly code
> * Use of of the GNU extension to C (I hate this ****ing extensions)
>that use "computed gotos"
Well not really! The problem was that at a certain point during
the configuration stage, the Configure script asks the following
question:
Any special flags to pass to x86_64-pc-solaris2.11-gcc to
create a dynamically loaded library? [ -G -m64 -fstack-protector]
And quite naturally (!) one presses enter because Solaris users
know that the Solaris linker accepts the -G option. But for starnge
reason this does not work. One has to enter the following:
-shared -m64 -fstack-protector
Now what is even more curious is that the man page of Solaris ld
says among others the following:
-G
-shared
In dynamic mode only, produces a shared object. Unde-
fined symbols are allowed. See Chapter 4, Shared
Objects, in Linker and Libraries Guide.
In different words, both -G and -shared are supposed to do the
same thing but apparently they don't. Maybe, -shared forces GCC
to some things, while the -G thing is passed directly to the linker
without touching anything else.
>Finding the bad library with non-PIC code is easy - just use:
>
>$ elfdump -d library | fgrep TEXTREL
Thanks. This helped me to find the solution.
Regards,
Apostolos
More information about the Gcc-help
mailing list