arm-none-eabi-gcc 报错 undefined reference to `_exit'解决方案

Bug

使用arm-none-ebai-gcc出现如下报错
在这里插入图片描述

Reason

ARM Compiler toolchain 提到一种semi-host机制,博主没仔细看,感觉大概是要么使用semi-host要么不使用。

Semihosting is a mechanism that enables code running on an ARM target to communicate and use the Input/Output facilities on a host computer that is running a debugger.

semi-host是一种可以使得ARM架构的代码能够在debugger机器上使用通信和输入输出功能的机制。如果使用的话,则

$ arm-none-eabi-gcc --specs=rdimon.specs $(OTHER_LINK_OPTIONS)

如果不使用,则是

** non-semihosting/retarget
If you are using retarget, linking like:

$ arm-none-eabi-gcc --specs=nosys.specs $(OTHER_LINK_OPTIONS)

测试发现,不使用该机制则编译通过,后续研究清楚该机制后再更新补充一下这个机制的作用和用法

Solve

使用--specs=nosys.specs即可

$ arm-none-eabi-gcc --specs=nosys.specs $(OTHER_LINK_OPTIONS)

版权声明:本文为qq_35544379原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。