title: How to resolve crt0.o linking issue in cross compiling?
body: <p>How to add <code>ctr0.o</code> ? </p>
  
  <p>I get this error:</p>
  
  <pre><code>yagarto-4.7.2/bin/arm-none-eabi-ld: cannot find crt0.o: No such file or directory
  collect2: error: ld returned 1 exit status`
  </code></pre>
  
  <p>while compiling very simple program from <a href="http://thinkingeek.com/2013/01/09/arm-assembler-raspberry-pi-chapter-1/" rel="noreferrer">here</a>:</p>
  
  <pre><code>/* -- first.s */
  /* This is a comment */
  .global main /* 'main' is our entry point and must be global */
  .func main   /* 'main' is a function */
  
  main:          /* This is main */
      mov r0, #2 /* Put a 2 inside the register r0 */
      bx lr      /* Return from main */
  </code></pre>
  
  <p>I have seen these 2 threads and didn't get any full and straight forward answer:</p>
  
  <ol>
  <li><a href="http://www.raspberrypi.org/phpBB3/viewtopic.php?t=50046" rel="noreferrer">http://www.raspberrypi.org/phpBB3/viewtopic.php?t=50046</a></li>
  <li><a href="https://stackoverflow.com/questions/16981704/what-is-the-rationale-behind-removing-crt0-o-from-gcc4-7-x">What is the rationale behind removing crt0.o from gcc4.7.x?</a></li>
  </ol>
  
  <p>I have these files, what is the difference between crt0 and crtn can't I use it?</p>
  
  <pre><code>./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crtbegin.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crtend.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crti.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crtn.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crtbegin.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crtend.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crti.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crtn.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtbegin.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtend.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crti.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtn.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crtbegin.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crtend.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crti.o
  ./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crtn.o
  </code></pre>
  
  <p>The SO solution gives a workaround which doesn't work either:</p>
  
  <pre><code>arm-none-eabi-gcc -o first assembler_tutorial/chapter01/first.o -nostartfiles
  ./yagarto-4.7.2/bin/arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000
  </code></pre>