[PATCH][AArch64] Use __getauxval instead of getauxval in LSE detection code in libgcc
Richard Biener
richard.guenther@gmail.com
Wed May 6 12:00:16 GMT 2020
On Wed, May 6, 2020 at 1:56 PM Kyrylo Tkachov <Kyrylo.Tkachov@arm.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Kyrylo Tkachov
> > Sent: 06 May 2020 11:40
> > To: Florian Weimer <fweimer@redhat.com>
> > Cc: Joseph Myers <joseph@codesourcery.com>; Szabolcs Nagy
> > <Szabolcs.Nagy@arm.com>; gcc-patches@gcc.gnu.org; Jakub Jelinek
> > <jakub@redhat.com>; Richard Biener <richard.guenther@gmail.com>
> > Subject: RE: [PATCH][AArch64] Use __getauxval instead of getauxval in LSE
> > detection code in libgcc
> >
> >
> >
> > > -----Original Message-----
> > > From: Florian Weimer <fweimer@redhat.com>
> > > Sent: 06 May 2020 11:28
> > > To: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
> > > Cc: Joseph Myers <joseph@codesourcery.com>; Szabolcs Nagy
> > > <Szabolcs.Nagy@arm.com>; gcc-patches@gcc.gnu.org; Jakub Jelinek
> > > <jakub@redhat.com>; Richard Biener <richard.guenther@gmail.com>
> > > Subject: Re: [PATCH][AArch64] Use __getauxval instead of getauxval in LSE
> > > detection code in libgcc
> > >
> > > * Kyrylo Tkachov:
> > >
> > > > diff --git a/libgcc/config/aarch64/lse-init.c b/libgcc/config/aarch64/lse-
> > init.c
> > > > index 74acef25cce..57236610468 100644
> > > > --- a/libgcc/config/aarch64/lse-init.c
> > > > +++ b/libgcc/config/aarch64/lse-init.c
> > > > @@ -29,19 +29,20 @@ see the files COPYING3 and COPYING.RUNTIME
> > > respectively. If not, see
> > > > _Bool __aarch64_have_lse_atomics
> > > > __attribute__((visibility("hidden"), nocommon));
> > > >
> > > > -/* Disable initialization of __aarch64_have_lse_atomics during bootstrap.
> > > */
> > > > -#if !defined(inhibit_libc) && defined(HAVE_SYS_AUXV_H)
> > > > -# include <sys/auxv.h>
> > > > +/* Gate availability of __getauxval on glibc. All AArch64-supporting glibc
> > > > + versions support it. */
> > > > +#ifdef __gnu_linux__
> > > >
> > > > -/* Disable initialization if the system headers are too old. */
> > > > -# if defined(AT_HWCAP) && defined(HWCAP_ATOMICS)
> > > > +# define AT_HWCAP 16
> > > > +# define HWCAP_ATOMICS (1 << 8)
> > > > +
> > > > +unsigned long __getauxval (unsigned long);
> > > >
> > > > static void __attribute__((constructor))
> > > > init_have_lse_atomics (void)
> > > > {
> > > > - unsigned long hwcap = getauxval (AT_HWCAP);
> > > > + unsigned long hwcap = __getauxval (AT_HWCAP);
> > > > __aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0;
> > > > }
> > > >
> > > > -# endif /* HWCAP */
> > > > -#endif /* inhibit_libc */
> > > > +#endif /* __gnu_linux__ */
> > >
> > > GNU style is unsigned long int.
> >
> > Thanks, I'll fix that.
>
> Here is the updated patch for the record.
> Jakub, richi, is this ok for the GCC 10 branch?
I'll defer to Joseph who is release manager as well.
Thanks,
Richard.
> Thanks,
> Kyrill
>
> >
> > >
> > > Is __gnu_linux__ defined with musl? It's not really GNU/Linux, after
> > > all. musl doesn't have __getauxval IIRC, so it would break the build
> > > there.
> >
> > I don't think it does (at least not with a git grep for it in the musl code).
> > GCC doesn't define it for musl targets either. I see it defined for uclinux for
> > arm, not aarch64 though.
> >
> > Thanks,
> > Kyrill
> >
> > >
> > > (This is not a review of the patch. 8-)
> > >
> > > Thanks,
> > > Florian
>
More information about the Gcc-patches
mailing list