
Hello Simon,
On 02/07/15 16:10, Simon Glass wrote:
I am not giving up, I think it is sane if a tool which adds a header and a checksum does not use linker magic. Sandbox biggest problem is not the linking, but the fact that linux headers and std* are included, it is a different topic.
This should be easy to fix in os.c since all the inclusions are isolated to there. I'd been keen to see a patch for that. Also if you want LCD support, sdl.c.
I had a look at this and hacked my way through and linked it with a GNU ld (GNU Binutils) 2.25. So at least I have a binary, but unfortunately it doesn't work, and errors out with:
Fatal error 'Can't allocate initial thread' at line 350 in file /usr/src/lib/libthr/thread/thr_init.c (errno = 2)
The reason for this seems to be void _thread_init_hack(void) __attribute__ ((constructor)); which calls _libpthread_init -> _thr_alloc -> calloc and that calls the version in u-boots version of dl-malloc which is not initialized yet.
Did you encounter such problems on linux as well? Or does libpthread simply not allocate memory before reaching main?
Regards, Jeroen
ldd ../u-boot-build/u-boot ../u-boot-build/u-boot: librt.so.1 => /usr/lib/librt.so.1 (0x800896000) libSDL-1.2.so.0 => /usr/local/lib/libSDL-1.2.so.0 (0x800a9c000) libthr.so.3 => /lib/libthr.so.3 (0x800d02000) libc.so.7 => /lib/libc.so.7 (0x800f27000) libm.so.5 => /lib/libm.so.5 (0x8012d0000) libvgl.so.6 => /usr/lib/libvgl.so.6 (0x8014f8000) libaa.so.1 => /usr/local/lib/libaa.so.1 (0x801701000) libusbhid.so.4 => /usr/lib/libusbhid.so.4 (0x801919000) libncurses.so.8 => /lib/libncurses.so.8 (0x801b1d000)