Use exact match in get_var_value
[deliverable/binutils-gdb.git] / config / cet.m4
index 911fbd4647577dd2adae4dcee316ea58eaf0cc8f..c67fb4f35b65b84a88bcbebadaf8d12781025a75 100644 (file)
@@ -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,26 @@ 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 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.
+           AC_MSG_ERROR([compiler and assembler with CET support are required for --enable-cet])
+         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"
This page took 0.0247 seconds and 4 git commands to generate.