aboutsummaryrefslogtreecommitdiff
path: root/config/cet.m4
diff options
context:
space:
mode:
Diffstat (limited to 'config/cet.m4')
-rw-r--r--config/cet.m423
1 files changed, 18 insertions, 5 deletions
diff --git a/config/cet.m4 b/config/cet.m4
index 911fbd4..c67fb4f 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,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"