Enable building libvtv with Intel CET
authorIgor Tsimbalist <igor.v.tsimbalist@intel.com>
Fri, 17 Nov 2017 22:29:19 +0000 (23:29 +0100)
committerIgor Tsimbalist <itsimbal@gcc.gnu.org>
Fri, 17 Nov 2017 22:29:19 +0000 (23:29 +0100)
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.
* testsuite/libvtv.cc/vtv.exp: Add scanlang.exp.

From-SVN: r254897

libvtv/ChangeLog
libvtv/Makefile.in
libvtv/acinclude.m4
libvtv/configure
libvtv/configure.ac
libvtv/testsuite/Makefile.in
libvtv/testsuite/libvtv.cc/vtv.exp

index be5d9930ecc7cb81534b0e8fe3d350a9f27cf59b..64fcafe2a6fae64ed922bd6453dadb615ef53412 100644 (file)
@@ -1,3 +1,12 @@
+2017-11-17  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+       * acinclude.m4: Add enable.m4 and cet.m4.
+       * Makefile.in: Regenerate.
+       * testsuite/Makefile.in: Likewise.
+       * configure: Likewise.
+       * configure.ac: Set CET_FLAGS. Update XCFLAGS.
+       * testsuite/libvtv.cc/vtv.exp: Add scanlang.exp.
+
 2017-01-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR other/79046
index 59d0b11bdd0620d1cd624918f8d10433ef6d34ba..606b7c0ce7e97a59a9ec8b3116526d1be78c1388 100644 (file)
@@ -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 \
index 53e62d24c11ac10e03056c76d1176643f7264bd8..1113a3fe46c89a374dca507c0b1d6a96a8f0619b 100644 (file)
@@ -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.
index c3bed2dfc708431b672fb4d46e52aecfee96396d..aa8a30133adf15b74570613ea95f013222470257 100755 (executable)
@@ -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 "$host" in
+  i[34567]86-*-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"
+fi
+
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
+
 
 if test "${multilib}" = "yes"; then
   multilib_arg="--enable-multilib"
index 33b1e7913c64894fc30b52805ebc688b5cdf7ee5..ba3009ee3fb6617b0913eb9b80da9ba429663755 100644 (file)
@@ -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
index b5dfd29973ce8afad2af63ec50a1717d2360078c..f6314708e9f79d83e7102ffa8047ba3de46b0d65 100644 (file)
@@ -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
index 12ed77431a8f83985d465d22de31489fe42a827a..2024fba5f25ef8d5dd1268e2751f92ed66c9c18d 100644 (file)
@@ -1,4 +1,5 @@
 load_lib libvtv-dg.exp
+load_gcc_lib scanlang.exp
 load_gcc_lib gcc-dg.exp
 
 global VTV_FLAGS