> Title: Failed to link static openssl libraries (or non-PIC x86_64cpuid.s)
> OS: FC4
> HARDWARE: AMD x86 64bit
> OPENSSL VERSION: 0.9.8e
> OPTIONS:
> CFLAGS="-fPIC -O2" ./config no-dso no-shared no-threads 
> no-zlib -fPIC -O2 --prefix=/home/dmitri/php/install
> 
> Details:
> It worked just fine with all 0.9.7*. Since 0.9.8 an attempt to link against 
> static openssl like below
> gcc -shared  dbg.lo dbg_bp.lo dbg_cmd.lo dbg_net.lo dbg_ser.lo dbg_prof.lo 
> dbg_sec.lo 
> bg_logo.lo  -L/home/dmitri/php/install/lib -lssl -lcrypto  -Wl,-rpath 
> -Wl,/home/dmitri/php/install/lib 
>  -Wl,-soname -Wl,dbg.so -o .libs/dbg.so
> 
> returns with error:
> 
> /usr/bin/ld: /home/dmitri/php/install/lib/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

Use -Bsymbolic to link your shared object, add -Wl,-Bsymbolic to your 
gcc command line. In the nutshell this means that OpenSSL calls your 
library makes can't be overridden by another copy of OpenSSL mapped into 
application address space. Ideally you should also abstain from 
exporting any OpenSSL symbols from your shared object.

One can argue whether or not this is a bug, as OPENSSL_cpuid_setup is an 
internal interface and another shared object should not be able to 
override it. Well, there is another way to resolve it, but not in the 
context of this ticket. I'm dismissing this. A.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to