V2 [PATCH] x86: Adjust tst-cpu-features-supports.c for GCC 11

H.J. Lu hjl.tools@gmail.com
Fri Dec 4 13:34:50 GMT 2020


On Fri, Dec 4, 2020 at 5:14 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > On Fri, Dec 4, 2020 at 12:12 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>
> >> * H. J. Lu via Libc-alpha:
> >>
> >> > Set RDRAND usable if CPU supports RDRAND.  Also check HAS_CPU_FEATURE
> >> > instead of CPU_FEATURE_USABLE for FSGSBASE, LM and XSAVES since
> >> > FSGSBASE/LM require kernel support and XSAVES is supervisor-mode only.
> >>
> >> I think the commit subject is misleading because the RDRAND part is a
> >> glibc bug fix.  Rest looks okay to me.
> >>
> >
> > Here is the V2 patch.  It changed IBT and SHSTK to check HAS_CPU_FEATURE
> > since they need OS support.
>
> Patch is okay.  But I do wonder why __builtin_cpu_supports doesn't
> handle this.  Based on the GCC documention, I would say it should
> perform what you call a “usable” check.
>

There are no easy and OS independent ways to check if they are usable.  Glibc
doesn't set the usable bit for them.

-- 
H.J.


More information about the Libc-alpha mailing list