summaryrefslogtreecommitdiffstats
path: root/zlib
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-05-12 09:27:24 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-05-12 09:27:35 -0700
commitc08278701f7433978ca56e3413855bd4b001aa1d (patch)
tree6c95b8bdf9c8c71e2a227165fe9d335e25c51b40 /zlib
parentlibbacktrace: Enable Intel CET on Intel CET enabled host for jit (diff)
downloadgcc-c08278701f7433978ca56e3413855bd4b001aa1d.tar.gz
gcc-c08278701f7433978ca56e3413855bd4b001aa1d.tar.bz2
gcc-c08278701f7433978ca56e3413855bd4b001aa1d.tar.xz
zlib: Add --enable-cet to configure
When --enable-cet is used to configure GCC, enable Intel CET in target zlib. * Makefile.am (AM_CFLAGS): New. * configure.ac (CET_FLAGS): Add GCC_CET_FLAGS and AC_SUBST. * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure.ac: Likewise.
Diffstat (limited to 'zlib')
-rw-r--r--zlib/ChangeLog.gcj8
-rw-r--r--zlib/Makefile.am2
-rw-r--r--zlib/Makefile.in6
-rw-r--r--zlib/aclocal.m42
-rwxr-xr-xzlib/configure97
-rw-r--r--zlib/configure.ac4
6 files changed, 113 insertions, 6 deletions
diff --git a/zlib/ChangeLog.gcj b/zlib/ChangeLog.gcj
index 60f0a1d4c10..c1d24fe85c9 100644
--- a/zlib/ChangeLog.gcj
+++ b/zlib/ChangeLog.gcj
@@ -1,3 +1,11 @@
12020-05-12 H.J. Lu <hongjiu.lu@intel.com>
2
3 * Makefile.am (AM_CFLAGS): New.
4 * configure.ac (CET_FLAGS): Add GCC_CET_FLAGS and AC_SUBST.
5 * Makefile.in: Regenerated.
6 * aclocal.m4: Likewise.
7 * configure.ac: Likewise.
8
12020-01-24 Maciej W. Rozycki <macro@wdc.com> 92020-01-24 Maciej W. Rozycki <macro@wdc.com>
2 10
3 * configure.ac: Handle `--with-toolexeclibdir='. 11 * configure.ac: Handle `--with-toolexeclibdir='.
diff --git a/zlib/Makefile.am b/zlib/Makefile.am
index 29359614baa..3098677f893 100644
--- a/zlib/Makefile.am
+++ b/zlib/Makefile.am
@@ -19,6 +19,8 @@ libz_a_SOURCES = $(ZLIB_SOURCES)
19libz_a_CFLAGS = $(AM_CFLAGS) $(PICFLAG) 19libz_a_CFLAGS = $(AM_CFLAGS) $(PICFLAG)
20endif 20endif
21 21
22AM_CFLAGS = $(CET_FLAGS)
23
22# Work around what appears to be a GNU make bug handling MAKEFLAGS 24# Work around what appears to be a GNU make bug handling MAKEFLAGS
23# values defined in terms of make variables, as is the case for CC and 25# values defined in terms of make variables, as is the case for CC and
24# friends when we are called from the top level Makefile. 26# friends when we are called from the top level Makefile.
diff --git a/zlib/Makefile.in b/zlib/Makefile.in
index dce9ffce9e4..3f5102d1b87 100644
--- a/zlib/Makefile.in
+++ b/zlib/Makefile.in
@@ -92,7 +92,9 @@ host_triplet = @host@
92target_triplet = @target@ 92target_triplet = @target@
93subdir = . 93subdir = .
94ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 94ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
95am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ 95am__aclocal_m4_deps = $(top_srcdir)/../config/cet.m4 \
96 $(top_srcdir)/../config/depstand.m4 \
97 $(top_srcdir)/../config/enable.m4 \
96 $(top_srcdir)/../config/lead-dot.m4 \ 98 $(top_srcdir)/../config/lead-dot.m4 \
97 $(top_srcdir)/../config/multi.m4 \ 99 $(top_srcdir)/../config/multi.m4 \
98 $(top_srcdir)/../config/override.m4 \ 100 $(top_srcdir)/../config/override.m4 \
@@ -275,6 +277,7 @@ AUTOMAKE = @AUTOMAKE@
275AWK = @AWK@ 277AWK = @AWK@
276CC = @CC@ 278CC = @CC@
277CCDEPMODE = @CCDEPMODE@ 279CCDEPMODE = @CCDEPMODE@
280CET_FLAGS = @CET_FLAGS@
278CFLAGS = @CFLAGS@ 281CFLAGS = @CFLAGS@
279COMPPATH = @COMPPATH@ 282COMPPATH = @COMPPATH@
280CPP = @CPP@ 283CPP = @CPP@
@@ -400,6 +403,7 @@ zconf.h.in zlib.h zutil.c zutil.h
400@TARGET_LIBRARY_FALSE@toolexeclib_LIBRARIES = libz.a 403@TARGET_LIBRARY_FALSE@toolexeclib_LIBRARIES = libz.a
401@TARGET_LIBRARY_FALSE@libz_a_SOURCES = $(ZLIB_SOURCES) 404@TARGET_LIBRARY_FALSE@libz_a_SOURCES = $(ZLIB_SOURCES)
402@TARGET_LIBRARY_FALSE@libz_a_CFLAGS = $(AM_CFLAGS) $(PICFLAG) 405@TARGET_LIBRARY_FALSE@libz_a_CFLAGS = $(AM_CFLAGS) $(PICFLAG)
406AM_CFLAGS = $(CET_FLAGS)
403 407
404# Work around what appears to be a GNU make bug handling MAKEFLAGS 408# Work around what appears to be a GNU make bug handling MAKEFLAGS
405# values defined in terms of make variables, as is the case for CC and 409# values defined in terms of make variables, as is the case for CC and
diff --git a/zlib/aclocal.m4 b/zlib/aclocal.m4
index d319d09e854..f3676e70476 100644
--- a/zlib/aclocal.m4
+++ b/zlib/aclocal.m4
@@ -1167,7 +1167,9 @@ AC_SUBST([am__tar])
1167AC_SUBST([am__untar]) 1167AC_SUBST([am__untar])
1168]) # _AM_PROG_TAR 1168]) # _AM_PROG_TAR
1169 1169
1170m4_include([../config/cet.m4])
1170m4_include([../config/depstand.m4]) 1171m4_include([../config/depstand.m4])
1172m4_include([../config/enable.m4])
1171m4_include([../config/lead-dot.m4]) 1173m4_include([../config/lead-dot.m4])
1172m4_include([../config/multi.m4]) 1174m4_include([../config/multi.m4])
1173m4_include([../config/override.m4]) 1175m4_include([../config/override.m4])
diff --git a/zlib/configure b/zlib/configure
index 484a4938f4a..51a6ef36e28 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -658,6 +658,7 @@ EGREP
658GREP 658GREP
659SED 659SED
660LIBTOOL 660LIBTOOL
661CET_FLAGS
661am__fastdepCC_FALSE 662am__fastdepCC_FALSE
662am__fastdepCC_TRUE 663am__fastdepCC_TRUE
663CCDEPMODE 664CCDEPMODE
@@ -768,6 +769,7 @@ with_target_subdir
768with_cross_host 769with_cross_host
769with_system_zlib 770with_system_zlib
770enable_dependency_tracking 771enable_dependency_tracking
772enable_cet
771enable_shared 773enable_shared
772enable_static 774enable_static
773with_pic 775with_pic
@@ -1411,6 +1413,7 @@ Optional Features:
1411 do not reject slow dependency extractors 1413 do not reject slow dependency extractors
1412 --disable-dependency-tracking 1414 --disable-dependency-tracking
1413 speeds up one-time build 1415 speeds up one-time build
1416 --enable-cet enable Intel CET in target libraries [default=no]
1414 --enable-shared[=PKGS] build shared libraries [default=yes] 1417 --enable-shared[=PKGS] build shared libraries [default=yes]
1415 --enable-static[=PKGS] build static libraries [default=yes] 1418 --enable-static[=PKGS] build static libraries [default=yes]
1416 --enable-fast-install[=PKGS] 1419 --enable-fast-install[=PKGS]
@@ -3400,11 +3403,11 @@ done
3400 3403
3401cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3404cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3402/* end confdefs.h. */ 3405/* end confdefs.h. */
3403 3406#include <stdio.h>
3404int 3407int
3405main () 3408main ()
3406{ 3409{
3407 3410printf ("hello world\n");
3408 ; 3411 ;
3409 return 0; 3412 return 0;
3410} 3413}
@@ -4142,6 +4145,91 @@ fi
4142 4145
4143 4146
4144 4147
4148# Add CET specific flags if CET is enabled
4149
4150 # Check whether --enable-cet was given.
4151if test "${enable_cet+set}" = set; then :
4152 enableval=$enable_cet;
4153 case "$enableval" in
4154 yes|no|auto) ;;
4155 *) as_fn_error $? "Unknown argument to enable/disable cet" "$LINENO" 5 ;;
4156 esac
4157
4158else
4159 enable_cet=no
4160fi
4161
4162
4163{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
4164$as_echo_n "checking for CET support... " >&6; }
4165
4166case "$host" in
4167 i[34567]86-*-linux* | x86_64-*-linux*)
4168 case "$enable_cet" in
4169 auto)
4170 # Check if target supports multi-byte NOPs
4171 # and if assembler supports CET insn.
4172 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4173/* end confdefs.h. */
4174
4175int
4176main ()
4177{
4178
4179#if !defined(__SSE2__)
4180#error target does not support multi-byte NOPs
4181#else
4182asm ("setssbsy");
4183#endif
4184
4185 ;
4186 return 0;
4187}
4188_ACEOF
4189if ac_fn_c_try_compile "$LINENO"; then :
4190 enable_cet=yes
4191else
4192 enable_cet=no
4193fi
4194rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4195 ;;
4196 yes)
4197 # Check if assembler supports CET.
4198 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4199/* end confdefs.h. */
4200
4201int
4202main ()
4203{
4204asm ("setssbsy");
4205 ;
4206 return 0;
4207}
4208_ACEOF
4209if ac_fn_c_try_compile "$LINENO"; then :
4210
4211else
4212 as_fn_error $? "assembler with CET support is required for --enable-cet" "$LINENO" 5
4213fi
4214rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4215 ;;
4216 esac
4217 ;;
4218 *)
4219 enable_cet=no
4220 ;;
4221esac
4222if test x$enable_cet = xyes; then
4223 CET_FLAGS="-fcf-protection -mshstk"
4224 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4225$as_echo "yes" >&6; }
4226else
4227 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4228$as_echo "no" >&6; }
4229fi
4230
4231
4232
4145case `pwd` in 4233case `pwd` in
4146 *\ * | *\ *) 4234 *\ * | *\ *)
4147 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 4235 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -6034,7 +6122,6 @@ fi
6034 6122
6035 6123
6036 6124
6037
6038# Check whether --enable-libtool-lock was given. 6125# Check whether --enable-libtool-lock was given.
6039if test "${enable_libtool_lock+set}" = set; then : 6126if test "${enable_libtool_lock+set}" = set; then :
6040 enableval=$enable_libtool_lock; 6127 enableval=$enable_libtool_lock;
@@ -10652,7 +10739,7 @@ else
10652 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 10739 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10653 lt_status=$lt_dlunknown 10740 lt_status=$lt_dlunknown
10654 cat > conftest.$ac_ext <<_LT_EOF 10741 cat > conftest.$ac_ext <<_LT_EOF
10655#line 10655 "configure" 10742#line 10742 "configure"
10656#include "confdefs.h" 10743#include "confdefs.h"
10657 10744
10658#if HAVE_DLFCN_H 10745#if HAVE_DLFCN_H
@@ -10758,7 +10845,7 @@ else
10758 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 10845 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10759 lt_status=$lt_dlunknown 10846 lt_status=$lt_dlunknown
10760 cat > conftest.$ac_ext <<_LT_EOF 10847 cat > conftest.$ac_ext <<_LT_EOF
10761#line 10761 "configure" 10848#line 10848 "configure"
10762#include "confdefs.h" 10849#include "confdefs.h"
10763 10850
10764#if HAVE_DLFCN_H 10851#if HAVE_DLFCN_H
diff --git a/zlib/configure.ac b/zlib/configure.ac
index ad9ec73bae2..be1cfe29651 100644
--- a/zlib/configure.ac
+++ b/zlib/configure.ac
@@ -59,6 +59,10 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
59 59
60AC_SUBST(CFLAGS) 60AC_SUBST(CFLAGS)
61 61
62# Add CET specific flags if CET is enabled
63GCC_CET_FLAGS(CET_FLAGS)
64AC_SUBST(CET_FLAGS)
65
62AC_PROG_LIBTOOL 66AC_PROG_LIBTOOL
63 67
64# Find CPP now so that any conditional tests below won't do it and 68# Find CPP now so that any conditional tests below won't do it and