|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Static libraries with fPIC on 32bit systemI have built openssl-0.9.8k and am trying to link libcrypto.a statically with my project. I think libcrypto.a contains contains non-relocatable functions
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 32 bit systems. Can someone point me to why building static libs on 32 bit system with fPIC is a bad idea? Also, if I want to build the static lib with fPIC, how do I go about it? All the .o files are built with fPIC. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@... Automated List Manager majordomo@... |
|
|
Re: Static libraries with fPIC on 32bit systemOn Mon, Nov 2, 2009 at 21:37, john blair wrote:
> I have built openssl-0.9.8k and am trying to link libcrypto.a statically with my project. I think libcrypto.a contains contains non-relocatable functions > 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 dont link static libraries into shared libraries and it isnt a problem > Can someone point me to why building static libs on 32 bit system with fPIC is a bad idea? pic adds a lot of overhead with x86 due to register pressure -mike ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@... Automated List Manager majordomo@... |
|
|
Re: Static libraries with fPIC on 32bit systemThanks for the reply Mike.
> dont link static libraries into shared libraries and it isnt a problem Ya that is true. But, I do want to link the static library to the shared library. > pic adds a lot of overhead with x86 due to register pressure Can you point me to link or something that discusses this in more detail? Thanks again for the help. --- On Tue, 11/3/09, Mike Frysinger <vapier.adi@...> wrote: > From: Mike Frysinger <vapier.adi@...> > Subject: Re: Static libraries with fPIC on 32bit system > To: openssl-users@... > Date: Tuesday, November 3, 2009, 1:41 PM > On Mon, Nov 2, 2009 at 21:37, john > blair wrote: > > I have built openssl-0.9.8k and am trying to link > libcrypto.a statically with my project. I think libcrypto.a > contains contains non-relocatable functions > > 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 > > dont link static libraries into shared libraries and it > isnt a problem > > > Can someone point me to why building static libs on 32 > bit system with fPIC is a bad idea? > > pic adds a lot of overhead with x86 due to register > pressure > -mike > ______________________________________________________________________ > OpenSSL Project > > http://www.openssl.org > User Support Mailing List > openssl-users@... > Automated List Manager > > majordomo@... > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@... Automated List Manager majordomo@... |
|
|
Re: Static libraries with fPIC on 32bit systemOn Tue, Nov 3, 2009 at 13:45, john blair wrote:
>> dont link static libraries into shared libraries and it isnt a problem > > Ya that is true. But, I do want to link the static library to the shared library. linking static libraries into a shared library is wrong. maybe someone else will help you create a PIC static library, but i wont. sorry. >> pic adds a lot of overhead with x86 due to register pressure > > Can you point me to link or something that discusses this in more detail? google for it. pic on x86 removes ebx from general register usage. while your .so will have textrels and thus prevent sharing of the text region, openssl will run faster. -mike ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@... Automated List Manager majordomo@... |
|
|
Re: Static libraries with fPIC on 32bit systemThanks again for the reply Mike.
Can someone tell me how to go about creating static library with PIC? --- On Wed, 11/4/09, Mike Frysinger <vapier.adi@...> wrote: > From: Mike Frysinger <vapier.adi@...> > Subject: Re: Static libraries with fPIC on 32bit system > To: openssl-users@... > Date: Wednesday, November 4, 2009, 12:37 AM > On Tue, Nov 3, 2009 at 13:45, john > blair wrote: > >> dont link static libraries into shared libraries > and it isnt a problem > > > > Ya that is true. But, I do want to link the static > library to the shared library. > > linking static libraries into a shared library is > wrong. maybe > someone else will help you create a PIC static library, but > i wont. > sorry. > > >> pic adds a lot of overhead with x86 due to > register pressure > > > > Can you point me to link or something that discusses > this in more detail? > > google for it. pic on x86 removes ebx from general > register usage. > while your .so will have textrels and thus prevent sharing > of the text > region, openssl will run faster. > -mike > ______________________________________________________________________ > OpenSSL Project > > http://www.openssl.org > User Support Mailing List > openssl-users@... > Automated List Manager > > majordomo@... > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@... Automated List Manager majordomo@... |
|
|
Re: Static libraries with fPIC on 32bit systemhttp://rt.openssl.org/Ticket/Display.html?id=1521&user=guest&pass=guest says to add -Wl,-Bsymbolic to the gcc command line
#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 -Wl,-Bsymbolic /usr/lib/libcrypto.a $ eu-findtextrel libfoo.so eu-findtextrel: no text relocations reported in 'libfoo.so' Is this the correct way to do? --- On Thu, 11/5/09, john blair <mailtome200420032002@...> wrote: > From: john blair <mailtome200420032002@...> > Subject: Re: Static libraries with fPIC on 32bit system > To: openssl-users@... > Date: Thursday, November 5, 2009, 6:41 AM > Thanks again for the reply Mike. > Can someone tell me how to go about creating static library > with PIC? > > --- On Wed, 11/4/09, Mike Frysinger <vapier.adi@...> > wrote: > > > From: Mike Frysinger <vapier.adi@...> > > Subject: Re: Static libraries with fPIC on 32bit > system > > To: openssl-users@... > > Date: Wednesday, November 4, 2009, 12:37 AM > > On Tue, Nov 3, 2009 at 13:45, john > > blair wrote: > > >> dont link static libraries into shared > libraries > > and it isnt a problem > > > > > > Ya that is true. But, I do want to link the > static > > library to the shared library. > > > > linking static libraries into a shared library is > > wrong. maybe > > someone else will help you create a PIC static > library, but > > i wont. > > sorry. > > > > >> pic adds a lot of overhead with x86 due to > > register pressure > > > > > > Can you point me to link or something that > discusses > > this in more detail? > > > > google for it. pic on x86 removes ebx from general > > register usage. > > while your .so will have textrels and thus prevent > sharing > > of the text > > region, openssl will run faster. > > -mike > > > ______________________________________________________________________ > > OpenSSL Project > > > > http://www.openssl.org > > User Support Mailing List > > openssl-users@... > > Automated List Manager > > > > majordomo@... > > > > > > ______________________________________________________________________ > OpenSSL Project > > http://www.openssl.org > User Support Mailing List > openssl-users@... > Automated List Manager > > majordomo@... > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@... Automated List Manager majordomo@... |
| Free embeddable forum powered by Nabble | Forum Help |