Как добавить ctr0.o
?
Я получаю эту ошибку:
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`
при компиляции очень простой программы из здесь:
/* -- 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 */
Я видел эти 2 потока и не получил никакого полного и прямого ответа:
- http://www.raspberrypi.org/phpBB3/viewtopic.php?t=50046
- Каково обоснование удаления crt0.o из gcc4.7.x?
У меня есть эти файлы, в чем разница между crt0 и crtn, я не могу использовать его?
./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
Решение SO дает обходное решение, которое также не работает:
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