[PATCH] x86: Check if CPUID_INDEX_7_ECX_1 is supported first

H.J. Lu hjl.tools@gmail.com
Tue Aug 25 07:03:36 GMT 2026


On Tue, Aug 25, 2026 at 2:36 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> > index a453136827..0db33e0f35 100644
> > --- a/sysdeps/x86/cpu-features.c
> > +++ b/sysdeps/x86/cpu-features.c
> > @@ -458,11 +458,13 @@ get_common_indices (struct cpu_features *cpu_features,
> >                    cpu_features->features[CPUID_INDEX_7].cpuid.ebx,
> >                    cpu_features->features[CPUID_INDEX_7].cpuid.ecx,
> >                    cpu_features->features[CPUID_INDEX_7].cpuid.edx);
> > -      __cpuid_count (7, 1,
> > -                  cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.eax,
> > -                  cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.ebx,
> > -                  cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.ecx,
> > -                  cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.edx);
> > +      if (cpu_features->features[CPUID_INDEX_7].cpuid.eax != 0)
> > +     __cpuid_count
> > +       (7, 1,
> > +        cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.eax,
> > +        cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.ebx,
> > +        cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.ecx,
> > +        cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.edx);
> >      }
> >
> >    if (cpu_features->basic.max_cpuid >= 0xd)
>
> If subleaf 1 is not support, should we zero the fields?
>

_rtld_global_ro._dl_x86_cpu_features is initialized to 0.

-- 
H.J.


More information about the Libc-alpha mailing list