Permalink
Browse files

Build external_deps DLLs which can be safely called on x86 Windows

By default gcc assumes the stack will be 16 byte aligned on a function
entry. This is incompatible with MSVC code which only does 4 byte
alignment. The problem manifests when SSE instructions are used on the
stack. So decrease the alignment assumption to 4 with the
-mpreferred-stack-boundary=2 flag.

Also explicitly enable SSE2 for x86 Windows builds to match Daemon
flags.
  • Loading branch information...
slipher committed Jan 5, 2019
1 parent a3b29a5 commit e45f11621ef67814453c3e9b8e64e613b7936fec
Showing with 4 additions and 4 deletions.
  1. +4 −4 external_deps/build.sh
@@ -630,8 +630,8 @@ setup_msvc32() {
# Libtool bug prevents -static-libgcc from being set in LDFLAGS
export CC="i686-w64-mingw32-gcc -static-libgcc"
export CXX="i686-w64-mingw32-g++ -static-libgcc"
export CFLAGS="-m32"
export CXXFLAGS="-m32"
export CFLAGS="-m32 -msse2 -mpreferred-stack-boundary=2"
export CXXFLAGS="-m32 -msse2 -mpreferred-stack-boundary=2"
export LDFLAGS="-m32"
common_setup
}
@@ -655,8 +655,8 @@ setup_mingw32() {
HOST=i686-w64-mingw32
CROSS="${HOST}-"
MSVC_SHARED=(--disable-shared --enable-static)
export CFLAGS="-m32"
export CXXFLAGS="-m32"
export CFLAGS="-m32 -msse2"
export CXXFLAGS="-m32 -msse2"
export LDFLAGS="-m32"
common_setup
}

0 comments on commit e45f116

Please sign in to comment.