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)
* Carlos O'Donell:
> On 10/17/19 5:06 PM, H.J. Lu wrote:
>> dl_hwcap is used to load DSO optimized for a platform. On i386, we use
>> AT_HWCAP passed from kernel. On x86-64, we use a different approach
>> since AT_HWCAP passed from kernel isn't very useful:
>
> The use of dl_hwcap to load DSOs is orthogonal to what getauxval() returns.
> They need not be the same.
>
> The question I have is: Why isn't AT_HWCAP returned by getauxval()
> for x86_64?
>
> We could store AT_HWCAP into dl_hwcap_real, and return that in getauxval()
> while still using the *processed* AT_HWCAP in dl_hwcap.
I think we use GLRO (dl_hwcap) in getauxval so that the return value
of getauxval (AT_HWCAP) is affected by LD_HWCAP_MASK, which is
reasonable as long as GLRO (dl_hwcap) the kernel's AT_HWCAP have the
same meaning.
If we change x86-64, we should add a new symbol version even if the
implementation is the same, so that we can add a compat version if
that proves necessary. We might need an x86-64-specific replacement
for LD_HWCAP_MASK and another interface to query the flags that
currently land in getauxval (AT_HWCAP), too.