This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Link error about sbrk


Dear all:
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/libgloss/libnosys
-L/media/sdb1/newlib-1.17.0/mipsel/libgloss/mips/libidt.a
-L/media/sdb1/newlib-1.17.0/mipsel/newlib -lnosys -lc
/media/sdb1/newlib-1.17.0/mipsel/newlib/libc.a(lib_a-sbrkr.o): In
function `_sbrk_r':
(.text+0x14): undefined reference to `sbrk'
/media/sdb1/newlib-1.17.0/mipsel/newlib/libc.a(lib_a-sbrkr.o): In
function `_sbrk_r':
(.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
libcfe.a
libidt.a
liblsi.a
libnullmon.a
libpmon.a
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
automatically, right?

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
miss something?

appreciate your help,
miloody


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]