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

H.J. Lu hjl.tools@gmail.com
Sun Dec 22 05:21:52 GMT 2024


On Sun, Dec 22, 2024 at 12:40 PM Sam James <sam@gentoo.org> wrote:
>
> "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

Let me revisit it.

> 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;



-- 
H.J.


More information about the Libc-alpha mailing list