bug 1235982 - enable Control Flow Guard on MSVC2015. r?glandium
MozReview-Commit-ID: FHlz2dUOOuy
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -245,16 +245,21 @@ case "$target" in
_CC_SUITE=12
MSVC_C_RUNTIME_DLL=msvcr120.dll
MSVC_CXX_RUNTIME_DLL=msvcp120.dll
elif test "$_CC_MAJOR_VERSION" = "19"; then
_CC_SUITE=14
MSVC_C_RUNTIME_DLL=vcruntime140.dll
MSVC_CXX_RUNTIME_DLL=msvcp140.dll
+ # Enable Control Flow Guard
+ CFLAGS="$CFLAGS -guard:cf"
+ CXXFLAGS="$CXXFLAGS -guard:cf"
+ LDFLAGS="$LDFLAGS -guard:cf"
+
# 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
@@ -374,16 +374,21 @@ case "$target" in
MSVC_C_RUNTIME_DLL=vcruntime140.dll
MSVC_CXX_RUNTIME_DLL=msvcp140.dll
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
+ # Enable Control Flow Guard
+ CFLAGS="$CFLAGS -guard:cf"
+ CXXFLAGS="$CXXFLAGS -guard:cf"
+ LDFLAGS="$LDFLAGS -guard:cf"
+
# 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-"