2

我正在尝试使用 DS-5 编译器编译我的代码。在链接状态下,我收到链接器失败错误。我看到了警告,但没有看到具体的错误,例如未定义的引用等。有人可以帮助我吗

日志如下

/usr/local/DS-5/sw/gcc/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: warning: /opt/arm-2010.09/lib/gcc/arm-none-eabi/4.5.1/libgcc.a(bpabi.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
/usr/local/DS-5/sw/gcc/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: warning: /opt/arm-2010.09/lib/gcc/arm-none-eabi/4.5.1/libgcc.a(unwind-arm.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
/usr/local/DS-5/sw/gcc/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: warning: /opt/arm-2010.09/lib/gcc/arm-none-eabi/4.5.1/libgcc.a(pr-support.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
/usr/local/DS-5/sw/gcc/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: warning: /opt/arm-2010.09/lib/gcc/arm-none-eabi/4.5.1/libgcc.a(_divdi3.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
/usr/local/DS-5/sw/gcc/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: warning: /opt/arm-2010.09/lib/gcc/arm-none-eabi/4.5.1/libgcc.a(_udivdi3.o) uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
/usr/local/DS-5/sw/gcc/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: .ddr_text has both ordered [`.ARM.exidx.atcm_text' in .//hw/obj/target/hw.a] and unordered [`.ARM.extab' in /opt/arm-2010.09/lib/gcc/arm-none-eabi/4.5.1/libgcc.a(_udivdi3.o)] sections
/usr/local/DS-5/sw/gcc/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
4

1 回答 1

0

当您使用 gcc 编译器开关 -fno-short-enums 强制所有枚举为 32 位时,可能会发生此问题。当链接器的目标设置为可变大小的枚举时,实际的警告消息来自链接器。

如果您指定编译器开关 -fshort-enums,则警告将消失,因为所有枚举现在都是一致的。这就是好消息。坏消息是......如果你真的要求枚举是 32 位,我不知道链接器需要什么选项。这是我的问题。我相信它是由其他一些构建设置所暗示的,并且仍在寻找......

于 2017-10-11T01:50:01.170 回答