]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libcpp/configure
Require CET support only for the final GCC build
[thirdparty/gcc.git] / libcpp / configure
index 3329e20c392a41732c28fec9c3be912ac23bb7d0..7e28606f6056f5255b117f2ee5e27115f3f94b61 100755 (executable)
@@ -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,24 @@ 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 x$enable_bootstrap != xno \
+            && 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 for non-bootstrap
+           # build, in stage1 nor for build support.
+           enable_cet=no
+         fi
+       fi
        ;;
     esac
     CFLAGS="$cet_save_CFLAGS"