This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] x86: Assume --enable-cet if GCC defaults to CET [BZ #25225]
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 3 Dec 2019 09:44:33 -0800
- Subject: Re: [PATCH] x86: Assume --enable-cet if GCC defaults to CET [BZ #25225]
- References: <875zj6d9p8.fsf@oldenburg2.str.redhat.com>
On Tue, Nov 26, 2019 at 5:54 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> This links in CET support if GCC defaults to CET. Otherwise, __CET__
> is defined, yet CET functionality is not compiled and linked into the
> dynamic loader, resulting in a linker failure due to undefined
> references to _dl_cet_check and _dl_open_check.
>
> -----
> configure | 23 ++++++++++++++++++++++-
> configure.ac | 9 ++++++++-
> 2 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 2f44b66656..b959d2d988 100755
> --- a/configure
> +++ b/configure
> @@ -3777,11 +3777,32 @@ else
> fi
>
>
> +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h. */
> +
> +int
> +main ()
> +{
> +
> +#ifndef __CET__
> +#error no CET compiler support
> +#endif
> + ;
> + return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> + libc_cv_compiler_default_cet=yes
> +else
> + libc_cv_compiler_default_cet=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +
> # Check whether --enable-cet was given.
> if test "${enable_cet+set}" = set; then :
> enableval=$enable_cet; enable_cet=$enableval
> else
> - enable_cet=no
> + enable_cet=$libc_cv_compiler_default_cet
> fi
>
>
> diff --git a/configure.ac b/configure.ac
> index e69c88c543..49b900c1ed 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -473,11 +473,18 @@ AC_ARG_ENABLE([mathvec],
> [build_mathvec=$enableval],
> [build_mathvec=notset])
>
> +AC_TRY_COMPILE([], [
> +#ifndef __CET__
> +# error no CET compiler support
> +#endif],
> + [libc_cv_compiler_default_cet=yes],
> + [libc_cv_compiler_default_cet=no])
> +
> AC_ARG_ENABLE([cet],
> AC_HELP_STRING([--enable-cet],
> [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
> [enable_cet=$enableval],
> - [enable_cet=no])
> + [enable_cet=$libc_cv_compiler_default_cet])
>
> # We keep the original values in `$config_*' and never modify them, so we
> # can write them unchanged into config.make. Everything else uses
>
LGTM.
Thanks.
--
H.J.