Cut down fallback getauxval() reimplementation
My fallback implementation of getauxval() didn't special-case AT_HWCAP and AT_HWCAP2 like glibc does. However, we don't actually need it to, because in practice we only called it with argument AT_SYSINFO_EHDR.
Also add correct errno handling, and check for a NULL return at the call site.
@krisman: would you be OK with doing this instead of trying to replicate glibc's special cases?
I'm a little concerned that if we try to implement getauxval()
fully, we'll end up being a derivative work of glibc (⇒ relicensing from BSD-3-clause to LGPL-2.1+), and will need to know the finer details of how the ELF loader ld.so works.
Not tested on real systems, but syscall-intercept and libcasefold pass their build-time tests.