From: "Tsimbalist, Igor V" <igor.v.tsimbalist@intel.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Jeff Law <law@redhat.com>,
"Tsimbalist, Igor V" <igor.v.tsimbalist@intel.com>
Subject: [PATCH 11/22] Enable building libatomic with Intel CET
Date: Thu, 12 Oct 2017 20:20:00 -0000 [thread overview]
Message-ID: <D511F25789BA7F4EBA64C8A63891A00291F422D6@IRSMSX102.ger.corp.intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 245 bytes --]
Enable building libatomic with CET options.
libatomic/
* configure.ac: Set CET_FLAGS, update XCFLAGS.
* acinclude.m4: Add cet.m4 and enable.m4.
* configure: Regenerate.
* Makefile.in: Likewise.
* testsuite/Makefile.in: Likewise.
[-- Attachment #2: 0011-Enable-building-libatomic-with-Intel-CET.PATCH --]
[-- Type: application/octet-stream, Size: 7398 bytes --]
From a3d708a5c6bf899c831d9e902c1f84e46435eb2d Mon Sep 17 00:00:00 2001
From: Igor Tsimbalist <igor.v.tsimbalist@intel.com>
Date: Thu, 10 Aug 2017 14:36:17 +0300
Subject: [PATCH 11/22] Enable building libatomic with Intel CET
libatomic/
* configure.ac: Set CET_FLAGS, update XCFLAGS.
* acinclude.m4: Add cet.m4 and enable.m4.
* configure: Regenerate.
* Makefile.in: Likewise.
* testsuite/Makefile.in: Likewise.
---
libatomic/Makefile.in | 3 +-
libatomic/acinclude.m4 | 2 +
libatomic/configure | 81 ++++++++++++++++++++++++++++++++++++++++-
libatomic/configure.ac | 4 ++
libatomic/testsuite/Makefile.in | 3 +-
5 files changed, 89 insertions(+), 4 deletions(-)
---
libatomic/Makefile.in | 3 +-
libatomic/acinclude.m4 | 2 +
libatomic/configure | 81 ++++++++++++++++++++++++++++++++++++++++-
libatomic/configure.ac | 4 ++
libatomic/testsuite/Makefile.in | 3 +-
5 files changed, 89 insertions(+), 4 deletions(-)
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index f6eeab3..2b356e7 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -75,7 +75,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/libatomic/acinclude.m4 b/libatomic/acinclude.m4
index 485d731..bd3fdd5 100644
--- a/libatomic/acinclude.m4
+++ b/libatomic/acinclude.m4
@@ -631,6 +631,8 @@ AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
dnl ----------------------------------------------------------------------
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/libatomic/configure b/libatomic/configure
index c05fc9d..427ac34 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -764,6 +764,7 @@ with_gnu_ld
enable_libtool_lock
enable_maintainer_mode
enable_symvers
+enable_cet
with_gcc_major_version_only
'
ac_precious_vars='build_alias
@@ -1410,6 +1411,8 @@ Optional Features:
(and sometimes confusing) to the casual installer
--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]
@@ -11115,7 +11118,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11118 "configure"
+#line 11121 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11221,7 +11224,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11224 "configure"
+#line 11227 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12333,6 +12336,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 2" >&5
$as_echo_n "checking for __atomic_load/store for size 2... " >&6; }
if test "${libat_cv_have_at_ldst_2+set}" = set; then :
@@ -12400,6 +12404,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 4" >&5
$as_echo_n "checking for __atomic_load/store for size 4... " >&6; }
if test "${libat_cv_have_at_ldst_4+set}" = set; then :
@@ -12467,6 +12472,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 8" >&5
$as_echo_n "checking for __atomic_load/store for size 8... " >&6; }
if test "${libat_cv_have_at_ldst_8+set}" = set; then :
@@ -12534,6 +12540,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 16" >&5
$as_echo_n "checking for __atomic_load/store for size 16... " >&6; }
if test "${libat_cv_have_at_ldst_16+set}" = set; then :
@@ -12602,6 +12609,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_test_and_set for size 1" >&5
$as_echo_n "checking for __atomic_test_and_set for size 1... " >&6; }
if test "${libat_cv_have_at_tas_1+set}" = set; then :
@@ -15219,6 +15227,75 @@ if test "x$GCC" = "xyes"; then
XCFLAGS="$XCFLAGS -Wall -Werror"
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 "$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"
+
XCFLAGS="$XCFLAGS $XPCFLAGS"
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index 023f172..bf7315e 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -238,6 +238,10 @@ if test "x$GCC" = "xyes"; then
XCFLAGS="$XCFLAGS -Wall -Werror"
fi
+# Add CET specific flags if CET is enabled
+GCC_CET_FLAGS(CET_FLAGS)
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
XCFLAGS="$XCFLAGS $XPCFLAGS"
AC_SUBST(config_path)
diff --git a/libatomic/testsuite/Makefile.in b/libatomic/testsuite/Makefile.in
index adfc231..a95e3ca 100644
--- a/libatomic/testsuite/Makefile.in
+++ b/libatomic/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
next reply other threads:[~2017-10-12 20:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 20:20 Tsimbalist, Igor V [this message]
2017-10-18 1:42 ` Jeff Law
2017-10-31 12:00 ` Tsimbalist, Igor V
2017-11-08 17:31 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D511F25789BA7F4EBA64C8A63891A00291F422D6@IRSMSX102.ger.corp.intel.com \
--to=igor.v.tsimbalist@intel.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).