newlib libc.a (linkr.o) problem: unresolved symbol '_link'

J. Johnston
Tue Nov 28 16:06:00 GMT 2000

Emanuel wrote:
> hy all,
> i really tried hard to find info on this somewhere on the net, but something
> seems
> to be really strange about the reentrant link functions in my version of
> newlib,
> specifics:
>  - cygwin latest
>  - newlib 1.8.2 compiled for sh4 without troubles
> i was able to happily link all sorts of programs before, but now that I
> tried
> the snes9x code, although compiling just fine, it stops linking with one
> unresolved external that I cannot really track down, since I think it is
> internal
> to newlib itself, have a look:
> /usr/local/sh-elf/lib/ml/m4-single-only/libc.a(linkr.o): In function
> `link_r':
> ../../../../../../../newlib-1.8.2/newlib/libc/reent/linkr.c:64: undefined
> reference
> to `_link'
> I am not very familiar what these do in newlib, so if anyone can give me any
> hints
> on how to resolve that, it would be greatly appreciated!
> thanks a lot, and keep up the great work on newlib
> Emanuel


  Newlib is designed to sit on top of a system call interface.  In some cases,
the calls are provided for you in libgloss or in the libc/sys directory.  In the
case of sh-elf, the syscalls are provided in libc/sys/sh/syscalls.c.  There
is no _link provided.

  I have attached a patch to create a stub for _link in newlib/libc/sys/sh/syscalls.c that 
should solve your problem.  Go to newlib/libc/sys/sh and apply the patch, then rebuild
and install.

-- Jeff J.
Index: syscalls.c
RCS file: /cvs/src/src/newlib/libc/sys/sh/syscalls.c,v
retrieving revision
diff -u -r1.1.1.1 syscalls.c
--- syscalls.c	2000/02/17 19:39:50
+++ syscalls.c	2000/11/29 00:02:01
@@ -37,6 +37,12 @@
   return __trap34 (SYS_close, file, 0, 0);
+_link (char *old, char *new)
+  return -1;
 _sbrk (int incr)

More information about the Newlib mailing list