Bug 1414067 Fix the compiler test for FORTIFY_SOURCE r=glandium
authorTom Ritter <tom@mozilla.com>
Tue, 14 Nov 2017 12:13:30 -0600
changeset 391877 d240b19cc50c5da57aa786e2301d113dfc102d32
parent 391876 5b8cbab9374f065bf4cac694d5ad251f2134bb37
child 391878 c9117e83e3a25d9e67d326147699f7e6946f0eda
push id97352
push usernerli@mozilla.com
push dateWed, 15 Nov 2017 10:16:19 +0000
treeherdermozilla-inbound@76d469663b3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1414067
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 1414067 Fix the compiler test for FORTIFY_SOURCE r=glandium MozReview-Commit-ID: 8ozY0Zbuczx
js/src/old-configure.in
old-configure.in
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -547,17 +547,22 @@ case "$host" in
     ;;
 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
+
+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"
 fi
 
 dnl ========================================================
 dnl System overrides of the defaults for target
 dnl ========================================================
--- a/old-configure.in
+++ b/old-configure.in
@@ -495,20 +495,29 @@ 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 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"
+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
 
 dnl ========================================================
 dnl GNU specific defaults
 dnl ========================================================
 if test "$GNU_CC"; then
     MMX_FLAGS="-mmmx"
     SSE_FLAGS="-msse"