7

I am trying to upgrade to yagarto4.7.2 (Yet Another GNU ARM toolchain, for those wondering), which is gcc and binutils, ported for Windows. However, trying to compile a simple Hello World yields:

c:/yagarto-20121222/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi
/bin/ld.exe: cannot find crt0.o: No such file or directory
collect2.exe: error: ld returned 1 exit status

Now, in this forum it is made clear that this is the startup initialziation library, that was removed after gcc4.6.x. Two solutions are proposed:

  • compile with -nostartfiles
  • copy the crt0.o form the 4.6.x to the 4.7.x folder

Both look quite dirty and unacceptable for production code. So does anyone know why was this library removed and what is it's equivalent now?

Vorac
  • 8,726
  • 11
  • 58
  • 101
  • 1
    Some key facts about *yargarto*; a *mingw* based *newlib* compiler, pre-built. See: [SO gcc newlib questions](http://stackoverflow.com/search?q=[gcc]+newlib+is%3Aquestion). It is possible to build this type of compiler with [crosstool-ng](http://crosstool-ng.org/), but is extremely difficult as it is a *Canadian cross*. – artless noise Jun 10 '13 at 14:54
  • 1
    http://stackoverflow.com/questions/18416564/how-to-solve-the-crt0-o-issue-in-cross-compiling – 0x90 Aug 24 '13 at 09:05

1 Answers1

3

crt0.o is derived from crt0.s, which is provided by the OS. In the case of bare metal setup, this file must be provided by the implementation. It contains startup and exit code, for example for zeroing the .bss.

Rob Gilton
  • 401
  • 4
  • 16
Vorac
  • 8,726
  • 11
  • 58
  • 101
  • 1
    Not so silly - it generated discussions on a forum, which you've provided a link to. SO also functions as a knowledge base, and you should feel free to accept your own answer. – Brett Hale Jun 08 '13 at 01:37
  • 2
    Documentation on these funtions: [Newlib syscalls](http://sourceware.org/newlib/libc.html#Syscalls) including *minimal* implementations. – artless noise Jun 10 '13 at 15:02
  • So where did you got crt0.s for what OS? – harper Jul 10 '13 at 07:57
  • @harper, see the above comment by **artless noise** for instructions how to write your own. – Vorac Jul 10 '13 at 08:19