So it's fairly easy to figure out what kind of CPU an iOS device runs by querying sysctlbyname("hw.cpusubtype", ...)
, but there seems to be no obvious way to figure out what features the CPU actually has (think VFP, NEON, Thumb, ...). Can someone think of a way to do this?
Basically, what I need is something similar to getauxval(AT_HWCAP)
on Linux/Android, which returns a bit mask of features supported by the CPU.
A few things to note:
- The information must be retrieved at runtime from the OS. No preprocessor defines.
- Fat binaries is not a solution. I really do need to know this stuff in an ARM v6 binary.
Thanks in advance!
man sysctl
but did not find anything myself. The reason for fat binaries not being a solution is (a) it's a significant size increase (b) the decision of what architecture versions to use in apps is not actually made by me, but by customers. So if they choose to have an ARM v6 binary, that binary must work on v7 and v7s. Similarly, a fat binary with ARM v6 and v7s code must work on v7, and so on. – PennoncelUIDevice
class to retrieve the list of available features. – Absorptance