Blackfin GCC-Toolchain链接错误数学功能,例如AtAN2:未定义的引用,watan2.o中

StackOverflow https://stackoverflow.com/questions/8305081

我的裸金属程序与Blackfin工具链链接器的经典数学功能链接有问题。我尝试了很多事情,但是我看不出为什么libm.a不提供其使用功能的定义。我需要添加额外的库吗?如果是,哪一个?

我将Linker的详细信息放在链接库中,并将链接错误的示例链接。

谢谢,

威廉

bfin-elf-ld -v  -o test_ad1836_driver -T  coreb_test_ad1836_driver.lds  --just-symbol  ../../icc_core/icc queue.o ezkit_561.o  heap_2.o  port.o tasks.o test_ad1836_driver.o list.o croutine.o user_isr.o bfin_isr.o app_c.o context_sl_asm.o cycle_count.o CFFT_Rad4_NS_NBRev.o fir_decima.o fir_decima_spl.o math_tools.o -Ttext 0x3c00000   -L /opt/uClinux/bfin-elf/bfin-elf/lib -lbffastfp -lbfdsp -lg -lc -lm -Map=test_ad1836_driver.map 
argv[0]      = 'bfin-elf-ld'
bindir       = '/opt/uClinux/bfin-elf/bin/'
tooldir      = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/'
linker       = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/ld.real'
elf2flt      = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/elf2flt'
nm           = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/nm'
objdump      = '/opt/uClinux/bfin-elf/bin/bfin-elf-objdump'
objcopy      = '/opt/uClinux/bfin-elf/bin/bfin-elf-objcopy'
ldscriptpath = '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/../lib'
Invoking: '/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/ld.real' '-v' '-o' 'test_ad1836_driver' '-T' 'coreb_test_ad1836_driver.lds' '--just-symbol' '../../icc_core/icc' 'queue.o' 'ezkit_561.o' 'heap_2.o' 'port.o' 'tasks.o' 'test_ad1836_driver.o' 'list.o' 'croutine.o' 'user_isr.o' 'bfin_isr.o' 'app_c.o' 'context_sl_asm.o' 'cycle_count.o' 'CFFT_Rad4_NS_NBRev.o' 'fir_decima.o' 'fir_decima_spl.o' 'math_tools.o' '-Ttext' '0x3c00000' '-L' '/opt/uClinux/bfin-elf/bfin-elf/lib' '-lbffastfp' '-lbfdsp' '-lg' '-lc' '-lm' '-Map=test_ad1836_driver.map'
GNU ld version 2.17
/opt/uClinux/bfin-elf/bfin-elf/lib/libm.a(w_atan2.o): In function `atan2':
/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libm/math/w_atan2.c:96: undefined reference to `__eqdf2'
/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libm/math/w_atan2.c:96: relocation truncated to fit: R_BFIN_PCREL24 against undefined symbol `__eqdf2'
.....
/opt/uClinux/bfin-elf/bfin-elf/lib/libm.a(e_sqrt.o): In function `_ieee754_sqrt':
/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libm/math/e_sqrt.c:110: undefined reference to `__muldf3'
/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libm/math/e_sqrt.c:110: undefined reference to `__adddf3'

.....
/opt/uClinux/bfin-elf/bfin-elf/lib/libm.a(s_atan.o): In function `atan':
/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libm/math/s_atan.c:169: undefined reference to `__muldf3'
/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libm/math/s_atan.c:170: undefined reference to `__muldf3'
/usr/src/packages/BUILD/blackfin-toolchain-2010R1/gcc-4.3/newlib/libm/math/s_atan.c:172: undefined reference to `__muldf3'
有帮助吗?

解决方案

添加 -lgcc. 。您需要功能来比较,添加和乘以C double 类型值分别 __eqdf2, __adddf3__muldf3.

通常,我建议使用编译器驱动程序(GCC),而不是直接链接 ld, ,即使对于固件/内核类型输出,前者也会照顾必要的启动文件和编译器运行时库。

其他提示

嗨,我想我知道这个问题,Blackfin与Maths STD Lib并不兼容。这就是为什么在VDSP版本中重新实现了数学函数的原因。为了解决我的问题,我确实将VDSP Maths LIB转换为GCC,现在可以汇总。

谢谢

实际上我找到了一个更好的答案,

Blackfin实际上确实支持性病数学。我刚刚以错误的顺序有一些图书馆标志。

对于链接器,使用以下LIB标志订单,它应该有效:

/opt/uClinux/bfin-elf/bin/../bfin-elf/bin/ld.real' '-v' '-o' .... '-L' '/opt/uClinux/bfin-elf/lib/gcc/bfin-elf/4.3.5/' '-lgcc' '-L' '/opt/uClinux/bfin-elf/bfin-elf/lib' '-lbfdsp' '-lg' '-lm' '-lbffastfp' '-lc' 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top