I have built openssl-0.9.8k and am trying to link libcrypto.a statically with my project.
For example, consider the following:
#include <openssl/des.h>
void foo(void) {
DES_encrypt3(NULL, NULL, NULL, NULL);
AES_encrypt(NULL, NULL);
}
$ gcc -fPIC -o libfoo.so -shared foo.c /usr/lib/libcrypto.a
$ eu-findtextrel libfoo.so
the file containing the function 'DES_encrypt3' is not compiled with -fpic/-fPIC
the file containing the function 'DES_decrypt3' is not compiled with -fpic/-fPIC
the file containing the function 'DES_ncbc_encrypt' is not compiled with -fpic/-fPIC
the file containing the function 'DES_ede3_cbc_encrypt' is not compiled with -fpic/-fPIC
This does not happen on 64bit system and eu-findtextrel reports on text relocations. I think this is the default behavior on x86 systems.
Can someone point me to why building static libs on 32 bit system with fPIC is a bad idea?