public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] CET shouldn't be enabled in 32-bit run-time libraries by defualt
@ 2018-02-14 13:50 Tsimbalist, Igor V
  2018-02-16 23:45 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Tsimbalist, Igor V @ 2018-02-14 13:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jeff Law, Tsimbalist, Igor V

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

ENDBR32 and RDSSPD are multi-byte NOPs on x86-64 processors and
newer x86 processors, starting Pentium Pro.  They are UD on older 32-bit
processors. Detect this at configure time and adjust the default value
for enable_cet. GCC will enable CET in 32-bit run-time libraries in any case
if --enable-cet is used to configure GCC.

OK for trunk?

Igor



[-- Attachment #2: 0001-CET-shouldn-t-be-enabled-in-32-bit-run-time-librarie.patch --]
[-- Type: application/octet-stream, Size: 23884 bytes --]

From 90d34052fd86315094501ef57432a337d61b6fcc Mon Sep 17 00:00:00 2001
From: Igor Tsimbalist <igor.v.tsimbalist@intel.com>
Date: Wed, 14 Feb 2018 16:15:42 +0300
Subject: [PATCH] CET shouldn't be enabled in 32-bit run-time libraries by
 default

	PR target/84148
	* config/cet.m4: Check if target support multi-byte NOPS (SSE).
	* libatomic/configure: Regenerate.
	* libbacktrace/configure: Likewise.
	* libgcc/configure: Likewise.
	* libgfortran/configure: Likewise.
	* libgomp/configure: Likewise.
	* libitm/configure: Likewise.
	* libmpx/configure: Likewise.
	* libobjc/configure: Likewise.
	* libquadmath/configure: Likewise.
	* libsanitizer/configure: Likewise.
	* libssp/configure: Likewise.
	* libstdc++-v3/configure: Likewise.
	* libvtv/configure: Likewise.
---
 config/ChangeLog       |  4 ++++
 config/cet.m4          | 16 ++++++++++++++--
 libatomic/ChangeLog    |  4 ++++
 libatomic/configure    | 17 ++++++++++++++++-
 libbacktrace/ChangeLog |  4 ++++
 libbacktrace/configure | 17 ++++++++++++++++-
 libgcc/ChangeLog       |  4 ++++
 libgcc/configure       | 17 ++++++++++++++++-
 libgfortran/ChangeLog  |  4 ++++
 libgfortran/configure  | 21 ++++++++++++++++++---
 libgomp/ChangeLog      |  4 ++++
 libgomp/configure      | 19 +++++++++++++++++--
 libitm/ChangeLog       |  4 ++++
 libitm/configure       | 17 ++++++++++++++++-
 libmpx/ChangeLog       |  6 +++++-
 libmpx/configure       | 17 ++++++++++++++++-
 libobjc/ChangeLog      |  4 ++++
 libobjc/configure      | 21 ++++++++++++++++++---
 libquadmath/ChangeLog  |  4 ++++
 libquadmath/configure  | 17 ++++++++++++++++-
 libsanitizer/ChangeLog |  4 ++++
 libsanitizer/configure | 17 ++++++++++++++++-
 libssp/ChangeLog       |  4 ++++
 libssp/configure       | 21 ++++++++++++++++++---
 libstdc++-v3/ChangeLog |  4 ++++
 libstdc++-v3/configure | 17 ++++++++++++++++-
 libvtv/ChangeLog       |  4 ++++
 libvtv/configure       | 17 ++++++++++++++++-
 28 files changed, 286 insertions(+), 23 deletions(-)

diff --git a/config/ChangeLog b/config/ChangeLog
index fd7f82f..c807d0d 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* cet.m4: Check if target support multi-byte NOPS (SSE).
+
 2018-02-06  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* gcc-plugin.m4 (GCC_ENABLE_PLUGINS): Remove -q option passed to grep.
diff --git a/config/cet.m4 b/config/cet.m4
index 715f4bd..23dd1f7 100644
--- a/config/cet.m4
+++ b/config/cet.m4
@@ -5,15 +5,24 @@ dnl
 AC_DEFUN([GCC_CET_FLAGS],[dnl
 GCC_ENABLE(cet, default, ,[enable Intel CET in target libraries],
 	   permit yes|no|default)
+AC_MSG_CHECKING([for CET support])
+
 case "$host" in
   i[[34567]]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	AC_COMPILE_IFELSE(
 	 [AC_LANG_PROGRAM(
 	  [],
-	  [asm ("setssbsy");])],
+	  [
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
+asm ("setssbsy");
+#endif
+	  ])],
 	 [enable_cet=yes],
 	 [enable_cet=no])
 	;;
@@ -34,5 +43,8 @@ case "$host" in
 esac
 if test x$enable_cet = xyes; then
   $1="-fcf-protection -mcet"
+  AC_MSG_RESULT([yes])
+else
+  AC_MSG_RESULT([no])
 fi
 ])
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index c64a1aa..2019f3c 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libatomic/configure b/libatomic/configure
index 47a9b98..9445aee 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -15314,18 +15314,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -15365,6 +15375,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 XCFLAGS="$XCFLAGS $CET_FLAGS"
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index 9ebce20..e766aa6 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-01-31  Ian Lance Taylor  <iant@golang.org>
 
 	* elf.c (elf_add): Close descriptor if we use a debugfile.
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 8943b0c..77c6fe3 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -11802,18 +11802,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -11853,6 +11863,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   EXTRA_FLAGS="$EXTRA_FLAGS $CET_FLAGS"
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 692773d..e89e188 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-02-08  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
 
 	PR target/84239
diff --git a/libgcc/configure b/libgcc/configure
index 38a28c2..3241f19 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -4790,18 +4790,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -4841,6 +4851,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 77ae9f7..705ef8a 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-01-31  Janne Blomqvist  <jb@gcc.gnu.org>
 
 	* generated/cshift1_16.c (cshift1): Regenerated.
diff --git a/libgfortran/configure b/libgfortran/configure
index 60e18a7..86904ef 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -5804,18 +5804,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -5855,6 +5865,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 AM_FCFLAGS="$AM_FCFLAGS $CET_FLAGS"
@@ -12498,7 +12513,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12501 "configure"
+#line 12516 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12604,7 +12619,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12607 "configure"
+#line 12622 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 91b47ce..b4e848d 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-02-07  Tom de Vries  <tom@codesourcery.com>
 
 	PR libgomp/84217
diff --git a/libgomp/configure b/libgomp/configure
index e7842b5..92b8142 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -15142,7 +15142,7 @@ fi
 
 # Plugins for offload execution, configure.ac fragment.  -*- mode: autoconf -*-
 #
-# Copyright (C) 2014-2017 Free Software Foundation, Inc.
+# Copyright (C) 2014-2018 Free Software Foundation, Inc.
 #
 # Contributed by Mentor Embedded.
 #
@@ -16633,18 +16633,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -16684,6 +16694,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 XCFLAGS="$XCFLAGS $CET_FLAGS"
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index f335144..976fd7e 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libitm/configure b/libitm/configure
index d061c8c..a57805e 100644
--- a/libitm/configure
+++ b/libitm/configure
@@ -17603,18 +17603,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -17654,6 +17664,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 XCFLAGS="$XCFLAGS $CET_FLAGS"
diff --git a/libmpx/ChangeLog b/libmpx/ChangeLog
index 9ae6542..9ae4bff 100644
--- a/libmpx/ChangeLog
+++ b/libmpx/ChangeLog
@@ -1,4 +1,8 @@
- 2017-11-17  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
+2017-11-17  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
 
 	 * Makefile.in: Regenerate.
 	 * acinclude.m4: Add enable.m4 and cet.m4.
diff --git a/libmpx/configure b/libmpx/configure
index 7bc68b8..dfa4419 100644
--- a/libmpx/configure
+++ b/libmpx/configure
@@ -11598,18 +11598,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -11649,6 +11659,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 XCFLAGS="$XCFLAGS $CET_FLAGS"
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index 50d0769..59cc68b 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libobjc/configure b/libobjc/configure
index 3a2b2e3..ce52fab 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -3369,18 +3369,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -3420,6 +3430,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 XCFLAGS="$XCFLAGS $CET_FLAGS"
@@ -10668,7 +10683,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10671 "configure"
+#line 10686 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10774,7 +10789,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10777 "configure"
+#line 10792 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog
index a554923..40e9d2c 100644
--- a/libquadmath/ChangeLog
+++ b/libquadmath/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
 
 	* libquadmath.texi: Bump @copying's copyright year.
diff --git a/libquadmath/configure b/libquadmath/configure
index b32dcbc..2a69479 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -12837,18 +12837,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -12888,6 +12898,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 XCFLAGS="$XCFLAGS $CET_FLAGS"
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index ebb8866..213e193 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-02-05  Martin Liska  <mliska@suse.cz>
 
 	* asan/asan_flags.inc: Cherry-pick upstream r323995.
diff --git a/libsanitizer/configure b/libsanitizer/configure
index a0104d8..3b61a1f 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -16539,18 +16539,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -16590,6 +16600,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 EXTRA_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS"
diff --git a/libssp/ChangeLog b/libssp/ChangeLog
index 66254fe..9aeea0b 100644
--- a/libssp/ChangeLog
+++ b/libssp/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libssp/configure b/libssp/configure
index a96b391..df7bff7 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -4095,18 +4095,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -4146,6 +4156,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 XCFLAGS="$XCFLAGS $CET_FLAGS"
@@ -10745,7 +10760,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10748 "configure"
+#line 10763 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10851,7 +10866,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10854 "configure"
+#line 10869 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 98b4295..7372554 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-01-29  Jonathan Wakely  <jwakely@redhat.com>
 
 	PR libstdc++/83833
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 69845f4..e1a9a17 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -81115,18 +81115,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -81166,6 +81176,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 EXTRA_CXX_FLAGS="$EXTRA_CXX_FLAGS $CET_FLAGS"
diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog
index 3425da2..6c37d3c 100644
--- a/libvtv/ChangeLog
+++ b/libvtv/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+	* configure: Regenerate.
+
 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
 
 	Update copyright years.
diff --git a/libvtv/configure b/libvtv/configure
index aa8a301..1cd1f70 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -15473,18 +15473,28 @@ else
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
+$as_echo_n "checking for CET support... " >&6; }
+
 case "$host" in
   i[34567]86-*-linux* | x86_64-*-linux*)
     case "$enable_cet" in
       default)
-	# Check if assembler supports CET.
+	# Check if target supports multi-byte NOPs
+	# and if assembler supports CET insn.
 	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+
+#if !defined(__SSE2__)
+#error target does not support multi-byte NOPs
+#else
 asm ("setssbsy");
+#endif
+
   ;
   return 0;
 }
@@ -15524,6 +15534,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 esac
 if test x$enable_cet = xyes; then
   CET_FLAGS="-fcf-protection -mcet"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 XCFLAGS="$XCFLAGS $CET_FLAGS"
-- 
1.8.3.1


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

* Re: [PATCH] CET shouldn't be enabled in 32-bit run-time libraries by defualt
  2018-02-14 13:50 [PATCH] CET shouldn't be enabled in 32-bit run-time libraries by defualt Tsimbalist, Igor V
@ 2018-02-16 23:45 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2018-02-16 23:45 UTC (permalink / raw)
  To: Tsimbalist, Igor V, gcc-patches

On 02/14/2018 06:49 AM, Tsimbalist, Igor V wrote:
> ENDBR32 and RDSSPD are multi-byte NOPs on x86-64 processors and
> newer x86 processors, starting Pentium Pro.  They are UD on older 32-bit
> processors. Detect this at configure time and adjust the default value
> for enable_cet. GCC will enable CET in 32-bit run-time libraries in any case
> if --enable-cet is used to configure GCC.
> 
> OK for trunk?
OK.
jeff

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

end of thread, other threads:[~2018-02-16 23:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 13:50 [PATCH] CET shouldn't be enabled in 32-bit run-time libraries by defualt Tsimbalist, Igor V
2018-02-16 23:45 ` Jeff Law

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).