How to use newlib
Thu Apr 27 11:08:00 GMT 2000
"Michael K. Elwood" <firstname.lastname@example.org> writes:
| It doesn't look like you are linking libnosys.a correctly (which should
| contain the OS routines that gcc is complaining about).
| Try using -lnosys instead of libnosys.a on your link command.
"Robert McNulty Junior" <email@example.com> writes:
| The right way to use the newlibs are as folllows.
| For libc: -lc
| for libm: -lm
| Note, that is small L, not one (1)
Now I link with -lc and -lnosys, but there is still an error:
gcc -L. -static hello.o -lc -lnosys -o hello
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0xe): undefined reference to `__libc_init_first'
/usr/lib/crt1.o(.text+0x18): undefined reference to `_environ'
./libc.a(exit.o): In function `exit':
/home/olivia/szi/software/smbproxy/1.1.1/bootdisk/newlib-1.8.2/newlib.build/libc/stdlib/../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
collect2: ld returned 1 exit status
make: *** [hello] Error 1
make: Target `all' not remade because of errors.
Isn't it wrong that gcc tries to link with /usr/lib/crt1.o, which does
not belong to newlib, but to the glibc of my system? I tried to link
with -nostartfiles, but newlib seams to have no crt file and I get
gcc -L. -static -nostartfiles hello.o -lc -lnosys -o hello
/usr/local/i686-pc-linux-gnu/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048080
My newlib tgz contains no documentation at all. Is there somewhere
an additional tgz with documentation?
More information about the Newlib