Link error about sbrk
Mon Nov 16 22:12:00 GMT 2009
I cross-compile newlib as mips target, but when I link the libraries I
build in libgloss, I get the error as below:
# make TOOLCHAIN=mipsel-unknown-elf-
mipsel-unknown-elf-ld -T ./link.xn -o TestCode.elf -Map TestCode.map
--oformat elf32-littlemips init.o reset.o atexit.o -static -nostdlib
-L/media/sdb1/newlib-1.17.0/mipsel/newlib -lnosys -lc
(.text+0x14): undefined reference to `sbrk'
(.text+0x14): relocation truncated to fit: R_MIPS_26 against `sbrk'
make: *** [TestCode.elf] Error 1
My questions are:
1. take mips for example, why we have to build some many different libraries as
instead of build a bare one?
( all of them are just different combinations of the .o files)
if we ar all .o files as one library, linker will link what we need
2. the files I need to modify, system calls that act as 'glue' between
newlib and my OS, are all located at libgloss/mips, right? If so, I
have checked that sbrk is located at syscalls.c and it is ared at
libidt.a, but why linker still complain he cannot find the sbrk? did I
appreciate your help,
More information about the Newlib