Re: LNK4078 and LNK4210 linking with x64 static libs

2010-09-23 Thread per fry kenvall

Hi,

Thanks for your suggestion! But as far as I see, the assembler code in 
x86_64cpuid.asm _is_ the reference to OPENSSL_cpuid_setup! The runtime 
will call the functions given in the .CRT$XCU section before calling the 
main() entry. And it seems to me that the OPENSSL_cpuid_setup function 
in crypto/cryptlib.c does have useful code on Windows platforms, and so 
should be called, shouldn't it? It initializes a static variable with 
some processor specific info, whose value may be taken via the 
OPENSSL_ia32cap_loc() function.


I tried printf(%lu, *OPENSSL_ia32cap_loc()), which prints out 0 using 
the x64 code, while printing 2951479295 using 32-bit code, indicating 
that OPENSSL_cpuid_setup has only been executed with the 32-bit code. 
What's the impact of this? Isn't it a bug?


Cheers,
Per

Jack Zhang wrote:

I had got the same problem. I just simply deleted that section
  EXTERNOPENSSL_cpuid_setup
  section.CRT$XCU
  ALIGN8
  DQOPENSSL_cpuid_setup

  section.text code align=64

from the asm file because the extern OpenSSL_cpuid_setup is never 
referenced.


Good luck

On Tue, Sep 21, 2010 at 9:57 AM, perfry wrote:

Hi,

I've built 1.0.0a on Windows with VS2005, using nt.mak to get
static libraries.
With x64 I get warnings when linking applications, both
openssl.exe and test programs like sha1test.exe. A snippet of
output from nmake -f ms\nt.mak:
  link /nologo /subsystem:console /opt:ref /debug
/out:out32\openssl.exe @C:\DOCUME~1\FRYKEN~1\LOCALS~1\Temp\nm3B3.tmp
LIBCMT.lib(crt0init.obj) : warning LNK4254: section '.CRT'
(6020) merged into '.rdata' (4040) with different attributes


And when linking our own application on x64/Release platform:
  libeay32.lib(x86_64cpuid.obj) : warning LNK4078: multiple '.CRT'
sections found with different attributes (60500020)
  libeay32.lib(x86_64cpuid.obj) : warning LNK4210: .CRT section
exists; there may be unhandled static initializers or terminators


The linker command can be deduced from the following:
  Creating temporary file
c:\utv\ccbas4\ccbase\x64\Release\RSP132444832.rsp with contents
  [
  /OUT:../deploy/execs/x64/Release/etnode.exe /INCREMENTAL:NO
/MANIFEST
/MANIFESTFILE:x64/Release\etnode.exe.intermediate.manifest
/DELAYLOAD:oci.dll /DEBUG
/PDB:../deploy/execs/x64/Release/etnode.pdb /SUBSYSTEM:CONSOLE
/LTCG psapi.lib odbc32.lib odbccp32.lib WS2_32.LIB ADVAPI32.LIB
GDI32.LIB USER32.LIB dbghelp.lib
../snibu/logging-log4cxx/msvc/lib/x64/Release/log4cxxs.lib
../snibu/openssl-1.0.0a/x64/Release/lib/ssleay32.lib
../snibu/openssl-1.0.0a/x64/Release/lib/libeay32.lib
../snibu/oracle/x64/instantclient_10_2/sdk/lib/msvc/oci.lib
../snibu/zlib/msvc/lib/x64/Release/zlibstat.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib DelayImp.lib

  .\x64\Release\CCcServApp.obj
  ...
  .\x64\Release\Bas4Bridge.obj
  ]
  Creating command line link.exe
@c:\utv\ccbas4\ccbase\x64\Release\RSP132444832.rsp /NOLOGO
/ERRORREPORT:PROMPT


I've done the following to build openssl:
  cd /d C:\utv\snibu\openssl\x64\release\openssl-1.0.0a
  call C:\Program Files\Microsoft Visual Studio
8\VC\vcvarsall.bat x86_amd64
  perl Configure VC-WIN64A --prefix=c:\appl\openssl-1.0.0a\x64\release
  ms\do_win64a.bat
  nmake -f ms\nt.mak
  nmake -f ms\nt.mak install

And the file x86_64cpuid.asm mentioned in the warnings starts with
the following:
  defaultrel
  EXTERNOPENSSL_cpuid_setup
  section.CRT$XCU
  ALIGN8
  DQOPENSSL_cpuid_setup

  section.text code align=64
...


Could somebody help me solve this warning, it seems to me that
OPENSSL_cpuid_setup will not be executed.


Best regards,
Per Frykenvall
__
OpenSSL Project http://www.openssl.org
User Support Mailing List  
 openssl-users@openssl.org mailto:openssl-users@openssl.org
Automated List Manager  
majord...@openssl.org mailto:majord...@openssl.org





__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: LNK4078 and LNK4210 linking with x64 static libs

2010-09-23 Thread per fry kenvall
I disagree; according to 
http://blogs.msdn.com/b/vcblog/archive/2006/10/20/crt-initialization.aspx
.CRT$XCU is for setting up static initializers. Also, the text of the 
source file from which the assembler file is generated gives a hint that 
it is a call:

.extern OPENSSL_cpuid_setup
.section.init
   callOPENSSL_cpuid_setup

And maybe the parts of openssl that you are using work perfectly, while 
there might be other parts relying on this initialization. 
(Unfortunately I can't run make test on 64-bit as I don't have any 
such box with Visual Studio).


/Per

Jack Zhang wrote:
According to my understanding, that section is just a declaration of 
an external function. The section is needed to be there only if the 
function is called in the x86_64cpuid.asm. So, I don't think it will 
affect anything. In fact, my x64 version build runs perfectly. (I am 
using openssl 1.0.0 and then 1.0.0a)




On Thu, Sep 23, 2010 at 7:12 AM, per fry kenvall per...@got.wmdata.se 
mailto:per...@got.wmdata.se wrote:


Hi,

Thanks for your suggestion! But as far as I see, the assembler
code in x86_64cpuid.asm _is_ the reference to OPENSSL_cpuid_setup!
The runtime will call the functions given in the .CRT$XCU section
before calling the main() entry. And it seems to me that the
OPENSSL_cpuid_setup function in crypto/cryptlib.c does have useful
code on Windows platforms, and so should be called, shouldn't it?
It initializes a static variable with some processor specific
info, whose value may be taken via the OPENSSL_ia32cap_loc() function.

I tried printf(%lu, *OPENSSL_ia32cap_loc()), which prints out 0
using the x64 code, while printing 2951479295 using 32-bit code,
indicating that OPENSSL_cpuid_setup has only been executed with
the 32-bit code. What's the impact of this? Isn't it a bug?

Cheers,
Per

Jack Zhang wrote:

I had got the same problem. I just simply deleted that section
 EXTERNOPENSSL_cpuid_setup
 section.CRT$XCU
 ALIGN8
 DQOPENSSL_cpuid_setup

 section.text code align=64

from the asm file because the extern OpenSSL_cpuid_setup is
never referenced.

Good luck

On Tue, Sep 21, 2010 at 9:57 AM, perfry wrote:

   Hi,

   I've built 1.0.0a on Windows with VS2005, using nt.mak to get
   static libraries.
   With x64 I get warnings when linking applications, both
   openssl.exe and test programs like sha1test.exe. A snippet of
   output from nmake -f ms\nt.mak:
 link /nologo /subsystem:console /opt:ref /debug
   /out:out32\openssl.exe
@C:\DOCUME~1\FRYKEN~1\LOCALS~1\Temp\nm3B3.tmp
   LIBCMT.lib(crt0init.obj) : warning LNK4254: section '.CRT'
   (6020) merged into '.rdata' (4040) with different
attributes


   And when linking our own application on x64/Release platform:
 libeay32.lib(x86_64cpuid.obj) : warning LNK4078: multiple
'.CRT'
   sections found with different attributes (60500020)
 libeay32.lib(x86_64cpuid.obj) : warning LNK4210: .CRT section
   exists; there may be unhandled static initializers or
terminators


   The linker command can be deduced from the following:
 Creating temporary file
   c:\utv\ccbas4\ccbase\x64\Release\RSP132444832.rsp
with contents
 [
 /OUT:../deploy/execs/x64/Release/etnode.exe /INCREMENTAL:NO
   /MANIFEST
   /MANIFESTFILE:x64/Release\etnode.exe.intermediate.manifest
   /DELAYLOAD:oci.dll /DEBUG
   /PDB:../deploy/execs/x64/Release/etnode.pdb
/SUBSYSTEM:CONSOLE
   /LTCG psapi.lib odbc32.lib odbccp32.lib WS2_32.LIB ADVAPI32.LIB
   GDI32.LIB USER32.LIB dbghelp.lib
   ../snibu/logging-log4cxx/msvc/lib/x64/Release/log4cxxs.lib
   ../snibu/openssl-1.0.0a/x64/Release/lib/ssleay32.lib
   ../snibu/openssl-1.0.0a/x64/Release/lib/libeay32.lib
   ../snibu/oracle/x64/instantclient_10_2/sdk/lib/msvc/oci.lib
   ../snibu/zlib/msvc/lib/x64/Release/zlibstat.lib kernel32.lib
   user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
   shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
   odbccp32.lib DelayImp.lib

 .\x64\Release\CCcServApp.obj
 ...
 .\x64\Release\Bas4Bridge.obj
 ]
 Creating command line link.exe
   @c:\utv\ccbas4\ccbase\x64\Release\RSP132444832.rsp /NOLOGO
   /ERRORREPORT:PROMPT


   I've done the following to build openssl:
 cd /d C:\utv\snibu\openssl\x64\release\openssl-1.0.0a
 call C:\Program Files\Microsoft Visual Studio
   8\VC\vcvarsall.bat x86_amd64
 perl Configure VC-WIN64A
--prefix=c

LNK4078 and LNK4210 linking with x64 static libs

2010-09-22 Thread per fry kenvall
Hi, (please excuse if this is a duplicate, yesterdays posting 
seems failed)


I have problems with warnings from the linker on Windows, indicating 
that initializers will not be called. I've built 1.0.0a with VS2005, 
using nt.mak to get static libraries.


With x64 I get warnings when linking applications, both openssl.exe and 
test programs like sha1test.exe. A snippet of output from nmake -f 
ms\nt.mak:
  link /nologo /subsystem:console /opt:ref /debug 
/out:out32\openssl.exe @C:\DOCUME~1\FRYKEN~1\LOCALS~1\Temp\nm3B3.tmp
LIBCMT.lib(crt0init.obj) : warning LNK4254: section '.CRT' (6020) 
merged into '.rdata' (4040) with different attributes



And when linking our own application on x64/Release platform:
  libeay32.lib(x86_64cpuid.obj) : warning LNK4078: multiple '.CRT' 
sections found with different attributes (60500020)
  libeay32.lib(x86_64cpuid.obj) : warning LNK4210: .CRT section exists; 
there may be unhandled static initializers or terminators



The linker command can be deduced from the following:
  Creating temporary file 
c:\utv\ccbas4\ccbase\x64\Release\RSP132444832.rsp with contents

  [
  /OUT:../deploy/execs/x64/Release/etnode.exe /INCREMENTAL:NO 
/MANIFEST /MANIFESTFILE:x64/Release\etnode.exe.intermediate.manifest 
/DELAYLOAD:oci.dll /DEBUG 
/PDB:../deploy/execs/x64/Release/etnode.pdb /SUBSYSTEM:CONSOLE /LTCG 
psapi.lib odbc32.lib odbccp32.lib WS2_32.LIB ADVAPI32.LIB GDI32.LIB 
USER32.LIB dbghelp.lib 
../snibu/logging-log4cxx/msvc/lib/x64/Release/log4cxxs.lib 
../snibu/openssl-1.0.0a/x64/Release/lib/ssleay32.lib 
../snibu/openssl-1.0.0a/x64/Release/lib/libeay32.lib 
../snibu/oracle/x64/instantclient_10_2/sdk/lib/msvc/oci.lib 
../snibu/zlib/msvc/lib/x64/Release/zlibstat.lib kernel32.lib user32.lib 
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib DelayImp.lib


  .\x64\Release\CCcServApp.obj
  ...
  .\x64\Release\Bas4Bridge.obj
  ]
  Creating command line link.exe 
@c:\utv\ccbas4\ccbase\x64\Release\RSP132444832.rsp /NOLOGO 
/ERRORREPORT:PROMPT



I've done the following to build openssl:
  cd /d C:\utv\snibu\openssl\x64\release\openssl-1.0.0a
  call C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat 
x86_amd64

  perl Configure VC-WIN64A --prefix=c:\appl\openssl-1.0.0a\x64\release
  ms\do_win64a.bat
  nmake -f ms\nt.mak
  nmake -f ms\nt.mak install

And the file x86_64cpuid.asm mentioned in the warnings starts with the 
following:

  defaultrel
  EXTERNOPENSSL_cpuid_setup
  section.CRT$XCU
  ALIGN8
  DQOPENSSL_cpuid_setup

  section.text code align=64
...


Could somebody help me solve this warning, it seems to me that 
OPENSSL_cpuid_setup will not be executed.



Best regards,
Per Frykenvall


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org