On 18/10/2023 19:27, Dingjun Chen wrote:
Hi, Dear Sir or Madam, I used the gcc 4.5.2 to build an executable "Hello, World!\n" under Linux 2.6.38. Then I run it and there is no problem on local machine. After I copied it and ran it on a single board computer with Linux 2.4.36, then an error "floating point exception" occurred. The test code is very simple and there is no calculation. But the error is "Floating Point Exception". Test code: #include <stdio.h> void main() { printf("Hello, World\n"); } Could someone please tell me how to fix such an error?
What compiler and linker flags are you using? And what are the processor types on the host machine and the embedded target? It is quite possible that you have incorrect machine-specific flags that work for your host, but not for your target (perhaps you have "-march=native" enabled?). Even though you are not using floating point in the code, startup library code might configure floating point flags and options before main() starts.
<https://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/i386-and-x86_002d64-Options.html>