6

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?
tlhIngan
  • 3,372
  • 5
  • 21
  • 33
hifkanotiks
  • 1,901
  • 3
  • 16
  • 28

1 Answers1

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.

keiki
  • 1,638
  • 1
  • 17
  • 18