relocation R_X86_64_PC32 against `OPENSSL_cpuid_setup' link failure
Hey all -
I am having some troubling creating .so when linking against openssl
0.9.8. I do not encounter the problem when linking against openssl
0.9.7g. The error appears to be specific to x86_64. The system is a
As an example, when linking against a stub that calls
SSL_library_init(), I receive the following:
ld -soname libtest.so -shared -o libtest.so test.o
-L/usr/src/1.3.33/openssl-0.9.8 --whole-archive -lssl -lcrypto
ld: /usr/src/1.3.33/openssl-0.9.8/libcrypto.a(x86_64cpuid.o): relocation
R_X86_64_PC32 against `OPENSSL_cpuid_setup' can not be used when making
a shared object; recompile with -fPIC
ld: final link failed: Bad value
The openssl was config'd as no-shared no-threads -fPIC -DPIC.
I am certain that x86_64cpuid.o is compiled with -fPIC. An exert of the
build and output of file follows.
The old binutils are 22.214.171.124.2.2. When I experienced problems, I
updated to When I experienced problems, I updated to When I
experienced problems, I updated to 2.16.1 (I made sure gcc was calling
the new binutils). Both result in failure.
First of all I'd recommend to use gcc -shared even to link shared
objects. Not that this would remedy the "R_X86_64_PC32 is no good for
shared object," it's just that using gcc is more fool-proof, as it will
also link in run-time environment initialization code [which might be
required]. In order to pass linker specific options use -Wl prefix, e.g.
you'd have to replace -soname libtest.so with -Wl,-soname,libtest.so in
gcc command line.
> ld: /usr/src/1.3.33/openssl-0.9.8/libcrypto.a(x86_64cpuid.o): relocation
> R_X86_64_PC32 against `OPENSSL_cpuid_setup' can not be used when making
> a shared object; recompile with -fPIC
> ld: final link failed: Bad value
> The openssl was config'd as no-shared no-threads -fPIC -DPIC.
If you can confirm that './config shared' works, then adding
-Wl,-Bsymbolic to your command line should do the trick. A.
OpenSSL Project http://www.openssl.org User Support Mailing List [hidden email] Automated List Manager [hidden email]