This is the mail archive of the newlib@sources.redhat.com 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]

problem of using both libgloss and libc


Hi, Dear All

I want to use the libgloss version of _write to run applications on a bare 
ARM board.  I find _write use libc:

c:/bar/bin/arm-elf-gcc -c   -mlittle-endian  -A 'endian(little)'  
-DMACHINE_TYPE
_ARM  -w -O0 -g -gstabs main.c
c:/bar/bin/arm-elf-ld -Ttext 1008000 -Tdata 101A000 -Tbss 1030000 -n -N 
-nostart
upfiles -static -EL -e_start  -L"E:/home/yuwen/tmp/newlib" -T"a1.ld" -o 
a1.elf s
tart_up.o main.o -lnosys  c:/bar/lib/gcc-lib/arm-elf/3.2.3/libgcc.a
main.o: In function `__main':
main.c:16: warning: _write is not implemented and will always fail
/cygdrive/c/bar/arm-elf/lib/libnosys.a(write.o): In function `_write':
/cygdrive/c/build/newlib-1.11.0/libgloss/libnosys/write.c:21: undefined 
referenc
e to `errno'

Then I add -lc to the linker, but found libc also had a _write:
c:/bar/bin/arm-elf-gcc -c   -mlittle-endian  -A 'endian(little)'  
-DMACHINE_TYPE
_ARM  -w -O0 -g -gstabs main.c
c:/bar/bin/arm-elf-ld -Ttext 1008000 -Tdata 101A000 -Tbss 1030000 -n -N 
-nostart
upfiles -static -EL -e_start  -L"E:/home/yuwen/tmp/newlib" -T"a1.ld" -o 
a1.elf s
tart_up.o main.o -lnosys -lc c:/bar/lib/gcc-lib/arm-elf/3.2.3/libgcc.a
main.o: In function `__main':
main.c:16: warning: _write is not implemented and will always fail
/cygdrive/c/bar/arm-elf/lib/libc.a(syscalls.o): In function `_write':
/cygdrive/c/build/newlib-1.11.0/newlib/libc/sys/arm/syscalls.c:340: 
multiple def
inition of `_write'
/cygdrive/c/bar/arm-elf/lib/libnosys.a(write.o):/cygdrive/c/build/newlib-1.11.0/
libgloss/libnosys/write.c:19: first defined here
c:/bar/bin/arm-elf-ld: Warning: size of symbol `_write' changed from 24 to 
120 i
n /cygdrive/c/bar/arm-elf/lib/libc.a(syscalls.o)
make: *** [a1.elf] Error 1

If I put -lc before -lnosys, the link was OK.  But the libgloss version of 
_write was masked by libc's.  How do sovle this problem? My intent is to 
use stdio functions on a ARM board without OS.

Best regards,
Dai Yuwen

-- 
daiyuwen@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org


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