Enable building libmpx with Intel CET
authorIgor Tsimbalist <itsimbal@gcc.gnu.org>
Fri, 17 Nov 2017 22:41:10 +0000 (23:41 +0100)
committerIgor Tsimbalist <itsimbal@gcc.gnu.org>
Fri, 17 Nov 2017 22:41:10 +0000 (23:41 +0100)
libmpx/
* Makefile.in: Regenerate.
* acinclude.m4: Add enable.m4 and cet.m4.
* configure: Regenerate.
* configure.ac: Set CET_FLAGS. Update XCFLAGS.
* mpxrt/Makefile.am: Update libmpx_la_CFLAGS.
* mpxrt/Makefile.in: Regenerate.
* mpxwrap/Makefile.am: Add AM_CFLAGS. Update
libmpxwrappers_la_CFLAGS.
* mpxwrap/Makefile.in: Regenerate.

From-SVN: r254900

libmpx/ChangeLog
libmpx/Makefile.in
libmpx/acinclude.m4
libmpx/configure
libmpx/configure.ac
libmpx/mpxrt/Makefile.am
libmpx/mpxrt/Makefile.in
libmpx/mpxwrap/Makefile.am
libmpx/mpxwrap/Makefile.in

index 3edc2d499c6f5806868cf7e46c9e9449c0745b0c..9ae654270b773f032172a1ef1c5d413f58d3d707 100644 (file)
@@ -1,3 +1,15 @@
+ 2017-11-17  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+        * Makefile.in: Regenerate.
+        * acinclude.m4: Add enable.m4 and cet.m4.
+        * configure: Regenerate.
+        * configure.ac: Set CET_FLAGS. Update XCFLAGS.
+        * mpxrt/Makefile.am: Update libmpx_la_CFLAGS.
+        * mpxrt/Makefile.in: Regenerate.
+        * mpxwrap/Makefile.am: Add AM_CFLAGS. Update
+        libmpxwrappers_la_CFLAGS.
+        * mpxwrap/Makefile.in: Regenerate.
+
 2017-01-30  Jakub Jelinek  <jakub@redhat.com>
 
        * mpxrt/mpxrt-utils.h (__mpxrt_stop): New prototype.
index 5e58b7299bfb9509a06dc70ea39c845e58e3a6d4..358956c917b2810c11857611861d8a35bc1938cf 100644 (file)
@@ -66,7 +66,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 38e0808ad933ea3560b68635887ffadc4f9ec6a3..c432ae660a178320f4c264f2a5b7c5cae4fb9a99 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 853993a522f1a298d5fee223aec74810aca9131b..7bc68b81e4f4bb969a117a376a43cf13398cf83e 100644 (file)
@@ -732,6 +732,7 @@ with_pic
 enable_fast_install
 with_gnu_ld
 enable_libtool_lock
+enable_cet
 with_gcc_major_version_only
 '
       ac_precious_vars='build_alias
@@ -1372,6 +1373,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]
@@ -11234,7 +11237,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11237 "configure"
+#line 11240 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11340,7 +11343,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11343 "configure"
+#line 11346 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11581,6 +11584,75 @@ CC="$lt_save_CC"
 
 
 XCFLAGS="-Wall -Wextra"
+# Add CET specific flags if 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
index baa882b16b0484c03181de1c5c6126dea9dbe44b..dc0c2a83809c6355456f606f22cd93a821c2d99f 100644 (file)
@@ -117,6 +117,10 @@ AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
 
 XCFLAGS="-Wall -Wextra"
+# Add CET specific flags if CET is enabled
+GCC_CET_FLAGS(CET_FLAGS)
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
 AC_SUBST(XCFLAGS)
 
 if test "${multilib}" = "yes"; then
index 41c806f97228b2bc7537c27aee0b651826e16421..0dd0bed4e237fed365ed867f3d648912702ee165 100644 (file)
@@ -11,7 +11,7 @@ toolexeclib_LTLIBRARIES = libmpx.la
 
 libmpx_la_SOURCES = mpxrt.c mpxrt-utils.c
 
-libmpx_la_CFLAGS = -fPIC
+libmpx_la_CFLAGS = -fPIC $(XCFLAGS)
 libmpx_la_DEPENDENCIES = libmpx.map
 libmpx_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libmpx.map $(link_libmpx) \
                     -version-info `grep -v '^\#' $(srcdir)/libtool-version`
index 4c55d20c13ebf7ac4ebb3dc2c5a85d24970ed260..17e0ac52b04a021e03c42ce7ba0ec680961b9c1d 100644 (file)
@@ -62,7 +62,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
@@ -256,7 +257,7 @@ ACLOCAL_AMFLAGS = -I $(top_srcdir) -I $(top_srcdir)/config
 @LIBMPX_SUPPORTED_TRUE@AM_CFLAGS = $(XCFLAGS)
 @LIBMPX_SUPPORTED_TRUE@toolexeclib_LTLIBRARIES = libmpx.la
 @LIBMPX_SUPPORTED_TRUE@libmpx_la_SOURCES = mpxrt.c mpxrt-utils.c
-@LIBMPX_SUPPORTED_TRUE@libmpx_la_CFLAGS = -fPIC
+@LIBMPX_SUPPORTED_TRUE@libmpx_la_CFLAGS = -fPIC $(XCFLAGS)
 @LIBMPX_SUPPORTED_TRUE@libmpx_la_DEPENDENCIES = libmpx.map
 @LIBMPX_SUPPORTED_TRUE@libmpx_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libmpx.map $(link_libmpx) \
 @LIBMPX_SUPPORTED_TRUE@                    -version-info `grep -v '^\#' $(srcdir)/libtool-version`
index d9e84ae66219d117e55cbc6be9dee18b55d573f6..6dba674fff1e781a22fc07830351d72d1f1b3a51 100644 (file)
@@ -1,11 +1,13 @@
 ALCLOCAL_AMFLAGS = -I .. -I ../config
 AM_CPPFLAGS = -I $(top_srcdir)
+AM_CFLAGS = $(XCFLAGS)
 
 # May be used by toolexeclibdir.
 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 
 libmpxwrappers_la_CFLAGS = -fcheck-pointer-bounds -mmpx -fno-chkp-check-read \
-                          -fno-chkp-check-write -fno-chkp-use-wrappers -fPIC
+                          -fno-chkp-check-write -fno-chkp-use-wrappers \
+                          -fPIC $(XCFLAGS)
 libmpxwrappers_la_DEPENDENCIES = libmpxwrappers.map
 libmpxwrappers_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libmpxwrappers.map \
                -version-info `grep -v '^\#' $(srcdir)/libtool-version`
index 1b929b9f59810fc679a0dc13a94be1018aa80fb6..6693a09a088aa5a688605c6ffb89e88ec88479fb 100644 (file)
@@ -62,7 +62,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
@@ -249,11 +250,13 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 ALCLOCAL_AMFLAGS = -I .. -I ../config
 AM_CPPFLAGS = -I $(top_srcdir)
+AM_CFLAGS = $(XCFLAGS)
 
 # May be used by toolexeclibdir.
 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 libmpxwrappers_la_CFLAGS = -fcheck-pointer-bounds -mmpx -fno-chkp-check-read \
-                          -fno-chkp-check-write -fno-chkp-use-wrappers -fPIC
+                          -fno-chkp-check-write -fno-chkp-use-wrappers \
+                          -fPIC $(XCFLAGS)
 
 libmpxwrappers_la_DEPENDENCIES = libmpxwrappers.map
 libmpxwrappers_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libmpxwrappers.map \