Bug 1429807 Enable Spectre Mitigations draft
authorTom Ritter <tom@mozilla.com>
Tue, 16 Jan 2018 12:35:44 -0600
changeset 721141 c86cda62b0db8541cfe374660af220535e73efaf
parent 721140 fb734ee327bbd8d135067511cdd9da9cd0e3e024
child 721142 69262e4556ef15f5118099e7777e493cba109454
push id95737
push userbmo:tom@mozilla.com
push dateTue, 16 Jan 2018 19:30:35 +0000
bugs1429807
milestone59.0a1
Bug 1429807 Enable Spectre Mitigations
js/src/old-configure.in
old-configure.in
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -189,16 +189,20 @@ case "$target" in
             # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
             CXXFLAGS="$CXXFLAGS -w15038"
         fi
 
         _CC_SUITE=14
         MSVC_C_RUNTIME_DLL=vcruntime140.dll
         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
 
+        # Enable Spectre Mitigations
+        CFLAGS="$CFLAGS -d2guardspecload"
+        CXXFLAGS="$CXXFLAGS -d2guardspecload"
+
         # C5026: move constructor was implicitly defined as deleted
         CXXFLAGS="$CXXFLAGS -wd5026"
 
         # C5027: move assignment operator was implicitly defined as deleted
         CXXFLAGS="$CXXFLAGS -wd5027"
 
         # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
         CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
--- a/old-configure.in
+++ b/old-configure.in
@@ -182,16 +182,20 @@ case "$target" in
         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
 
         _CC_SUITE=14
         MSVC_C_RUNTIME_DLL=vcruntime140.dll
         MSVC_CXX_RUNTIME_DLL=msvcp140.dll
 
+        # Enable Spectre Mitigations
+        CFLAGS="$CFLAGS -d2guardspecload"
+        CXXFLAGS="$CXXFLAGS -d2guardspecload"
+
         MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
         if test -n "$MSVC_HAS_DIA_SDK"; then
             AC_DEFINE(MSVC_HAS_DIA_SDK)
         fi
 
         if test "$_MSC_VER" -ge "1910"; then # VS2017+
             # C5038: Enable initializer list order warnings
             # The -w1#### flag treats warning C#### as if it was a warning level