LD链接失败 - 不良值

时间:2017-02-05 05:24:38

标签: gcc arm ld ds-5

我正在尝试使用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

1 个答案:

答案 0 :(得分:0)

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

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