c - 编译 ARM 演示项目时出现链接器错误

标签 c gcc arm eabi

我安装了 GNU ARM 嵌入式工具链 gcc-arm-none-eabi

当我对来自 https://github.com/ChibiOS/ChibiOS-RT 的演示项目之一运行 make 时

我收到此链接器错误

main.c: In function 'Thread1':
main.c:36:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
main.c: In function 'Thread2':
main.c:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Linking build/ch.elf
main.c: In function 'main':
main.c:58:5: internal compiler error: Segmentation fault
 int main(void) {
     ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
lto-wrapper: arm-none-eabi-gcc returned 1 exit status
/usr/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [build/ch.elf] Error 1

最佳答案

GCC 4.8 不支持同时启用 LTOggdb。只需禁用一个或另一个即可。

尝试配置您的 Makefile:

USE_LTO = no

USE_OPT = -O2 -fomit-frame-pointer -falign-functions=16

没有 -ggdb 标志

关于c - 编译 ARM 演示项目时出现链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24021164/

相关文章:

C结构;克服将字符串传递给 char

c - 为什么链接后我的可执行文件更大

c - GNU ARM 汇编程序在错误消息中给出看似无关的寄存器

linux - 多核处理器之间的区别

c - 在此 C 代码示例中使用 MPI_Isend 是否安全?

c - 编译 Dcmi 时出现 xError

c++ - 如何查看VisualStudio对C/C++标准库的实现?

c++ - 如何通过编译器设置(不是编译指示)告诉 GCC 将结构大小边界设置为 4 个字节?

c - 对 sync_fetch_and_add_4 的 undefined reference

c - typedef 定长数组