X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libiberty%2Fconfigure;h=3f82c5bb865cb09edd605138a8e7bf98c32f3f45;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=460b44b3d22eb648249209eb0ba5e04b0734e9da;hpb=d0ac1c44885daf68f631befa37e3f3bad318fbbf;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/configure b/libiberty/configure index 460b44b3d2..3f82c5bb86 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -626,6 +626,7 @@ pexecute target_header_dir CHECK LIBOBJS +CET_HOST_FLAGS NOASANFLAG PICFLAG INSTALL_DATA @@ -710,6 +711,7 @@ enable_maintainer_mode enable_multilib enable_install_libiberty enable_largefile +enable_cet ' ac_precious_vars='build_alias host_alias @@ -1337,6 +1339,7 @@ Optional Features: --enable-multilib build many library versions (default) --enable-install-libiberty Install headers and library for end users --disable-largefile omit support for large files + --enable-cet enable Intel CET in host libraries [default=auto] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1671,6 +1674,52 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_header_compile +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + # ac_fn_c_check_header_preproc LINENO HEADER VAR # ---------------------------------------------- # Tests whether HEADER is present, setting the cache variable VAR accordingly. @@ -1937,52 +1986,6 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_type -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -3310,11 +3313,11 @@ done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +#include int main () { - +printf ("hello world\n"); ; return 0; } @@ -5264,6 +5267,182 @@ case " ${CFLAGS} " in esac + # 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=auto +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*) + may_have_cet=yes + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fcf-protection" + 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 + CFLAGS="$save_CFLAGS" + ;; + *) + may_have_cet=no + enable_cet=no + ;; +esac + +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fcf-protection=none" +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS -Wl,-z,ibt,-z,shstk" +if test x$may_have_cet = xyes; then + # Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk work. + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + may_have_cet=yes +else + may_have_cet=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +if test x$may_have_cet = xyes; then + if test x$cross_compiling = xno; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +static void +foo (void) +{ +} + +static void +__attribute__ ((noinline, noclone)) +xxx (void (*f) (void)) +{ + f (); +} + +static void +__attribute__ ((noinline, noclone)) +bar (void) +{ + xxx (foo); +} + +int +main () +{ + bar (); + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + have_cet=no +else + have_cet=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + if test x$enable_cet = xno -a x$have_cet = xyes; then + as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 + fi + fi +else + # Enable CET in cross compiler if possible so that it will run on both + # CET and non-CET hosts. + have_cet=yes +fi +if test x$enable_cet = xyes; then + CET_HOST_FLAGS="-fcf-protection" + { $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 +CFLAGS="$save_CFLAGS" +LDFLAGS="$save_LDFLAGS" + + + echo "# Warning: this fragment is automatically generated" > temp-frag if [ -n "${frag}" ] && [ -f "${frag}" ]; then @@ -5797,7 +5976,7 @@ funcs="$funcs setproctitle" vars="sys_errlist sys_nerr sys_siglist" checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \ - getsysinfo gettimeofday on_exit psignal pstat_getdynamic pstat_getstatic \ + getsysinfo gettimeofday on_exit pipe2 psignal pstat_getdynamic pstat_getstatic \ realpath setrlimit sbrk spawnve spawnvpe strerror strsignal sysconf sysctl \ sysmp table times wait3 wait4" @@ -5813,7 +5992,7 @@ if test "x" = "y"; then index insque \ memchr memcmp memcpy memmem memmove memset mkstemps \ on_exit \ - psignal pstat_getdynamic pstat_getstatic putenv \ + pipe2 psignal pstat_getdynamic pstat_getstatic putenv \ random realpath rename rindex \ sbrk setenv setproctitle setrlimit sigsetmask snprintf spawnve spawnvpe \ stpcpy stpncpy strcasecmp strchr strdup \