public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 15/22] Enable building libvtv with Intel CET
@ 2017-10-12 20:31 Tsimbalist, Igor V
  2017-10-18  1:42 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Tsimbalist, Igor V @ 2017-10-12 20:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jeff Law, cmtice, Tsimbalist, Igor V

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

Enable building libvtv with Intel CET options.

libvtv/
	* acinclude.m4: Add enable.m4 and cet.m4.
	* libvtv/configure: Regenerate.
	* libvtv/configure.ac: Set CET_FLAGS. Update XCFLAGS.
	

[-- Attachment #2: 0015-Enable-building-libvtv-with-Intel-CET.PATCH --]
[-- Type: application/octet-stream, Size: 4469 bytes --]

From 113f0cd1cb1dbe2ff61f5a1816058f9a980f8794 Mon Sep 17 00:00:00 2001
From: Igor Tsimbalist <igor.v.tsimbalist@intel.com>
Date: Tue, 15 Aug 2017 19:43:24 +0300
Subject: [PATCH 15/22] Enable building libvtv with Intel CET

libvtv/
	* acinclude.m4: Add enable.m4 and cet.m4.
	* libvtv/configure: Regenerate.
	* libvtv/configure.ac: Set CET_FLAGS. Update XCFLAGS.
---
 libvtv/acinclude.m4 |  2 ++
 libvtv/configure    | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 libvtv/configure.ac |  5 ++++
 3 files changed, 82 insertions(+), 2 deletions(-)
---
 libvtv/acinclude.m4 |  2 ++
 libvtv/configure    | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 libvtv/configure.ac |  5 ++++
 3 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/libvtv/acinclude.m4 b/libvtv/acinclude.m4
index 53e62d2..1113a3f 100644
--- a/libvtv/acinclude.m4
+++ b/libvtv/acinclude.m4
@@ -2,6 +2,8 @@ dnl ----------------------------------------------------------------------
 dnl This whole bit snagged from libgfortran.
 
 sinclude(../libtool.m4)
+sinclude(../config/enable.m4)
+sinclude(../config/cet.m4)
 dnl The lines below arrange for aclocal not to bring an installed
 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
 dnl add a definition of LIBTOOL to Makefile.in.
diff --git a/libvtv/configure b/libvtv/configure
index c3bed2d..6477926 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -760,6 +760,7 @@ with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+enable_cet
 with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
@@ -1404,6 +1405,8 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-cet            enable Intel CET in target libraries
+                          [default=default]
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -12066,7 +12069,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12069 "configure"
+#line 12072 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12172,7 +12175,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12175 "configure"
+#line 12178 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15456,6 +15459,76 @@ libtool_VERSION=1:0:0
 
 XCFLAGS="-D_GNU_SOURCE -Wall -Wextra -fno-exceptions"
 
+# Add CET specific flags if Intel CET is enabled.
+ # Check whether --enable-cet was given.
+if test "${enable_cet+set}" = set; then :
+  enableval=$enable_cet;
+      case "$enableval" in
+       yes|no|default) ;;
+       *) as_fn_error "Unknown argument to enable/disable cet" "$LINENO" 5 ;;
+                          esac
+
+else
+  enable_cet=default
+fi
+
+
+case "$target" in
+  i3456786-*-linux* | x86_64-*-linux*)
+    case "$enable_cet" in
+      default)
+	# Check if assembler supports CET.
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+asm ("setssbsy");
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  enable_cet=yes
+else
+  enable_cet=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	;;
+      yes)
+	# Check if assembler supports CET.
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+asm ("setssbsy");
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  as_fn_error "assembler with CET support is required for --enable-cet" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	;;
+    esac
+    ;;
+  *)
+    enable_cet=no
+    ;;
+esac
+if test x$enable_cet = xyes; then
+  CET_FLAGS="-fcf-protection -mcet -include cet.h"
+fi
+
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
+
 
 if test "${multilib}" = "yes"; then
   multilib_arg="--enable-multilib"
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index 33b1e79..ba3009e 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -151,6 +151,11 @@ libtool_VERSION=1:0:0
 AC_SUBST(libtool_VERSION)
 
 XCFLAGS="-D_GNU_SOURCE -Wall -Wextra -fno-exceptions"
+
+# Add CET specific flags if Intel CET is enabled.
+GCC_CET_FLAGS(CET_FLAGS)
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
 AC_SUBST(XCFLAGS)
 
 if test "${multilib}" = "yes"; then
-- 
1.8.3.1


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

* Re: [PATCH 15/22] Enable building libvtv with Intel CET
  2017-10-12 20:31 [PATCH 15/22] Enable building libvtv with Intel CET Tsimbalist, Igor V
@ 2017-10-18  1:42 ` Jeff Law
  2017-10-31 12:12   ` Tsimbalist, Igor V
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2017-10-18  1:42 UTC (permalink / raw)
  To: Tsimbalist, Igor V, gcc-patches; +Cc: cmtice

On 10/12/2017 02:29 PM, Tsimbalist, Igor V wrote:
> Enable building libvtv with Intel CET options.
> 
> libvtv/
> 	* acinclude.m4: Add enable.m4 and cet.m4.
> 	* libvtv/configure: Regenerate.
> 	* libvtv/configure.ac: Set CET_FLAGS. Update XCFLAGS.
Same comments as with libcilkrts.
Jeff


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

* RE: [PATCH 15/22] Enable building libvtv with Intel CET
  2017-10-18  1:42 ` Jeff Law
@ 2017-10-31 12:12   ` Tsimbalist, Igor V
  2017-11-08 17:33     ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Tsimbalist, Igor V @ 2017-10-31 12:12 UTC (permalink / raw)
  To: Jeff Law, gcc-patches; +Cc: cmtice, Tsimbalist, Igor V

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

The revised patch is attached. The differences are in what options are defined and propagated to Makefile for CET enabling.
 
Ok for trunk?

Igor


> -----Original Message-----
> From: Jeff Law [mailto:law@redhat.com]
> Sent: Wednesday, October 18, 2017 1:38 AM
> To: Tsimbalist, Igor V <igor.v.tsimbalist@intel.com>; gcc-
> patches@gcc.gnu.org
> Cc: cmtice@google.com
> Subject: Re: [PATCH 15/22] Enable building libvtv with Intel CET
> 
> On 10/12/2017 02:29 PM, Tsimbalist, Igor V wrote:
> > Enable building libvtv with Intel CET options.
> >
> > libvtv/
> > 	* acinclude.m4: Add enable.m4 and cet.m4.
> > 	* libvtv/configure: Regenerate.
> > 	* libvtv/configure.ac: Set CET_FLAGS. Update XCFLAGS.
> Same comments as with libcilkrts.
> Jeff
> 


[-- Attachment #2: 0015-Enable-building-libvtv-with-Intel-CET.PATCH --]
[-- Type: application/octet-stream, Size: 5850 bytes --]

From cf1746f369de4fcd78bba197b05ba78f8b4f0b4e Mon Sep 17 00:00:00 2001
From: Igor Tsimbalist <igor.v.tsimbalist@intel.com>
Date: Tue, 15 Aug 2017 19:43:24 +0300
Subject: [PATCH 15/21] Enable building libvtv with Intel CET

libvtv/
	* acinclude.m4: Add enable.m4 and cet.m4.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Likewise.
	* configure: Likewise.
	* configure.ac: Set CET_FLAGS. Update XCFLAGS.
---
 libvtv/Makefile.in           |  3 +-
 libvtv/acinclude.m4          |  2 ++
 libvtv/configure             | 79 ++++++++++++++++++++++++++++++++++++++++++--
 libvtv/configure.ac          |  5 +++
 libvtv/testsuite/Makefile.in |  3 +-
 5 files changed, 88 insertions(+), 4 deletions(-)

diff --git a/libvtv/Makefile.in b/libvtv/Makefile.in
index 59d0b11..606b7c0 100644
--- a/libvtv/Makefile.in
+++ b/libvtv/Makefile.in
@@ -71,7 +71,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-	$(top_srcdir)/configure.ac
+	$(top_srcdir)/../config/enable.m4 \
+	$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
diff --git a/libvtv/acinclude.m4 b/libvtv/acinclude.m4
index 53e62d2..1113a3f 100644
--- a/libvtv/acinclude.m4
+++ b/libvtv/acinclude.m4
@@ -2,6 +2,8 @@ dnl ----------------------------------------------------------------------
 dnl This whole bit snagged from libgfortran.
 
 sinclude(../libtool.m4)
+sinclude(../config/enable.m4)
+sinclude(../config/cet.m4)
 dnl The lines below arrange for aclocal not to bring an installed
 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
 dnl add a definition of LIBTOOL to Makefile.in.
diff --git a/libvtv/configure b/libvtv/configure
index c3bed2d..ab48ff0 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -760,6 +760,7 @@ with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+enable_cet
 with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
@@ -1404,6 +1405,8 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-cet            enable Intel CET in target libraries
+                          [default=default]
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -12066,7 +12069,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12069 "configure"
+#line 12072 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12172,7 +12175,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12175 "configure"
+#line 12178 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15456,6 +15459,78 @@ libtool_VERSION=1:0:0
 
 XCFLAGS="-D_GNU_SOURCE -Wall -Wextra -fno-exceptions"
 
+# Add CET specific flags if Intel CET is enabled.
+ # Check whether --enable-cet was given.
+if test "${enable_cet+set}" = set; then :
+  enableval=$enable_cet;
+      case "$enableval" in
+       yes|no|default) ;;
+       *) as_fn_error "Unknown argument to enable/disable cet" "$LINENO" 5 ;;
+                          esac
+
+else
+  enable_cet=default
+fi
+
+
+case "$host" in
+  i3456786-*-linux* | x86_64-*-linux*)
+    enable_cet_compatibility=yes
+    case "$enable_cet" in
+      default)
+	# Check if assembler supports CET.
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+asm ("setssbsy");
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  enable_cet=yes
+else
+  enable_cet=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	;;
+      yes)
+	# Check if assembler supports CET.
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+asm ("setssbsy");
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  as_fn_error "assembler with CET support is required for --enable-cet" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	;;
+    esac
+    ;;
+  *)
+    enable_cet=no
+    enable_cet_compatibility=no
+    ;;
+esac
+if test x$enable_cet = xyes; then
+  CET_FLAGS="-fcf-protection -mcet"
+fi
+
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
+
 
 if test "${multilib}" = "yes"; then
   multilib_arg="--enable-multilib"
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index 33b1e79..ba3009e 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -151,6 +151,11 @@ libtool_VERSION=1:0:0
 AC_SUBST(libtool_VERSION)
 
 XCFLAGS="-D_GNU_SOURCE -Wall -Wextra -fno-exceptions"
+
+# Add CET specific flags if Intel CET is enabled.
+GCC_CET_FLAGS(CET_FLAGS)
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
 AC_SUBST(XCFLAGS)
 
 if test "${multilib}" = "yes"; then
diff --git a/libvtv/testsuite/Makefile.in b/libvtv/testsuite/Makefile.in
index b5dfd29..f631470 100644
--- a/libvtv/testsuite/Makefile.in
+++ b/libvtv/testsuite/Makefile.in
@@ -64,7 +64,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
 	$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
 	$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
-	$(top_srcdir)/configure.ac
+	$(top_srcdir)/../config/enable.m4 \
+	$(top_srcdir)/../config/cet.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
-- 
1.8.3.1


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

* Re: [PATCH 15/22] Enable building libvtv with Intel CET
  2017-10-31 12:12   ` Tsimbalist, Igor V
@ 2017-11-08 17:33     ` Jeff Law
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2017-11-08 17:33 UTC (permalink / raw)
  To: Tsimbalist, Igor V, gcc-patches; +Cc: cmtice

On 10/31/2017 06:10 AM, Tsimbalist, Igor V wrote:
> The revised patch is attached. The differences are in what options are defined and propagated to Makefile for CET enabling.
>  
> Ok for trunk?
> 
> Igor
> 
> 
>> -----Original Message-----
>> From: Jeff Law [mailto:law@redhat.com]
>> Sent: Wednesday, October 18, 2017 1:38 AM
>> To: Tsimbalist, Igor V <igor.v.tsimbalist@intel.com>; gcc-
>> patches@gcc.gnu.org
>> Cc: cmtice@google.com
>> Subject: Re: [PATCH 15/22] Enable building libvtv with Intel CET
>>
>> On 10/12/2017 02:29 PM, Tsimbalist, Igor V wrote:
>>> Enable building libvtv with Intel CET options.
>>>
>>> libvtv/
>>> 	* acinclude.m4: Add enable.m4 and cet.m4.
>>> 	* libvtv/configure: Regenerate.
>>> 	* libvtv/configure.ac: Set CET_FLAGS. Update XCFLAGS.
>> Same comments as with libcilkrts.
>> Jeff
>>
> 
> 0015-Enable-building-libvtv-with-Intel-CET.PATCH
> 
> 
> From cf1746f369de4fcd78bba197b05ba78f8b4f0b4e Mon Sep 17 00:00:00 2001
> From: Igor Tsimbalist <igor.v.tsimbalist@intel.com>
> Date: Tue, 15 Aug 2017 19:43:24 +0300
> Subject: [PATCH 15/21] Enable building libvtv with Intel CET
> 
> libvtv/
> 	* acinclude.m4: Add enable.m4 and cet.m4.
> 	* Makefile.in: Regenerate.
> 	* testsuite/Makefile.in: Likewise.
> 	* configure: Likewise.
> 	* configure.ac: Set CET_FLAGS. Update XCFLAGS.
OK.  Please wait to commit until entire set is ACK'd.

Jeff

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

end of thread, other threads:[~2017-11-08 17:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-12 20:31 [PATCH 15/22] Enable building libvtv with Intel CET Tsimbalist, Igor V
2017-10-18  1:42 ` Jeff Law
2017-10-31 12:12   ` Tsimbalist, Igor V
2017-11-08 17:33     ` 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).