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 for Tag_ABI_VFP_args: “AAPCS (base variant)” and “toolchain-specific”, but I’m not sure in which case they may be returned.
“-a” will just dump everything, but readelf also allows you to only select architecture depend information with “-A”. So beside floating point type, you can also find out about the architecture, thumb, whether it’s build with NEON support and more:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
readelf -A /media/usb1/system/lib/libEGL.so Attribute Section: aeabi File Attributes Tag_CPU_name: "ARM v7" Tag_CPU_arch: v7 Tag_CPU_arch_profile: Application Tag_ARM_ISA_use: Yes Tag_THUMB_ISA_use: Thumb-2 Tag_FP_arch: VFPv3 Tag_Advanced_SIMD_arch: NEONv1 Tag_ABI_PCS_wchar_t: 4 Tag_ABI_FP_denormal: Needed Tag_ABI_FP_exceptions: Needed Tag_ABI_FP_number_model: IEEE 754 Tag_ABI_align_needed: 8-byte Tag_ABI_enum_size: int Tag_ABI_HardFP_use: SP and DP Tag_ABI_optimization_goals: Aggressive Speed |
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
A trick to see armhf or not, is to look at the result of of “sudo apt-get install …”:
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libltdl-dev armhf 2.4.2-1.1 [203 kB]
… so I’m running armhf … 😉