Sync config with GCC

Message ID 20200516130812.58320-1-hjl.tools@gmail.com
State New
Headers show
Series
  • Sync config with GCC
Related show

Commit Message

Sync with GCC
	2020-05-15  H.J. Lu  <hongjiu.lu@intel.com>

	PR bootstrap/95147
	* cet.m4 (GCC_CET_FLAGS): Also check if -fcf-protection works
	when defaulting to auto.

	2020-05-14  H.J. Lu  <hongjiu.lu@intel.com>

	* cet.m4 (GCC_CET_FLAGS): Change default to auto.
---
 config/ChangeLog | 13 +++++++++++++
 config/cet.m4    |  5 ++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

-- 
2.26.2

Patch

diff --git a/config/ChangeLog b/config/ChangeLog
index de8c327b54..0e988b19c9 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,16 @@ 
+2020-05-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+	Sync with GCC
+	2020-05-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR bootstrap/95147
+	* cet.m4 (GCC_CET_FLAGS): Also check if -fcf-protection works
+	when defaulting to auto.
+
+	2020-05-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* cet.m4 (GCC_CET_FLAGS): Change default to auto.
+
 2020-05-12  H.J. Lu  <hongjiu.lu@intel.com>
 
 	Sync with GCC
diff --git a/config/cet.m4 b/config/cet.m4
index d9608699cd..2bb2c8a95a 100644
--- a/config/cet.m4
+++ b/config/cet.m4
@@ -3,7 +3,7 @@  dnl GCC_CET_FLAGS
 dnl    (SHELL-CODE_HANDLER)
 dnl
 AC_DEFUN([GCC_CET_FLAGS],[dnl
-GCC_ENABLE(cet, no, ,[enable Intel CET in target libraries],
+GCC_ENABLE(cet, auto, ,[enable Intel CET in target libraries],
 	   permit yes|no|auto)
 AC_MSG_CHECKING([for CET support])
 
@@ -13,6 +13,8 @@  case "$host" in
       auto)
 	# Check if target supports multi-byte NOPs
 	# and if assembler supports CET insn.
+	save_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS -fcf-protection"
 	AC_COMPILE_IFELSE(
 	 [AC_LANG_PROGRAM(
 	  [],
@@ -25,6 +27,7 @@  asm ("setssbsy");
 	  ])],
 	 [enable_cet=yes],
 	 [enable_cet=no])
+	CFLAGS="$save_CFLAGS"
 	;;
       yes)
 	# Check if assembler supports CET.