[libav-devel] [PATCH] arm: Detect 32 bit cpu features on ARMv8 when running on a 64 bit kernel
martin at martin.st
Sat Jun 28 14:44:10 CEST 2014
On Sat, 28 Jun 2014, Martin Storsjö wrote:
> On Sat, 28 Jun 2014, Katerina Barone-Adesi wrote:
>> Is there a reason not to use getauxval (with AT_HWCAP)? Glibc
>> implements it, and googling suggests bionic might too.
> No reason other than the fact that we don't have code for doing that yet,
> while we do have code for parsing /proc/cpuinfo, which is quite tested and
> Also getauxval isn't officially exposed in bionic (it's not visible in the
> public headers) until the next major release. In practice it seems to have
> appeared already in 4.3 though. Therefore the function would have to be
> fetched dynamically with dlsym.
> Thus; we need to keep the code for parsing /proc/cpuinfo in any case (for
> supporting older versions of android), and extending that code, as in this
> patch, is quite simple. Adding optional support for loading getauxval
> dynamically if available, and using that in favor of /proc/cpuinfo, is of
> course possible as well (patch welcome). The android cpufeatures library
> actually does that, in addition to parsing the "CPU architecture" field.
I forgot to add; using dlsym in this code adds a dependency on libdl,
where there currently isn't any such dependency. So given that we already
cover all corner cases with the existing code plus this patch, adding
dynamic loading of getauxval might not be worthwhile after all.
More information about the libav-devel