porting newlib
Hu Jia Yi
jyhu@asmpt.com
Wed Aug 27 14:38:00 GMT 2008
By following OS Specific Toolchain http://wiki.osdev.org/OS_Specific_Toolchain,
I managed building my own cross compiler tool chain with newlib. I set my target to i386-pc-myos,
and provided 17 empty stubs in syscalls.c and crt0.S in newlib/libc/sys/myos.
The build process is smooth. But I have a few questions to this newlib porting.
1. when I use the cross-compiler
i386-pc-myos-gcc -o main main.c
the created exectuable is 119213 bytes while the executable created by native gcc (target: i486-linux-gnu)
is only 6451 bytes. This is because the cross compiler linked those unused stubs into the executable.
Is there anyway to reduce the size of the cross-compiled executable by removing these unused stubs?
2. I use the following commands to build newlib to the target i386-elf
../binutils-2.18/configure --target=i386-elf --prefix=/home/root/cross
make
make install
../gcc-4.2.4/configure --target=i386-elf --prefix=/home/root/cross
make all-gcc
make install-gcc
../newlib-1.16.0/configure --target=i386-elf --prefix=/home/root/cross
make all
make install
and didn't provide stubs and crt0.S in this case. The newlib build process failed with
the error "i386-elf-cc: command not found". I guess this is because I didn't provide stubs.
Can those stubs be regarded as external symbols when newlib is built like other static libraries?
3. If it is a pre-requisite to provide stubs, where should I place them, in libgloss/i386 or
in newlib/libc/sys/i386 (this sys/i386 doesn't exist initially)?
4. It is said in the doc that libgloss should be used to create library for embedded use. I
didn't find any clue on how libgloss can be used instead of subfolder "newlib". Could anyone enlighten me?
Best regards,
Hu Jia Yi
More information about the Newlib
mailing list