On Sun, May 20, 2007 at 03:21:56PM +0200, Andy Polyakov wrote:
> >The problem is that he's trying to make a shared library linked to a
> >static library, and the static library isn't built with -fPIC.
> 
> No. The way I read it, his static library is build with -fPIC. The user 

Right, it seems that it was build with it.  The linker would probably
have complained about a different symbol in case it wasn't.

It says that x86_64cpuid.o has a R_X86_64_PC32 relocation.  Since it's
actually a assembler file, it means the assembler isn't PIC.

Looking at the static library (with or without -fPIC) I get:
Relocation section '.rela.init' at offset 0x530 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name
  + Addend000000000001  000a00000002 R_X86_64_PC32     0000000000000000 
OPENSSL_cpuid_setup + fffffffffffffffc

In the the case with -fPIC it's the only exported symbol with a
relocation that can be a problem.

For a PIC version, you should change the call to:
call    [EMAIL PROTECTED]

Then I get:
Relocation section '.rela.init' at offset 0x8f0 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name
  + Addend000000000001  000f00000004 R_X86_64_PLT32    0000000000000000 
OPENSSL_cpuid_setup + fffffffffffffffc

With that change, I can actually create a shared libcrypto.so without
using -Bsymbolic.

> surely wants to include copy of OpenSSL code into own .so. I mean as 
> alternative to having own .so linked with libcrypto.so he wants own .so 
> with OpenSSL in it. x86_64cpuid.o does have R_X86_64_PC32 relocation 
> even in shared build, which *can* be resolved in shared context, *if* 
> you use -Bsymbolic. A.

-Bsymbolic might be able to change some relocation in others allowing you
to create a shared library, but that's luck that the linker can do such
an optimization.  What -Bsymbolic is for is changing the order in which
symbols are looked up by the dynamic linker.


Kurt

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

Reply via email to