Cross-compiling MIPS programs...

Michael K. Elwood, QSI Corporation, ,
Mon Jun 4 16:03:00 GMT 2001

David Morris wrote:

> All the assembly code and c code compiles fine, but linking fails.
> The error is one listed in the faq, and seen many times on the
> list:
> -------------------------
> /usr/gnu/test/mips-idt-ecoff/mips-idt-ecoff/lib/libc.a(makebuf.o): In function ` __smakebuf':
> /usr/share/src/elf/build-gcc-2.95.3-mips-idt-ecoff/mips-idt-ecoff/newlib/libc/stdio/../../../../../gcc-2.95.3/newlib/libc/stdio/makebuf.c:93:undefined reference to `isatty'
> /usr/share/src/elf/build-gcc-2.95.3-mips-idt-ecoff/mips-idt-ecoff/newlib/libc/stdio/../../../../../gcc-2.95.3/newlib/libc/stdio/makebuf.c:93:relocation truncated to fit: JMPADDR isatty
> -------------------------
> And so on.
> In the FAQ, it says the problem is that on some targets (apparently
> mips included) the isatty, open, close, write, etc. routines are not
> in libc.a, as per the normal, and machine-specific routines must be
> linked in from libgloss libraries.
> Well, I have looked through and tried linking all libraries I can
> find, but nothing works.  I have tried dozens of suggestions from this
> list's archives, and from web searches, and nothing seems to work.
> Can anyone who has dealt with mips cross-compilers help out and tell
> me what is wrong here?  Am I missing a library that must be linked in?
> Did I mis a step in compiling the compiler itself?  I tried using the
> mips-elf target as well for the cross compilation of gcc with the same
> result...

I thought you were going to answer your own question for a minute :)

We have a MIPS cross-gcc that we use all the time (it's for Toshiba
TX39 targets). We link against libnosys.a which is built from the
libgloss sources and contains stubs for the functions you mentioned
above. They don't do anything interesting, so if you want open, close,
write, etc. to do something useful, you'll have to look elsewhere or do 
some coding. HTH!

With best regards,

Michael K. Elwood           
QSI Corporation

The fourth(?) Law of Thermodynamics:
      (Work in Theory) <= (Work in Practice)

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list