Bug 1417452 Do not add FORTIFY_SOURCE if --enable-optimize is not set r=glandium
authorTom Ritter <tom@mozilla.com>
Thu, 16 Nov 2017 13:42:20 -0600
changeset 392376 59e899eba461a5324c5804eae15fdd8b2c61eaa1
parent 392375 b34457e29b87c9dfc1ba8b37d4431d13d1031c59
child 392377 7b085998b0f18f96fba0c69a76da19c8e982b05c
push id32920
push usernerli@mozilla.com
push dateFri, 17 Nov 2017 22:01:05 +0000
treeherdermozilla-central@7ef46e350289 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1417452
milestone59.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 1417452 Do not add FORTIFY_SOURCE if --enable-optimize is not set r=glandium MozReview-Commit-ID: EMjeTvqdME3
js/src/old-configure.in
old-configure.in
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -555,24 +555,29 @@ case "$host" in
 esac
 
 MOZ_DOING_LTO(lto_is_enabled)
 
 dnl ========================================================
 dnl Add optional and non-optional hardening flags
 dnl ========================================================
 
+dnl In at least glibc-2.25, _FORTIFY_SOURCE requires compiling
+dnl with optimization (Bug 1417452)
+
 dnl Note that in the top-level old-configure.in, we don't enable
 dnl FORTIFY_SOURCE on Android. But in js/ we *can* enable it on
 dnl Android, so we do.
 
-if test "$GNU_CC" -o -n "${CLANG_CC}${CLANG_CL}"; then
-   CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
-   CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
-   CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
+if test -n "$MOZ_OPTIMIZE"; then
+   if test "$GNU_CC" -o -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
 fi
 
 dnl ========================================================
 dnl System overrides of the defaults for target
 dnl ========================================================
 
 case "$target" in
 *-darwin*)
--- a/old-configure.in
+++ b/old-configure.in
@@ -502,29 +502,33 @@ fi
 
 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 -n "${CLANG_CC}${CLANG_CL}"; then
-    case $OS_TARGET in
-    Android)
-         dnl FORTIFY_SOURCE is not supported on Android on the
-         dnl top-level old-configure.in at this time.
-         dnl See Bug 1415595
-         ;;
-    *)
-        CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
-        CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
-        CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
-        ;;
-    esac
+dnl In at least glibc-2.25, _FORTIFY_SOURCE requires compiling
+dnl with optimization (Bug 1417452)
+if test -n "$MOZ_OPTIMIZE"; then
+   if test "$GNU_CC" -o -n "${CLANG_CC}${CLANG_CL}"; then
+      case $OS_TARGET in
+         Android)
+            dnl FORTIFY_SOURCE is not supported on Android on the
+            dnl top-level old-configure.in at this time.
+            dnl See Bug 1415595
+            ;;
+         *)
+            CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
+            CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
+            CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
+            ;;
+      esac
+   fi
 fi
 
 dnl ========================================================
 dnl GNU specific defaults
 dnl ========================================================
 if test "$GNU_CC"; then
     MMX_FLAGS="-mmmx"
     SSE_FLAGS="-msse"