getauxv and ARMv7 platform detection

Adhemerval Zanella
Tue May 21 20:53:00 GMT 2019

On 21/05/2019 03:45, Jeffrey Walton wrote:
> On Tue, May 21, 2019 at 2:31 AM Florian Weimer <> wrote:
>> * Jeffrey Walton:
>>> On Tue, May 21, 2019 at 2:03 AM Florian Weimer <> wrote:
>>>> * Jeffrey Walton:
>>>>> My question is, how do we use getauxval to detect ARMv7 platforms?
>>>> What is the actual problem you are trying to solve?
>>> I'm trying to detect if the platform is ARMv7 at runtime.
>> Yes, but why?  Just to print a diagnostic?
> We switch to ARMv7 and NEON implementations at runtime if the CPU
> supports it. We can usually achieve 2x or 3x speedups over
> ARMv{4|5|6}.
> We've got SIGILL probes in place but they are an expensive fallback.
> We prefer a faster and cleaner solution on Linux like getauxv().
> We don't control how the library is built. Users and distros do their
> own things. About the only thing we can count on is, -march=native is
> useless (and sometimes segfaults the compiler), -march=XXX is missing
> and -mfpu=YYY is missing.

Unfortunately hwcap does not export this information, you will need to
parse /proc/cpuinfo 'CPU architecture' field and take some issues
in consideration.  Check google cpu_features project [1], it provides
such information through a library.


More information about the Libc-help mailing list