Hard float calls some functions in GCC

This is for the Android NDK project, but I assume that it applies to GCC in general for ARM.

I know that Android NDK uses soft float to ensure compatibility with ARMv5, but it occurs to me that when compiling the ARMv7 library for our project, all calls built into the library can use hard float and use only soft float for calls to other libraries , but I'm not sure that even this can be said to the compiler. I feel that this is not the case, but I hope someone can know how to do it.

(As a side note - if it's possible with Clang in the NDK or if Clang just does this, it would be nice to know)

Some background: this is a physics-based library compiled with NDK, so hard to use floating point, and I'm looking for possible optimizations.

Edit: by thinking about this, it can only determine if the function was external during communication, while hard / soft float affects the compiler, so I assume that if possible, I will need to manually specify the functions in which the hard should be used float so the compiler knows.

+3
gcc android android-ndk
source share
1 answer

Update: NDK r9b added support for creating libraries using -mhard-float. See the NDK page .

(The original answer follows.)

There is no easy way to do this. The compiler must know each method what to use conditional conventions, and there is no attribute "soft fp". You could write (or generate) wrapper functions that convert between calls, but this is inconvenient and annoying.

If you have a library that uses float but does not have any functions that take float as arguments and do not call external functions that take float (for example, libc utility functions) - essentially a black box that does not appear to the external viewer to use float in general - then you should be able to build using "hard fp".

+3
source share

All Articles