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

From-SVN: r254899

libquadmath/ChangeLog
libquadmath/Makefile.am
libquadmath/Makefile.in
libquadmath/acinclude.m4
libquadmath/configure
libquadmath/configure.ac

index 1d152bbd8b6c3c9ee9c3c13add9f6b3b2dece3de..284f4d98e74cdc64019d745b011f09d17f3142ac 100644 (file)
@@ -1,3 +1,11 @@
+ 2017-11-17  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>
+
+       * Makefile.am: Update AM_CFLAGS.
+       * Makefile.in: Regenerate:
+       * acinclude.m4: Add enable.m4 and cet.m4.
+       * configure: Regenerate.
+       * configure.ac: Set CET_FLAGS. Update XCFLAGS.
+
 2017-11-05  Tom de Vries  <tom@codesourcery.com>
 
        PR other/82784
index ec23c66f6b19ca4d4cc8a35a8e7488f945756ed4..6f1fe61158dc66e28e1d6b26e4924cb3baa07aec 100644 (file)
@@ -7,6 +7,7 @@ AUTOMAKE_OPTIONS = 1.8 foreign
 if BUILD_LIBQUADMATH
 ACLOCAL_AMFLAGS = -I .. -I ../config
 AM_CPPFLAGS = -I $(top_srcdir)/../include
+AM_CFLAGS = $(XCFLAGS)
 
 ## May be used by toolexeclibdir.
 gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
index 428e0158aca306f773b5700429153b53b304a513..312f48562693419e80c7ffa6bea15cfd1e49290b 100644 (file)
@@ -70,7 +70,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 \
@@ -275,6 +276,7 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
 VERSION = @VERSION@
+XCFLAGS = @XCFLAGS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -341,6 +343,7 @@ top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = 1.8 foreign
 @BUILD_LIBQUADMATH_TRUE@ACLOCAL_AMFLAGS = -I .. -I ../config
 @BUILD_LIBQUADMATH_TRUE@AM_CPPFLAGS = -I $(top_srcdir)/../include
+@BUILD_LIBQUADMATH_TRUE@AM_CFLAGS = $(XCFLAGS)
 @BUILD_LIBQUADMATH_TRUE@gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 @BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_FALSE@version_arg = 
 @BUILD_LIBQUADMATH_TRUE@@LIBQUAD_USE_SYMVER_GNU_TRUE@@LIBQUAD_USE_SYMVER_TRUE@version_arg = -Wl,--version-script=$(srcdir)/quadmath.map
index ab73fb52e05420413da60a70e2a5eec9b462c1e5..3703cd68efdf794090d9725cd9803374745819d3 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 b1dc7f385378292dca7b5b3027e1d0a6761e7153..b32dcbc8e03c5fed01f2efc7f5934d3bd14d2c86 100755 (executable)
@@ -604,6 +604,7 @@ LIBOBJS
 get_gcc_base_ver
 GENINSRC_FALSE
 GENINSRC_TRUE
+XCFLAGS
 BUILD_LIBQUADMATH_FALSE
 BUILD_LIBQUADMATH_TRUE
 LIBQUAD_USE_SYMVER_SUN_FALSE
@@ -750,6 +751,7 @@ with_gnu_ld
 enable_libtool_lock
 enable_maintainer_mode
 enable_symvers
+enable_cet
 enable_generated_files_in_srcdir
 with_gcc_major_version_only
 '
@@ -1396,6 +1398,8 @@ Optional Features:
   --enable-maintainer-mode  enable make rules and dependencies not useful
                          (and sometimes confusing) to the casual installer
   --disable-symvers       disable symbol versioning for libquadmath
+  --enable-cet            enable Intel CET in target libraries
+                          [default=default]
   --enable-generated-files-in-srcdir
                           put copies of generated files in source dir intended
                           for creating source tarballs for users without
@@ -10572,7 +10576,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10575 "configure"
+#line 10579 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10678,7 +10682,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10681 "configure"
+#line 10685 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12819,6 +12823,76 @@ $as_echo "#define USE_I18N_NUMBER_H 1" >>confdefs.h
 
 fi
 
+# 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"
+
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
index 4226524caf85a3e5697327f0959254e0611db90a..2a721cb9adc548358c7cbbea8a48febaba50f82a 100644 (file)
@@ -341,6 +341,11 @@ if test x$quadmath_use_i18n_number_h = xyes; then
   AC_DEFINE([USE_I18N_NUMBER_H],[1],[whether i18n number rewriting can be supported])
 fi
 
+# Add CET specific flags if CET is enabled
+GCC_CET_FLAGS(CET_FLAGS)
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+AC_SUBST(XCFLAGS)
+
 AC_CACHE_SAVE
 
 if test ${multilib} = yes; then