From c132089fb1a776c8cb574cd89ac10bdf0aeaf56c Mon Sep 17 00:00:00 2001 From: Joshua Elsasser Date: Wed, 20 Nov 2019 21:03:01 -0800 Subject: [PATCH] Correctly detect hard/soft float ABI on arm32 The old code would detect -mfloat-abi=soft as softfp, but would treat -mfloat-abi=softfp as hard float. --- tools-for-build/arm-softfp-test.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools-for-build/arm-softfp-test.c b/tools-for-build/arm-softfp-test.c index 8a9f39731..133958d50 100644 --- a/tools-for-build/arm-softfp-test.c +++ b/tools-for-build/arm-softfp-test.c @@ -1,6 +1,17 @@ int main () { -#if defined __arm__ && defined __SOFTFP__ +/* + The C compiler defines __ARM_PCS_VFP when the hard float ABI is in + use and floats/doubles are passed to and returned from functions + via VFP registers. Otherwise, floats are treated as integers for + the purpose of function calls. + + Confusingly, __SOFTFP__ is defined only when software floating + point emulation is used within a function, and doesn't reveal which + function calling convention is used. It will be defined with + -mfloat-abi=soft but not -mfloat-abi=softfp +*/ +#if defined __arm__ && !defined __ARM_PCS_VFP return 104; #else return 0;