Re: [PATCH] x86: Check if CPUID_INDEX_7_ECX_1 is supported first

"H.J. Lu" <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <CAMe9rOqyj446Fk4ZJRtU5LBeR_z4e-3t249Mjex1JDzLL_SY7w@mail.gmail.com>
On Tue, Aug 25, 2026 at 2:36 PM Florian Weimer <[email protected]> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.