these functions need implement even I not use them?

Colin Paul Gloster Colin_Paul_Gloster@ACM.org
Thu Jun 15 10:01:00 GMT 2006


On Wed, 14 Jun 2006, chingfu wrote:

"   I compiled a program but got these error at link as below :"

What command did you use to link?

"/opt/crosstools/mips/lib/gcc/mips-elf/4.1.0/../../../../mips-elf/lib/soft-float/libc.a(exit.o):
In function `exit':
/cross/src/gcc/newlib/libc/stdlib/exit.c:65: undefined reference to `_exit'
/cross/src/gcc/newlib/libc/stdlib/exit.c:65: relocation truncated to fit:
R_MIPS_26 against `_exit'
/opt/crosstools/mips/lib/gcc/mips-elf/4.1.0/../../../../mips-elf/lib/soft-float/libc.a(makebuf.o):
In function `__smakebuf':
/cross/src/gcc/newlib/libc/stdio/makebuf.c:96: undefined reference to
`isatty'
/cross/src/gcc/newlib/libc/stdio/makebuf.c:96: relocation truncated to fit:
R_MIPS_26 against `isatty'
/opt/crosstools/mips/lib/gcc/mips-elf/4.1.0/../../../../mips-elf/lib/soft-float/libc.a(sbrkr.o):
In function `_sbrk_r':
/cross/src/gcc/newlib/libc/reent/sbrkr.c:60: undefined reference to `sbrk'
/cross/src/gcc/newlib/libc/reent/sbrkr.c:60: relocation truncated to fit:
R_MIPS_26 against `sbrk'
/cross/src/gcc/newlib/libc/reent/sbrkr.c:60: relocation truncated to fit:
R_MIPS_GPREL16 against `errno'
/cross/src/gcc/newlib/libc/reent/sbrkr.c:60: relocation truncated to fit:
R_MIPS_GPREL16 against `errno'
/opt/crosstools/mips/lib/gcc/mips-elf/4.1.0/../../../../mips-elf/lib/soft-float/libc.a(writer.o):
In function `_write_r':
/cross/src/gcc/newlib/libc/reent/writer.c:58: relocation truncated to fit:
R_MIPS_GPREL16 against `errno'
/cross/src/gcc/newlib/libc/reent/writer.c:58: relocation truncated to fit:
R_MIPS_GPREL16 against `errno'
/opt/crosstools/mips/lib/gcc/mips-elf/4.1.0/../../../../mips-elf/lib/soft-float/libc.a(closer.o):
In function `_close_r':
/cross/src/gcc/newlib/libc/reent/closer.c:53: relocation truncated to fit:
R_MIPS_GPREL16 against `errno'
/cross/src/gcc/newlib/libc/reent/closer.c:53: relocation truncated to fit:
R_MIPS_GPREL16 against `errno'
/opt/crosstools/mips/lib/gcc/mips-elf/4.1.0/../../../../mips-elf/lib/soft-float/libc.a(fstatr.o):
In function `_fstat_r':
/cross/src/gcc/newlib/libc/reent/fstatr.c:62: undefined reference to `fstat'
/cross/src/gcc/newlib/libc/reent/fstatr.c:62: relocation truncated to fit:
R_MIPS_26 against `fstat'
/cross/src/gcc/newlib/libc/reent/fstatr.c:62: additional relocation
overflows omitted from the output
/opt/crosstools/mips/lib/gcc/mips-elf/4.1.0/../../../../mips-elf/lib/soft-float/libc.a(lseekr.o):
In function `_lseek_r':
/cross/src/gcc/newlib/libc/reent/lseekr.c:58: undefined reference to `lseek'
collect2: ld returned 1 exit status
make: *** [ras.exe] Error 1

   I not implement these functions because I not use them in my code."

You are not supposed to write this functions yourself because they are 
common functions which should already have been supplied by a library. You 
might not have called them explicitly, but something somewhere may call 
them, e.g. if your program can be terminated gracefully it may rely on 
exit.

Perhaps you did not successfully compile all of these library functions or 
perhaps you have simply neglected to link a necessary library. However, I 
notice that your libc.a contains lseekr.o but not lseek() so it seems to 
me that you have skipped something.

" Do I
implement these functions ?"

You should not have to.

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list