psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -L. -L/usr/local/ pspdev/psp/sdk/lib main.o -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspuser -lpspkernel -o exception.elf
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(exit.o): In function `exit':
../../../../../newlib/libc/stdlib/exit.c:65: undefined reference to `_exit'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(sbrkr.o): In function `_sbrk_r':
../../../../../newlib/libc/reent/sbrkr.c:60: undefined reference to `_sbrk'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(makebuf.o): In function `__smakebuf':
../../../../../newlib/libc/stdio/makebuf.c:96: undefined reference to `isatty'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(writer.o): In function `_write_r':
../../../../../newlib/libc/reent/writer.c:58: undefined reference to `_write'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(closer.o): In function `_close_r':
../../../../../newlib/libc/reent/closer.c:53: undefined reference to `_close'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(fstatr.o): In function `_fstat_r':
../../../../../newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(lseekr.o): In function `_lseek_r':
../../../../../newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(readr.o): In function `_read_r':
../../../../../newlib/libc/reent/readr.c:58: undefined reference to `_read'
collect2: ld returned 1 exit status
A script that automatically updates itself is a tricky thing to do as strange things can happen if a script changes while it is running.
Also, there's no easy way to pull fresh patches for binutils/gcc/newlib from the svn server so it really can't update those automatically either. However, we really make an effort to keep the psptoolchain package as up to date as possible. This isn't so bad as they don't change as often as pspsdk has been lately.
Luckily, a fresh version of pspsdk can be easily checked out of svn. This is why you can just type './toolchain.sh -p' to grab the latest version and install it. Most of the time this will be all you'll have to do.
Still, when in doubt... check for a newer version of the psptoolchain package. If you're running the latest then you're probably ok.
Shell scripts aren't read entirely into ram before being parsed.
If you add or remove a few characters in the middle of a script while its running then its pointer shifts. It may start parsing the next line halfway through and die - or worse.
How about if toolchain.sh never changes and all it does is pull down the newest do_toolchain.sh (where do_toolchain.sh would be the actual script that does the work) and run it?