This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: glibc clears AT_HWCAP and set only HW_CAP_X86_64 (0x2)
- From: Carlos O'Donell <carlos at redhat dot com>
- To: Baojun Wang <wangbj at gmail dot com>, libc-help at sourceware dot org, "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Thu, 17 Oct 2019 16:26:44 -0400
- Subject: Re: glibc clears AT_HWCAP and set only HW_CAP_X86_64 (0x2)
- References: <CAC+a-TaCHxHjeNVc+vPY3qz7d4tnu48x=nNeRRGYqaUeQZ1UZg@mail.gmail.com>
On 10/17/19 11:29 AM, Baojun Wang wrote:
> Hi libc,
>
> when calling getauxval(AT_HWCAP), it returns 0x2, because of below snippet:
>
> https://code.woboq.org/userspace/glibc/sysdeps/x86/cpu-features.c.html#510
>
> Is there any reason why glibc don't use the values passed from kernel auxv?
I don't know of any good reason.
The semantics of getauxval() is to provide the auxiliary vector data.
In this case glibc *does* read AT_HWCAP, but then for x86 it overrides it
with a computed value based on cpuid.
HJ, Is there any reason we do this?
Baojun, Do you see a difference between getauxval() return and real AT_HWCAP?
--
Cheers,
Carlos.