[PATCH 21/39] debug: Avoid clang optimize away required function on tst-ssp1.c

Sam James sam@gentoo.org
Sun Dec 22 04:40:22 GMT 2024


"H.J. Lu" <hjl.tools@gmail.com> writes:

> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> ---
>  debug/tst-ssp-1.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/debug/tst-ssp-1.c b/debug/tst-ssp-1.c
> index 27f10edc56..671e9a5007 100644
> --- a/debug/tst-ssp-1.c
> +++ b/debug/tst-ssp-1.c
> @@ -22,6 +22,10 @@
>  
>  static void
>  __attribute__ ((noinline)) __attribute_noclone__
> +#ifdef __clang__
> +/* Avoid clang optimize it away.  */

optimizing

> +__attribute__ ((optnone))
> +#endif

Also, I don't love the inconsistency here (optnone for Clang vs
noinline,noclone for GCC). But at least for GCC, I know SSP depends on
some optimisation of course, and I don't know if Clang is different
there, so OK. We're trying to err on the side of "only changing Clang"
where we can for this, as long as it's clear what should be revisited.

Reviewed-by: Sam James <sam@gentoo.org>

>  test (char *foo)
>  {
>    int i;


More information about the Libc-alpha mailing list