diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-05-12 09:27:24 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-05-12 09:27:35 -0700 |
commit | c08278701f7433978ca56e3413855bd4b001aa1d (patch) | |
tree | 6c95b8bdf9c8c71e2a227165fe9d335e25c51b40 /zlib/configure | |
parent | d21486483579c2205fcabf1308b155000af86fe1 (diff) | |
download | gcc-c08278701f7433978ca56e3413855bd4b001aa1d.zip gcc-c08278701f7433978ca56e3413855bd4b001aa1d.tar.gz gcc-c08278701f7433978ca56e3413855bd4b001aa1d.tar.bz2 |
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/configure')
-rwxr-xr-x | zlib/configure | 97 |
1 files changed, 92 insertions, 5 deletions
diff --git a/zlib/configure b/zlib/configure index 484a493..51a6ef3 100755 --- a/zlib/configure +++ b/zlib/configure @@ -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 @@ -6034,7 +6122,6 @@ fi - # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; @@ -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 |