How to Detect if an ARM ELF Binary is Hard-float (ARMHF) or Soft-float (ARMEL)

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:


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:


and armhf:


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:

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
1 Comment
oldest
newest
Sander
Sander
10 years ago

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 … 😉

Khadas VIM4 SBC