We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Dear Sir,
How to disable floating-point instruction generation with aarch64 GCC compiler ?
We want to use software to do floating-point calculation.
But always has error messages as below:
aarch64-linux-gnu-gcc -mcpu=cortex-a53+nofp test.ctest.c: In function 'main':test.c:24:11: error: '+nofp' feature modifier is incompatible with floating-point code float aa = 0.0; ^test.c:28:12: error: '+nofp' feature modifier is incompatible with floating-point argument aa += 3.0; ^test.c:28:12: error: '+nofp' feature modifier is incompatible with floating-point argumenttest.c:28:12: error: '+nofp' feature modifier is incompatible with floating-point codetest.c:28: confused by earlier errors, bailing out
Any suggestion is good.
Thank you.
test.c
#include <stdlib.h>#include <stdio.h>
/* * void main(void) * the application start point for the primary CPU * * Inputs * <none> * * Returns * subroutine does not return */int main(void){ float aa = 0.0; int i;
for(i = 0; i < 1024; i++) { aa += 3.0; }
if (aa > 1000.0) exit(1); else exit(2);
return 0;}
nofp means no floating point at all, it is used to check floating point isn't used by mistake in some place it might cause problems like a device driver. The gcc option you want is -msoft-float, however this is not supported in any build for Aarch64 currently, it is really there for embedded processors that don't support a floating point unit. It wouldn't be hard to support in gcc- but it would require all associated libraries be built with the option as well and that implies a lot of support effort.
Thank you for your explanation.