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();
}




你可能感兴趣的:(raise,div0)