If some cases you may want to know if a library or binary built for the ARM architecture is using hard-float (armhf) or soft-float (armel). You can analyze ELF binary using readefl utility, so let’s have a try. First let’s install some armel and armhf files on a computer running Ubuntu by install gcc/g++ toolchain for armel and armhf:
1 |
apt-get install g++-arm-linux-gnueabi g++-arm-linux-gnueabihf |
We now have armhf and armel libraries installed in /usr/arm-linux-gnueabihf/lib and /usr/arm-linux-gnueabi/lib respectively. Let’s check the output of readelf filtered with “FP” string for libm.so.6 for armel:
1 2 3 4 5 6 7 |
readelf -a /usr/arm-linux-gnueabi/lib/libm.so.6 | grep FP Tag_FP_arch: VFPv3-D16 Tag_ABI_FP_denormal: Needed Tag_ABI_FP_exceptions: Needed Tag_ABI_FP_number_model: IEEE 754 Tag_ABI_HardFP_use: SP and DP |
and armhf:
1 2 3 4 5 6 7 8 |
readelf -a /usr/arm-linux-gnueabihf/lib/libm.so.6 | grep FP Tag_FP_arch: VFPv3-D16 Tag_ABI_FP_denormal: Needed Tag_ABI_FP_exceptions: Needed Tag_ABI_FP_number_model: IEEE 754 Tag_ABI_HardFP_use: SP and DP Tag_ABI_VFP_args: VFP registers |
Great, so there’s an extra line for armhf (Tag_ABI_VFP_args) that seems to confirm the library is hard-float. With readelf compiled from elftoolchain-0.6.1 (source code), the extra line will be a bit different: “Tag_ABI_VFP_args: AAPCS (VFP variant) AAPCS stands for ARM Architecture Procedure Call Standard. You can read more details on ARM website. There are also two other possible values […]