undefined reference to `raise'

问题:

u-boot 2015.01

gcc-4.2.0

/usr/local/arm-2007q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.0/libgcc.a(_dvmd_lnx.o): In function `__div0':
/scratch/paul/arm/src/gcc-4.2/gcc/config/arm/lib1funcs.asm:(.text+0x8): undefined reference to `raise'
arm-none-linux-gnueabi-ld: BFD (CodeSourcery Sourcery G++ Lite 2007q1-10) 2.17 assertion fail /scratch/paul/arm/obj/binutils-src-2007q1-10-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:9215
arm-none-linux-gnueabi-ld: BFD (CodeSourcery Sourcery G++ Lite 2007q1-10) 2.17 assertion fail /scratch/paul/arm/obj/binutils-src-2007q1-10-arm-none-linux-gnueabi-i686-pc-linux-gnu/bfd/elf32-arm.c:9442

问题的意思就是说,缺了个函数调用 raise,在除0异常处理函数里。


网上有这么几种相关的解释:

__aeabi_ldiv0 is called when a division by zero error occurs. According to the ARM ABI ('Run-time ABI for the ARM® Architecture 2.08'), the implementation may:
 * Return the value passed to them as a parameter.
 * Or, return a fixed value defined by the execution environment (such as 0).
 * Or, raise a signal (often SIGFPE) or throw an exception, and do not return.

The version that comes with libgcc calls the standard C function 'raise' to kill the current process. See:
 http://pubs.opengroup.org/onlinepubs/000095399/functions/raise.html

The Bionic implementation is at:
 bionic/libc/unistd/raise.c

Note that this is unrelated to C++ exceptions. It seems that your C library isn't getting linked in. If you can't use the C library, implement your own version of raise() or __aeabi_ldiv0. The version in libgcc is a weak symbol and will be overriden by your version.


这边的话,解决的方法,就是配置uboot使用自己私有的libgcc库就可以,因为在div0的处理不涉及raise的调用

void __div0 (void)
{
	extern void hang (void);

	hang();
}




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值