aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Tsimbalist <igor.v.tsimbalist@intel.com>2017-11-17 22:22:09 +0100
committerIgor Tsimbalist <itsimbal@gcc.gnu.org>2017-11-17 22:22:09 +0100
commitefe33ced3335418cfec484126fec001a56d958a7 (patch)
treeef70030968b644d4f92e01f7b881f41a8c860f2f
parentefc643e90d0e75d3e003644404d4e29f84f274e6 (diff)
downloadgcc-efe33ced3335418cfec484126fec001a56d958a7.zip
gcc-efe33ced3335418cfec484126fec001a56d958a7.tar.gz
gcc-efe33ced3335418cfec484126fec001a56d958a7.tar.bz2
Enable building libgomp with Intel CET
libgomp/ * configure.ac: Set CET_FLAGS, update XCFLAGS and FCFLAGS. * acinclude.m4: Add cet.m4. * configure: Regenerate. * Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. From-SVN: r254894
-rw-r--r--libgomp/ChangeLog8
-rw-r--r--libgomp/Makefile.in4
-rw-r--r--libgomp/acinclude.m41
-rwxr-xr-xlibgomp/configure77
-rw-r--r--libgomp/configure.ac5
-rw-r--r--libgomp/testsuite/Makefile.in4
6 files changed, 93 insertions, 6 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 7331d41..2299ed9 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,11 @@
+2017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
+
+ * configure.ac: Set CET_FLAGS, update XCFLAGS and FCFLAGS.
+ * acinclude.m4: Add cet.m4.
+ * configure: Regenerate.
+ * Makefile.in: Likewise.
+ * testsuite/Makefile.in: Likewise.
+
2017-11-15 Tom de Vries <tom@codesourcery.com>
* testsuite/libgomp.oacc-c-c++-common/f-asyncwait-1.c: New test, copied
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 920d29d..6aff7fc 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -105,8 +105,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/tls.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)/plugin/configfrag.ac \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../config/cet.m4 \
+ $(top_srcdir)/plugin/configfrag.ac $(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/libgomp/acinclude.m4 b/libgomp/acinclude.m4
index d43aa88..51f4f30 100644
--- a/libgomp/acinclude.m4
+++ b/libgomp/acinclude.m4
@@ -56,6 +56,7 @@ extern void bar(void) __attribute__((alias("foo")));],
fi])
sinclude(../libtool.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/libgomp/configure b/libgomp/configure
index b7e9f40..e7842b5 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -799,6 +799,7 @@ with_hsa_runtime_lib
enable_linux_futex
enable_tls
enable_symvers
+enable_cet
with_gcc_major_version_only
'
ac_precious_vars='build_alias
@@ -1451,6 +1452,8 @@ Optional Features:
--enable-tls Use thread-local storage [default=yes]
--enable-symvers=STYLE enables symbol versioning of the shared library
[default=yes]
+ --enable-cet enable Intel CET in target libraries
+ [default=default]
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -11155,7 +11158,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11158 "configure"
+#line 11161 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11261,7 +11264,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11264 "configure"
+#line 11267 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16616,6 +16619,76 @@ $as_echo "#define HAVE_SYNC_BUILTINS 1" >>confdefs.h
XCFLAGS="$XCFLAGS$XPCFLAGS"
+# 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"
+FCFLAGS="$FCFLAGS $CET_FLAGS"
+
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index a42d4f0..4e0bc81 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -293,6 +293,11 @@ LIBGOMP_CHECK_SYNC_BUILTINS
XCFLAGS="$XCFLAGS$XPCFLAGS"
+# Add CET specific flags if CET is enabled
+GCC_CET_FLAGS(CET_FLAGS)
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+FCFLAGS="$FCFLAGS $CET_FLAGS"
+
AC_SUBST(config_path)
AC_SUBST(XCFLAGS)
AC_SUBST(XLDFLAGS)
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index 6edb7ae..9310138 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -67,8 +67,8 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/tls.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)/plugin/configfrag.ac \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../config/cet.m4 \
+ $(top_srcdir)/plugin/configfrag.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs