public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 20/22] Enable building libobjc with Intel CET
@ 2017-10-12 21:22 Tsimbalist, Igor V
  2017-10-18  2:05 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Tsimbalist, Igor V @ 2017-10-12 21:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jeff Law, Tsimbalist, Igor V

[-- Attachment #1: Type: text/plain, Size: 192 bytes --]

Enable building libobjc with Intel CET options.

libobjc/
	* Makefile.in: Regenerate.
	* aclocal.m4: Likeiwse.
	* configure: Likewise.
	* configure.ac: Set CET_FLAGS. Update XCFLAGS.


[-- Attachment #2: 0020-Enable-building-libobjc-with-Intel-CET.PATCH --]
[-- Type: application/octet-stream, Size: 5604 bytes --]

From 57674bd68f64035edd8476e8d8cdd9e4fa8d22e5 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 17 Aug 2017 09:44:54 -0700
Subject: [PATCH 20/22] Enable building libobjc with Intel CET

libobjc/
	* Makefile.in: Regenerate.
	* aclocal.m4: Likeiwse.
	* configure: Likewise.
	* configure.ac: Set CET_FLAGS. Update XCFLAGS.
---
 libobjc/Makefile.in  |  5 +++-
 libobjc/aclocal.m4   |  1 +
 libobjc/configure    | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 libobjc/configure.ac |  5 ++++
 4 files changed, 89 insertions(+), 4 deletions(-)
---
 libobjc/Makefile.in  |  5 +++-
 libobjc/aclocal.m4   |  1 +
 libobjc/configure    | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 libobjc/configure.ac |  5 ++++
 4 files changed, 89 insertions(+), 4 deletions(-)

diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
index febc92d..26eb2ca 100644
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -72,8 +72,10 @@ RANLIB = @RANLIB@
 
 CC = @CC@
 CFLAGS = @CFLAGS@
+XCFLAGS = @XCFLAGS@
 WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes
-ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \
+ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) \
+	$(XCFLAGS) $(CFLAGS) $(WARN_CFLAGS) \
 	-DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions
 
 # Libtool
@@ -295,6 +297,7 @@ aclocal_deps = \
 	$(srcdir)/../ltsugar.m4 \
 	$(srcdir)/../ltversion.m4 \
 	$(srcdir)/../lt~obsolete.m4 \
+	$(srcdir)/../cet.m4.m4 \
 	$(srcdir)/acinclude.m4
 
 $(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4
diff --git a/libobjc/aclocal.m4 b/libobjc/aclocal.m4
index 174f9b7..2127341 100644
--- a/libobjc/aclocal.m4
+++ b/libobjc/aclocal.m4
@@ -197,6 +197,7 @@ AC_DEFUN([_AM_SUBST_NOTMAKE])
 # Public sister of _AM_SUBST_NOTMAKE.
 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
+m4_include([../config/cet.m4])
 m4_include([../config/lthostflags.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
diff --git a/libobjc/configure b/libobjc/configure
index abf5aed..ee9f2f3 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -635,6 +635,7 @@ INSTALL_PROGRAM
 RANLIB
 AR
 AS
+XCFLAGS
 extra_ldflags_libobjc
 lt_host_flags
 OBJEXT
@@ -714,6 +715,7 @@ with_target_subdir
 with_cross_host
 enable_version_specific_runtime_libs
 enable_multilib
+enable_cet
 enable_maintainer_mode
 enable_shared
 enable_static
@@ -1350,6 +1352,8 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory
   --enable-multilib       build many library versions (default)
+  --enable-cet            enable Intel CET in target libraries
+                          [default=default]
   --enable-maintainer-mode  enable make rules and dependencies not useful
 			  (and sometimes confusing) to the casual installer
   --enable-shared[=PKGS]  build shared libraries [default=yes]
@@ -3350,6 +3354,79 @@ case "${host}" in
 esac
 
 
+# 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*)
+    enable_cet_compatibility=yes
+    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
+    enable_cet_compatibility=no
+    ;;
+esac
+if test x$enable_cet = xyes; then
+  CET_FLAGS="-fcf-protection -mcet -include cet.h"
+fi
+
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
+
 
 
 if test -n "$ac_tool_prefix"; then
@@ -5982,7 +6059,6 @@ fi
 
 
 
-
 # Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
@@ -10594,7 +10670,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10597 "configure"
+#line 10673 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10700,7 +10776,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10703 "configure"
+#line 10779 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index c6d48f7..f24b5da 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -151,7 +151,12 @@ case "${host}" in
 esac
 AC_SUBST(extra_ldflags_libobjc)
 
+# Add CET specific flags if CET is enabled
+GCC_CET_FLAGS(CET_FLAGS)
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
 AC_SUBST(CFLAGS)
+AC_SUBST(XCFLAGS)
 
 AC_CHECK_TOOL(AS, as)
 AC_CHECK_TOOL(AR, ar)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 20/22] Enable building libobjc with Intel CET
  2017-10-12 21:22 [PATCH 20/22] Enable building libobjc with Intel CET Tsimbalist, Igor V
@ 2017-10-18  2:05 ` Jeff Law
  2017-10-31 12:49   ` Tsimbalist, Igor V
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2017-10-18  2:05 UTC (permalink / raw)
  To: Tsimbalist, Igor V, gcc-patches

On 10/12/2017 03:19 PM, Tsimbalist, Igor V wrote:
> Enable building libobjc with Intel CET options.
> 
> libobjc/
> 	* Makefile.in: Regenerate.
> 	* aclocal.m4: Likeiwse.
> 	* configure: Likewise.
> 	* configure.ac: Set CET_FLAGS. Update XCFLAGS.
> 


Same comments as the libcilkrts changes.

Jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 20/22] Enable building libobjc with Intel CET
  2017-10-18  2:05 ` Jeff Law
@ 2017-10-31 12:49   ` Tsimbalist, Igor V
  2017-11-08 17:38     ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Tsimbalist, Igor V @ 2017-10-31 12:49 UTC (permalink / raw)
  To: Jeff Law, gcc-patches; +Cc: Tsimbalist, Igor V

[-- Attachment #1: Type: text/plain, Size: 769 bytes --]

The revised patch is attached. The differences are in what options are defined and propagated to Makefile for CET enabling.
 
Ok for trunk?

Igor


> -----Original Message-----
> From: Jeff Law [mailto:law@redhat.com]
> Sent: Wednesday, October 18, 2017 1:43 AM
> To: Tsimbalist, Igor V <igor.v.tsimbalist@intel.com>; gcc-
> patches@gcc.gnu.org
> Subject: Re: [PATCH 20/22] Enable building libobjc with Intel CET
> 
> On 10/12/2017 03:19 PM, Tsimbalist, Igor V wrote:
> > Enable building libobjc with Intel CET options.
> >
> > libobjc/
> > 	* Makefile.in: Regenerate.
> > 	* aclocal.m4: Likeiwse.
> > 	* configure: Likewise.
> > 	* configure.ac: Set CET_FLAGS. Update XCFLAGS.
> >
> 
> 
> Same comments as the libcilkrts changes.
> 
> Jeff

[-- Attachment #2: 0020-Enable-building-libobjc-with-Intel-CET.PATCH --]
[-- Type: application/octet-stream, Size: 5359 bytes --]

From edb63547af1626d7d9dc8383661234bf81e73216 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 17 Aug 2017 09:44:54 -0700
Subject: [PATCH 20/21] Enable building libobjc with Intel CET

libobjc/
	* Makefile.in: Regenerate.
	* aclocal.m4: Likeiwse.
	* configure: Likewise.
	* configure.ac: Set CET_FLAGS. Update XCFLAGS.
---
 libobjc/Makefile.in  |  5 +++-
 libobjc/aclocal.m4   |  1 +
 libobjc/configure    | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 libobjc/configure.ac |  5 ++++
 4 files changed, 89 insertions(+), 4 deletions(-)

diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
index febc92d..26eb2ca 100644
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -72,8 +72,10 @@ RANLIB = @RANLIB@
 
 CC = @CC@
 CFLAGS = @CFLAGS@
+XCFLAGS = @XCFLAGS@
 WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes
-ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \
+ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) \
+	$(XCFLAGS) $(CFLAGS) $(WARN_CFLAGS) \
 	-DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions
 
 # Libtool
@@ -295,6 +297,7 @@ aclocal_deps = \
 	$(srcdir)/../ltsugar.m4 \
 	$(srcdir)/../ltversion.m4 \
 	$(srcdir)/../lt~obsolete.m4 \
+	$(srcdir)/../cet.m4.m4 \
 	$(srcdir)/acinclude.m4
 
 $(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4
diff --git a/libobjc/aclocal.m4 b/libobjc/aclocal.m4
index 174f9b7..2127341 100644
--- a/libobjc/aclocal.m4
+++ b/libobjc/aclocal.m4
@@ -197,6 +197,7 @@ AC_DEFUN([_AM_SUBST_NOTMAKE])
 # Public sister of _AM_SUBST_NOTMAKE.
 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
+m4_include([../config/cet.m4])
 m4_include([../config/lthostflags.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
diff --git a/libobjc/configure b/libobjc/configure
index abf5aed..e7a855a 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -635,6 +635,7 @@ INSTALL_PROGRAM
 RANLIB
 AR
 AS
+XCFLAGS
 extra_ldflags_libobjc
 lt_host_flags
 OBJEXT
@@ -714,6 +715,7 @@ with_target_subdir
 with_cross_host
 enable_version_specific_runtime_libs
 enable_multilib
+enable_cet
 enable_maintainer_mode
 enable_shared
 enable_static
@@ -1350,6 +1352,8 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory
   --enable-multilib       build many library versions (default)
+  --enable-cet            enable Intel CET in target libraries
+                          [default=default]
   --enable-maintainer-mode  enable make rules and dependencies not useful
 			  (and sometimes confusing) to the casual installer
   --enable-shared[=PKGS]  build shared libraries [default=yes]
@@ -3350,6 +3354,79 @@ case "${host}" in
 esac
 
 
+# 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
+  i3456786-*-linux* | x86_64-*-linux*)
+    enable_cet_compatibility=yes
+    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
+    enable_cet_compatibility=no
+    ;;
+esac
+if test x$enable_cet = xyes; then
+  CET_FLAGS="-fcf-protection -mcet"
+fi
+
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
+
 
 
 if test -n "$ac_tool_prefix"; then
@@ -5982,7 +6059,6 @@ fi
 
 
 
-
 # Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
@@ -10594,7 +10670,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10597 "configure"
+#line 10673 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10700,7 +10776,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10703 "configure"
+#line 10779 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index c6d48f7..f24b5da 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -151,7 +151,12 @@ case "${host}" in
 esac
 AC_SUBST(extra_ldflags_libobjc)
 
+# Add CET specific flags if CET is enabled
+GCC_CET_FLAGS(CET_FLAGS)
+XCFLAGS="$XCFLAGS $CET_FLAGS"
+
 AC_SUBST(CFLAGS)
+AC_SUBST(XCFLAGS)
 
 AC_CHECK_TOOL(AS, as)
 AC_CHECK_TOOL(AR, ar)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 20/22] Enable building libobjc with Intel CET
  2017-10-31 12:49   ` Tsimbalist, Igor V
@ 2017-11-08 17:38     ` Jeff Law
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2017-11-08 17:38 UTC (permalink / raw)
  To: Tsimbalist, Igor V, gcc-patches

On 10/31/2017 06:18 AM, Tsimbalist, Igor V wrote:
> The revised patch is attached. The differences are in what options are defined and propagated to Makefile for CET enabling.
>  
> Ok for trunk?
> 
> Igor
> 
> 
>> -----Original Message-----
>> From: Jeff Law [mailto:law@redhat.com]
>> Sent: Wednesday, October 18, 2017 1:43 AM
>> To: Tsimbalist, Igor V <igor.v.tsimbalist@intel.com>; gcc-
>> patches@gcc.gnu.org
>> Subject: Re: [PATCH 20/22] Enable building libobjc with Intel CET
>>
>> On 10/12/2017 03:19 PM, Tsimbalist, Igor V wrote:
>>> Enable building libobjc with Intel CET options.
>>>
>>> libobjc/
>>> 	* Makefile.in: Regenerate.
>>> 	* aclocal.m4: Likeiwse.
>>> 	* configure: Likewise.
>>> 	* configure.ac: Set CET_FLAGS. Update XCFLAGS.
>>>
>>
>> Same comments as the libcilkrts changes.
>>
>> Jeff
> 
> 0020-Enable-building-libobjc-with-Intel-CET.PATCH
> 
> 
> From edb63547af1626d7d9dc8383661234bf81e73216 Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Thu, 17 Aug 2017 09:44:54 -0700
> Subject: [PATCH 20/21] Enable building libobjc with Intel CET
> 
> libobjc/
> 	* Makefile.in: Regenerate.
> 	* aclocal.m4: Likeiwse.
> 	* configure: Likewise.
> 	* configure.ac: Set CET_FLAGS. Update XCFLAGS.

OK.  Please wait to commit until entire set is ACK'd.

Jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-08 17:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-12 21:22 [PATCH 20/22] Enable building libobjc with Intel CET Tsimbalist, Igor V
2017-10-18  2:05 ` Jeff Law
2017-10-31 12:49   ` Tsimbalist, Igor V
2017-11-08 17:38     ` Jeff Law

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).