Since the hardware is generally the same between Raspberry Pi's, the target hardware is known to have a hardware floating point unit. I also understand that some operating systems opt to use soft-FP based instructions over using the FPU for software compatibility reasons.
However, I'm wondering: what's stopping you from using the ARM opcodes to use the FPU, even under a soft-FP compiled OS? Are there any technical limitations to running hard-FP binaries on a soft-FP operating system?
Finally, given the above two questions, can I compile software with the various GCC floating point options (soft
, softfp
, or hard
) regardless of what the host OS was compiled with?
Update: For further clarification, do these compiler options only affect function calls containing the float
data type? Would the ABI limitation come into play when dealing with simple programs like this one which only uses floating point operations, and not library function calls using floats
?
Compiling the above program with gcc -O0 -S -c main.c
results in this assembler output listing. For comparison, here is the assembler output using -O3
instead of -O0
. Aside from the -O3
build having pre-computed the integer value as 2, the library call for printf
is pretty much the same, as expected.