[openssl-dev] Building VC-WIN32 with VS2012 and above breaks older CPU compatability

Scott Ware wsware at gmail.com
Fri Aug 26 18:31:57 UTC 2016


On Fri, Aug 26, 2016 at 12:01 PM, Scott Ware <wsware at gmail.com> wrote:
> When building with Visual Studio 2008 SSE is disabled by default. When
> building with Visual Studio 2012 and above you must supply a new flag
> /arch:IA32 to not build with SSE. Would it be acceptable to update the
> Configure process to add the /arch:IA32 if Visual Studio 2012 or
> greater is detected? This applies to the normal C code. We ran into
> issues when running on an AMD Geode processor.
>
> I tested changing the VC-32.pl on OpenSSL 1.0.2g and it worked well,
> but I see the whole build process has changed in Current. I wanted to
> find out if this is an acceptable change before I figure out the new
> Configure process and submit a patch.
>

Something like this will work

diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index 2838c3d..4b33156 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -23,18 +23,24 @@ sub vc_win64a_info {
 my $vc_win32_info = {};
 sub vc_win32_info {
     unless (%$vc_win32_info) {
+        my $arch="";
+        if (`nmake /? 2>&1` =~ /Version ([0-9]+\.[0-9]+)/ && $1 >= 11.0) {
+            $arch="/arch:IA32";
+        }
         my $ver=`nasm -v 2>NUL`;
         my $vew=`nasmw -v 2>NUL`;
         if ($ver ne "" || $vew ne "") {
             $vc_win32_info = { as        => $ver ge $vew ? "nasm" : "nasmw",
                                asflags   => "-f win32",
                                asoutflag => "-o",
-                               perlasm_scheme => "win32n" };
+                               perlasm_scheme => "win32n",
+                               cflags => $arch };
         } elsif ($disabled{asm}) {
             $vc_win32_info = { as        => "ml",
                                asflags   => "/nologo /Cp /coff /c /Cx /Zi",
                                asoutflag => "/Fo",
-                               perlasm_scheme => "win32" };
+                               perlasm_scheme => "win32",
+                               cflags => $arch };
         } else {
             die "NASM not found - please read INSTALL and NOTES.WIN
for further details\n";
         }
@@ -1335,6 +1341,9 @@ sub vms_info {
         as               => sub { vc_win32_info()->{as} },
         asflags          => sub { vc_win32_info()->{asflags} },
         asoutflag        => sub { vc_win32_info()->{asoutflag} },
+        lib_cflags       => add( sub { vc_win32_info()->{cflags} } ),
+        dso_cflags       => add( sub { vc_win32_info()->{cflags} } ),
+        bin_cflags       => add( sub { vc_win32_info()->{cflags} } ),
         ex_libs          => add(sub {
             my @ex_libs = ();
             # WIN32 UNICODE build gets linked with unicows.lib for


More information about the openssl-dev mailing list