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.
This commit is contained in:
parent
d214864835
commit
c08278701f
6 changed files with 113 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
|||
2020-05-12 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2020-01-24 Maciej W. Rozycki <macro@wdc.com>
|
||||
|
||||
* configure.ac: Handle `--with-toolexeclibdir='.
|
||||
|
|
|
@ -19,6 +19,8 @@ libz_a_SOURCES = $(ZLIB_SOURCES)
|
|||
libz_a_CFLAGS = $(AM_CFLAGS) $(PICFLAG)
|
||||
endif
|
||||
|
||||
AM_CFLAGS = $(CET_FLAGS)
|
||||
|
||||
# Work around what appears to be a GNU make bug handling MAKEFLAGS
|
||||
# values defined in terms of make variables, as is the case for CC and
|
||||
# friends when we are called from the top level Makefile.
|
||||
|
|
|
@ -92,7 +92,9 @@ host_triplet = @host@
|
|||
target_triplet = @target@
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
|
||||
am__aclocal_m4_deps = $(top_srcdir)/../config/cet.m4 \
|
||||
$(top_srcdir)/../config/depstand.m4 \
|
||||
$(top_srcdir)/../config/enable.m4 \
|
||||
$(top_srcdir)/../config/lead-dot.m4 \
|
||||
$(top_srcdir)/../config/multi.m4 \
|
||||
$(top_srcdir)/../config/override.m4 \
|
||||
|
@ -275,6 +277,7 @@ AUTOMAKE = @AUTOMAKE@
|
|||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CET_FLAGS = @CET_FLAGS@
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPPATH = @COMPPATH@
|
||||
CPP = @CPP@
|
||||
|
@ -400,6 +403,7 @@ zconf.h.in zlib.h zutil.c zutil.h
|
|||
@TARGET_LIBRARY_FALSE@toolexeclib_LIBRARIES = libz.a
|
||||
@TARGET_LIBRARY_FALSE@libz_a_SOURCES = $(ZLIB_SOURCES)
|
||||
@TARGET_LIBRARY_FALSE@libz_a_CFLAGS = $(AM_CFLAGS) $(PICFLAG)
|
||||
AM_CFLAGS = $(CET_FLAGS)
|
||||
|
||||
# Work around what appears to be a GNU make bug handling MAKEFLAGS
|
||||
# values defined in terms of make variables, as is the case for CC and
|
||||
|
|
2
zlib/aclocal.m4
vendored
2
zlib/aclocal.m4
vendored
|
@ -1167,7 +1167,9 @@ AC_SUBST([am__tar])
|
|||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([../config/cet.m4])
|
||||
m4_include([../config/depstand.m4])
|
||||
m4_include([../config/enable.m4])
|
||||
m4_include([../config/lead-dot.m4])
|
||||
m4_include([../config/multi.m4])
|
||||
m4_include([../config/override.m4])
|
||||
|
|
97
zlib/configure
vendored
97
zlib/configure
vendored
|
@ -658,6 +658,7 @@ EGREP
|
|||
GREP
|
||||
SED
|
||||
LIBTOOL
|
||||
CET_FLAGS
|
||||
am__fastdepCC_FALSE
|
||||
am__fastdepCC_TRUE
|
||||
CCDEPMODE
|
||||
|
@ -768,6 +769,7 @@ with_target_subdir
|
|||
with_cross_host
|
||||
with_system_zlib
|
||||
enable_dependency_tracking
|
||||
enable_cet
|
||||
enable_shared
|
||||
enable_static
|
||||
with_pic
|
||||
|
@ -1411,6 +1413,7 @@ Optional Features:
|
|||
do not reject slow dependency extractors
|
||||
--disable-dependency-tracking
|
||||
speeds up one-time build
|
||||
--enable-cet enable Intel CET in target libraries [default=no]
|
||||
--enable-shared[=PKGS] build shared libraries [default=yes]
|
||||
--enable-static[=PKGS] build static libraries [default=yes]
|
||||
--enable-fast-install[=PKGS]
|
||||
|
@ -3400,11 +3403,11 @@ done
|
|||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <stdio.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
printf ("hello world\n");
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
@ -4142,6 +4145,91 @@ 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|auto) ;;
|
||||
*) as_fn_error $? "Unknown argument to enable/disable cet" "$LINENO" 5 ;;
|
||||
esac
|
||||
|
||||
else
|
||||
enable_cet=no
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CET support" >&5
|
||||
$as_echo_n "checking for CET support... " >&6; }
|
||||
|
||||
case "$host" in
|
||||
i[34567]86-*-linux* | x86_64-*-linux*)
|
||||
case "$enable_cet" in
|
||||
auto)
|
||||
# Check if target supports multi-byte NOPs
|
||||
# and if assembler supports CET insn.
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
#if !defined(__SSE2__)
|
||||
#error target does not support multi-byte NOPs
|
||||
#else
|
||||
asm ("setssbsy");
|
||||
#endif
|
||||
|
||||
;
|
||||
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 -mshstk"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
|
||||
case `pwd` in
|
||||
*\ * | *\ *)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
|
||||
|
@ -6032,7 +6120,6 @@ fi
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-libtool-lock was given.
|
||||
|
@ -10652,7 +10739,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 10655 "configure"
|
||||
#line 10742 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -10758,7 +10845,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 10761 "configure"
|
||||
#line 10848 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
|
|
@ -59,6 +59,10 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
|
|||
|
||||
AC_SUBST(CFLAGS)
|
||||
|
||||
# Add CET specific flags if CET is enabled
|
||||
GCC_CET_FLAGS(CET_FLAGS)
|
||||
AC_SUBST(CET_FLAGS)
|
||||
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
# Find CPP now so that any conditional tests below won't do it and
|
||||
|
|
Loading…
Add table
Reference in a new issue