diff --git a/js/src/old-configure.in b/js/src/old-configure.in index c50cbcb51be1..5a0d52f78e40 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -543,6 +543,15 @@ esac MOZ_DOING_LTO(lto_is_enabled) +dnl ======================================================== +dnl Add optional and non-optional hardening flags +dnl ======================================================== +if test "$GNU_CC" -o test -n "${CLANG_CC}${CLANG_CL}"; then + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2" + CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" + CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2" +fi + dnl ======================================================== dnl System overrides of the defaults for target dnl ======================================================== diff --git a/old-configure.in b/old-configure.in index 4bd33246c440..9a15fc663941 100644 --- a/old-configure.in +++ b/old-configure.in @@ -493,11 +493,19 @@ if test -n "$COMPILE_ENVIRONMENT"; then MOZ_CONFIG_SANITIZE fi -# Add the hardening flags from moz.configure +dnl ======================================================== +dnl Add optional and non-optional hardening flags +dnl ======================================================== CFLAGS="$CFLAGS $HARDENING_CFLAGS" CPPFLAGS="$CPPFLAGS $HARDENING_CFLAGS" CXXFLAGS="$CXXFLAGS $HARDENING_CFLAGS" +if test "$GNU_CC" -o test -n "${CLANG_CC}${CLANG_CL}"; then + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2" + CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" + CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2" +fi + dnl ======================================================== dnl GNU specific defaults dnl ========================================================