This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: problem of using both libgloss and libc
On Tue, May 27, 2003 at 03:45:05PM -0400, J. Johnston wrote:
> Dai,
>
> For now, supply the definition of errno, either in your main program or
> add another stub
> with: int errno; in it. I am going to add an errno stub to libnosys so
> that if not defined,
> libnosys will supply a definition.
>
> The arm has all of the syscalls embedded together inside newlib so
> putting -lc can end up
> dragging them all in at once. In your case, you had already supplied a
> _write syscall via -lnosys
> so you got the error. It is my future goal to get the syscalls out of
> newlib and into libgloss.
Thank you.,Jeff. I understand the problem.
In fact I don't need syscalls in libc so I remove syscalls.o from libc.a
using ar.
Best regard,
Dai Yuwen
>
> -- Jeff J.
>
> Dai Yuwen wrote:
> >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