Bug 1204752 - Disable thread-safe statics on VS2015 to fix WinXP startup crash. r=glandium
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Tue, 29 Dec 2015 10:21:07 +0200
changeset 277736 fc169db1ce4d97bc61ccd0f8278cb8e2c6824725
parent 277735 148f3434159279c295b73dafe4976e03a7d573f4
child 277737 cad9316f0b509191a91b076912a66053935e71c3
push id69580
push userbirunthan@mohanathas.com
push dateTue, 29 Dec 2015 08:22:22 +0000
treeherdermozilla-inbound@fc169db1ce4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1204752, 1789709
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1204752 - Disable thread-safe statics on VS2015 to fix WinXP startup crash. r=glandium VS2015 added thread-safe statics, but it causes a startup crash on XP. The suggested workaround provided by Microsoft is to disable the feature enitrely: https://connect.microsoft.com/VisualStudio/feedback/details/1789709/visual-c-2015-runtime-broken-on-windows-server-2003-c-11-magic-statics Note that thread-safe statics were not available in VS2013 so disabling them should not be considered a regression. With this patch, Firefox runs fine in XP SP2 and XP SP3. DONTBUILD because VS2015-only change.
configure.in
js/src/configure.in
--- a/configure.in
+++ b/configure.in
@@ -529,16 +529,20 @@ case "$target" in
             # -Wv:18 disables all warnings introduced after VS2013
             # See http://blogs.msdn.com/b/vcblog/archive/2014/11/12/improvements-to-warnings-in-the-c-compiler.aspx
             CFLAGS="$CFLAGS -Wv:18"
             CXXFLAGS="$CXXFLAGS -Wv:18"
 
             # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
             CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
 
+            # Disable C++11 thread-safe statics due to crashes on XP (bug 1204752)
+            # See https://connect.microsoft.com/VisualStudio/feedback/details/1789709/visual-c-2015-runtime-broken-on-windows-server-2003-c-11-magic-statics
+            CXXFLAGS="$CXXFLAGS -Zc:threadSafeInit-"
+
             # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
             # for dbghelp.h, imagehlp.h, and shobj.h
             # C4091: 'typedef ': ignored on left of '' when no variable is declared
             CFLAGS="$CFLAGS -wd4091"
             CXXFLAGS="$CXXFLAGS -wd4091"
         else
             AC_MSG_ERROR([This version (${_CC_MAJOR_VERSION}.${_CC_MINOR_VERSION}.${_CC_BUILD_VERSION}) of the MSVC compiler is unsupported.
 You must install Visual C++ 2013 Update 3 or newer in order to build.
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -388,16 +388,20 @@ case "$target" in
 
             # -Wv:18 disables all warnings introduced after VS2013
             # See http://blogs.msdn.com/b/vcblog/archive/2014/11/12/improvements-to-warnings-in-the-c-compiler.aspx
             CFLAGS="$CFLAGS -Wv:18"
             CXXFLAGS="$CXXFLAGS -Wv:18"
 
             # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
             CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
+
+            # Disable C++11 thread-safe statics due to crashes on XP (bug 1204752)
+            # See https://connect.microsoft.com/VisualStudio/feedback/details/1789709/visual-c-2015-runtime-broken-on-windows-server-2003-c-11-magic-statics
+            CXXFLAGS="$CXXFLAGS -Zc:threadSafeInit-"
         else
             AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
         fi
         AC_SUBST(MSVC_C_RUNTIME_DLL)
         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
         AC_SUBST(MSVC_APPCRT_DLL)
         AC_SUBST(MSVC_DESKTOPCRT_DLL)