On Thu, 7 Oct 2010, Andrew Stubbs wrote:
There's another issue here: using a Linux user-space compiler to build for bare-metal is a bad plan. libgcc is built assuming that system calls and exceptions etc. work as they do in Linux user-mode. The Linux kernel is built with a user-space compiler for convenience, but a) the kernel is always configured for the same hardware as the user-space, and b) it has it's own versions of (at least some of) the libgcc routines, customized for it's own environment.
The kernel does indeed explicitly avoid any linkage with libgcc.a. It is self contained and provide its own set of equivalent functions typically carried by libgcc.a, and explicitly _exclude_ some other functions (such as 64-bit divisions) to ensure they're never used in the kernel.
I strongly suggest you use a bare-metal compiler configured for the right architecture(s), such as CodeSourcery's ARM EABI Lite toolchain.
I think that a perfectly valid alternative is for the bare-metal target program to provide its own support library as the kernel does. So if U-Boot already comes with its own libgcc.a equivalent, then it should just be used.
Nicolas