public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Require CET support only for the final GCC build
@ 2020-07-15 14:47 H.J. Lu
  2020-07-15 15:20 ` Richard Biener
  0 siblings, 1 reply; 17+ messages in thread
From: H.J. Lu @ 2020-07-15 14:47 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Biener

With --enable-cet, require CET support only for the final GCC build.
Don't enable CET without CET support in stage1 nor for build support.

config/

	PR bootstrap/96202
	* cet.m4 (GCC_CET_HOST_FLAGS): Don't enable CET without CET
	support in stage1 nor for build support.

gcc/

	PR bootstrap/96202
	* configure: Regenerated.

libbacktrace/

	PR bootstrap/96202
	* configure: Regenerated.

libcc1/

	PR bootstrap/96202
	* configure: Regenerated.

libcpp/

	PR bootstrap/96202
	* configure: Regenerated.

libdecnumber/

	PR bootstrap/96202
	* configure: Regenerated.

libiberty/

	PR bootstrap/96202
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/96202
	* configure: Regenerated.
---
 config/cet.m4          | 22 +++++++++++++++++-----
 gcc/configure          | 30 ++++++++++++++++++++++--------
 libbacktrace/configure | 22 +++++++++++++++++-----
 libcc1/configure       | 20 ++++++++++++++++----
 libcpp/configure       | 20 ++++++++++++++++----
 libdecnumber/configure | 20 ++++++++++++++++----
 libiberty/configure    | 20 ++++++++++++++++----
 lto-plugin/configure   | 24 ++++++++++++++++++------
 8 files changed, 138 insertions(+), 40 deletions(-)

diff --git a/config/cet.m4 b/config/cet.m4
index 911fbd46475..265756e4c81 100644
--- a/config/cet.m4
+++ b/config/cet.m4
@@ -13,7 +13,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET insn.
 	cet_save_CFLAGS="$CFLAGS"
 	CFLAGS="$CFLAGS -fcf-protection"
 	AC_COMPILE_IFELSE(
@@ -70,7 +70,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET.
 	AC_COMPILE_IFELSE(
 	 [AC_LANG_PROGRAM(
 	  [],
@@ -85,13 +85,25 @@ asm ("setssbsy");
 	 [enable_cet=no])
 	;;
       yes)
-	# Check if assembler supports CET.
+	# Check if compiler and assembler support CET.
 	AC_COMPILE_IFELSE(
 	 [AC_LANG_PROGRAM(
 	  [],
 	  [asm ("setssbsy");])],
-	 [],
-	 [AC_MSG_ERROR([assembler with CET support is required for --enable-cet])])
+	 [support_cet=yes],
+	 [support_cet=no])
+	if test $support_cet = "no"; then
+	  if test -z "${with_build_subdir}" \
+	     && (test ! -f ../stage_current \
+	         || test `cat ../stage_current` != "stage1"); then
+	    # Require CET support only for the final GCC build.
+	    AC_MSG_ERROR([compiler and assembler with CET support are required for --enable-cet])
+	  else
+	    # Don't enable CET without CET support in stage1 nor for
+	    # build support.
+	    enable_cet=no
+	  fi
+	fi
 	;;
     esac
     CFLAGS="$cet_save_CFLAGS"
diff --git a/gcc/configure b/gcc/configure
index f224679ed3e..6d06220eb2c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -785,10 +785,10 @@ manext
 LIBICONV_DEP
 LTLIBICONV
 LIBICONV
-ZSTD_LIB
-ZSTD_INCLUDE
 ZSTD_LDFLAGS
 ZSTD_CPPFLAGS
+ZSTD_LIB
+ZSTD_INCLUDE
 DL_LIB
 LDEXP_LIB
 EXTRA_GCC_LIBS
@@ -9978,6 +9978,8 @@ ZSTD_LIB=
 ZSTD_CPPFLAGS=
 ZSTD_LDFLAGS=
 
+
+
 # Check whether --with-zstd was given.
 if test "${with_zstd+set}" = set; then :
   withval=$with_zstd;
@@ -19021,7 +19023,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19022 "configure"
+#line 19026 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19127,7 +19129,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19128 "configure"
+#line 19132 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -30792,7 +30794,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -30818,7 +30820,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 	;;
       yes)
-	# Check if assembler supports CET.
+	# Check if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -30831,11 +30833,23 @@ asm ("setssbsy");
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-
+  support_cet=yes
 else
-  as_fn_error $? "assembler with CET support is required for --enable-cet" "$LINENO" 5
+  support_cet=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	if test $support_cet = "no"; then
+	  if test -z "${with_build_subdir}" \
+	     && (test ! -f ../stage_current \
+	         || test `cat ../stage_current` != "stage1"); then
+	    # Require CET support only for the final GCC build.
+	    as_fn_error $? "compiler and assembler with CET support are required for --enable-cet" "$LINENO" 5
+	  else
+	    # Don't enable CET without CET support in stage1 nor for
+	    # build support.
+	    enable_cet=no
+	  fi
+	fi
 	;;
     esac
     CFLAGS="$cet_save_CFLAGS"
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 37c38e7ac5b..e23ffc18edb 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -12169,7 +12169,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET insn.
 	cet_save_CFLAGS="$CFLAGS"
 	CFLAGS="$CFLAGS -fcf-protection"
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12409,7 +12409,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12435,7 +12435,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 	;;
       yes)
-	# Check if assembler supports CET.
+	# Check if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12448,11 +12448,23 @@ asm ("setssbsy");
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-
+  support_cet=yes
 else
-  as_fn_error $? "assembler with CET support is required for --enable-cet" "$LINENO" 5
+  support_cet=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	if test $support_cet = "no"; then
+	  if test -z "${with_build_subdir}" \
+	     && (test ! -f ../stage_current \
+	         || test `cat ../stage_current` != "stage1"); then
+	    # Require CET support only for the final GCC build.
+	    as_fn_error $? "compiler and assembler with CET support are required for --enable-cet" "$LINENO" 5
+	  else
+	    # Don't enable CET without CET support in stage1 nor for
+	    # build support.
+	    enable_cet=no
+	  fi
+	fi
 	;;
     esac
     CFLAGS="$cet_save_CFLAGS"
diff --git a/libcc1/configure b/libcc1/configure
index 37dbeac4908..896181ac703 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -14565,7 +14565,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -14591,7 +14591,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 	;;
       yes)
-	# Check if assembler supports CET.
+	# Check if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -14604,11 +14604,23 @@ asm ("setssbsy");
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-
+  support_cet=yes
 else
-  as_fn_error $? "assembler with CET support is required for --enable-cet" "$LINENO" 5
+  support_cet=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	if test $support_cet = "no"; then
+	  if test -z "${with_build_subdir}" \
+	     && (test ! -f ../stage_current \
+	         || test `cat ../stage_current` != "stage1"); then
+	    # Require CET support only for the final GCC build.
+	    as_fn_error $? "compiler and assembler with CET support are required for --enable-cet" "$LINENO" 5
+	  else
+	    # Don't enable CET without CET support in stage1 nor for
+	    # build support.
+	    enable_cet=no
+	  fi
+	fi
 	;;
     esac
     CFLAGS="$cet_save_CFLAGS"
diff --git a/libcpp/configure b/libcpp/configure
index 3329e20c392..b5ccd57a629 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -7564,7 +7564,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -7590,7 +7590,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 	;;
       yes)
-	# Check if assembler supports CET.
+	# Check if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -7603,11 +7603,23 @@ asm ("setssbsy");
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-
+  support_cet=yes
 else
-  as_fn_error $? "assembler with CET support is required for --enable-cet" "$LINENO" 5
+  support_cet=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	if test $support_cet = "no"; then
+	  if test -z "${with_build_subdir}" \
+	     && (test ! -f ../stage_current \
+	         || test `cat ../stage_current` != "stage1"); then
+	    # Require CET support only for the final GCC build.
+	    as_fn_error $? "compiler and assembler with CET support are required for --enable-cet" "$LINENO" 5
+	  else
+	    # Don't enable CET without CET support in stage1 nor for
+	    # build support.
+	    enable_cet=no
+	  fi
+	fi
 	;;
     esac
     CFLAGS="$cet_save_CFLAGS"
diff --git a/libdecnumber/configure b/libdecnumber/configure
index df6fdcfbc7f..94ee3357498 100755
--- a/libdecnumber/configure
+++ b/libdecnumber/configure
@@ -5217,7 +5217,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5243,7 +5243,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 	;;
       yes)
-	# Check if assembler supports CET.
+	# Check if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5256,11 +5256,23 @@ asm ("setssbsy");
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-
+  support_cet=yes
 else
-  as_fn_error $? "assembler with CET support is required for --enable-cet" "$LINENO" 5
+  support_cet=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	if test $support_cet = "no"; then
+	  if test -z "${with_build_subdir}" \
+	     && (test ! -f ../stage_current \
+	         || test `cat ../stage_current` != "stage1"); then
+	    # Require CET support only for the final GCC build.
+	    as_fn_error $? "compiler and assembler with CET support are required for --enable-cet" "$LINENO" 5
+	  else
+	    # Don't enable CET without CET support in stage1 nor for
+	    # build support.
+	    enable_cet=no
+	  fi
+	fi
 	;;
     esac
     CFLAGS="$cet_save_CFLAGS"
diff --git a/libiberty/configure b/libiberty/configure
index 1f8e23f0d23..4cd6cfe3291 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -5291,7 +5291,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5317,7 +5317,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 	;;
       yes)
-	# Check if assembler supports CET.
+	# Check if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5330,11 +5330,23 @@ asm ("setssbsy");
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-
+  support_cet=yes
 else
-  as_fn_error $? "assembler with CET support is required for --enable-cet" "$LINENO" 5
+  support_cet=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	if test $support_cet = "no"; then
+	  if test -z "${with_build_subdir}" \
+	     && (test ! -f ../stage_current \
+	         || test `cat ../stage_current` != "stage1"); then
+	    # Require CET support only for the final GCC build.
+	    as_fn_error $? "compiler and assembler with CET support are required for --enable-cet" "$LINENO" 5
+	  else
+	    # Don't enable CET without CET support in stage1 nor for
+	    # build support.
+	    enable_cet=no
+	  fi
+	fi
 	;;
     esac
     CFLAGS="$cet_save_CFLAGS"
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 69f6fce05c5..1666e87eedd 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -5687,7 +5687,7 @@ case "$host" in
     case "$enable_cet" in
       auto)
 	# Check if target supports multi-byte NOPs
-	# and if assembler supports CET insn.
+	# and if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5713,7 +5713,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 	;;
       yes)
-	# Check if assembler supports CET.
+	# Check if compiler and assembler support CET.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5726,11 +5726,23 @@ asm ("setssbsy");
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-
+  support_cet=yes
 else
-  as_fn_error $? "assembler with CET support is required for --enable-cet" "$LINENO" 5
+  support_cet=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	if test $support_cet = "no"; then
+	  if test -z "${with_build_subdir}" \
+	     && (test ! -f ../stage_current \
+	         || test `cat ../stage_current` != "stage1"); then
+	    # Require CET support only for the final GCC build.
+	    as_fn_error $? "compiler and assembler with CET support are required for --enable-cet" "$LINENO" 5
+	  else
+	    # Don't enable CET without CET support in stage1 nor for
+	    # build support.
+	    enable_cet=no
+	  fi
+	fi
 	;;
     esac
     CFLAGS="$cet_save_CFLAGS"
@@ -11947,7 +11959,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11950 "configure"
+#line 11962 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12053,7 +12065,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12056 "configure"
+#line 12068 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
-- 
2.26.2


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-07-30 12:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 14:47 [PATCH] Require CET support only for the final GCC build H.J. Lu
2020-07-15 15:20 ` Richard Biener
2020-07-15 15:26   ` H.J. Lu
2020-07-17  7:03     ` Richard Biener
2020-07-17 12:41       ` H.J. Lu
2020-07-15 17:16   ` Joseph Myers
2020-07-17  7:08     ` Richard Biener
2020-07-17 12:42       ` H.J. Lu
2020-07-17 13:27         ` Richard Biener
2020-07-17 13:46           ` H.J. Lu
2020-07-29 11:01             ` Richard Biener
2020-07-29 11:46               ` H.J. Lu
2020-07-29 12:17                 ` Richard Biener
2020-07-29 13:26                   ` Richard Biener
2020-07-29 19:30                     ` Joseph Myers
2020-07-30 12:27                       ` Richard Biener
2020-07-29 11:46               ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).