5

I have some source code that I would like to distribute as a binary to users so they don't have to wait for about 20 mins for it to compile. However, I am a bit confused about hard and soft float binaries.

  1. How can I know whether a binary is soft or hard float?
  2. Is there some sort of compiler flag I could use to compile soft/hard float binaries (eg sf on hf system and vice versa).
  3. Will my soft float binary run on a hf system (i.e. Raspbian)?
  4. Is there some way that I could make a binary that runs hf on a hard float system, and sf on soft float?
1
  • 1
    Does your code even use floating point arithmetic?
    – Cade Roux
    Aug 19, 2012 at 16:18

1 Answer 1

6

1.) I think you can do that with readelf -A <binary> and look at Tag_ABI_HardFP_use (I'm no expert here)

2.) As stated on the Raspbian FAQ page. Their recommended compiler options are -march=armv6 -mfpu=vfp -mfloat-abi=hard where -mfloat-abi=hard is for hard float compilation.

3.) To be on the safe site you have to compile for the OS you use. That means for example Raspbian=hard float and Debian arm=soft float.

4.) I doubt that, but I'm no expert on it.

Or you have to write in a programming language, which doesn't need to know of that difference, because it is decided at runtime like Java.

2
  • Can you link the Raspbian FAQ? Aug 19, 2012 at 18:38
  • @bearbin It's done.
    – keiki
    Aug 19, 2012 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.