BrianSidebotham/arm-tutorial-rpi

gcc version 9.2.1 20191025 (release) Regression - armc-00.c

gkankanh opened this issue · 3 comments

Thanks for a fantastic tutorial. Just want to let you know that the newest version of arm-none-eabi-gcc fails to compile arm-00.c with an undefined reference to _exit.[gopal] ~/projects/oldRaspBerryPI/arm-tutorial-rpi/part-1/armc-00 > ./build.sh
usage: build.sh
pi-model options: rpi0, rpi1, rpi1bp, rpi2, rpi3, rpi4, rpibp
[gopal] ~/projects/oldRaspBerryPI/arm-tutorial-rpi/part-1/armc-00 > ./build.sh rpi1
arm-none-eabi-gcc -mfloat-abi=hard -mfpu=vfp -march=armv6zk -mtune=arm1176jzf-s /Users/gopal/projects/oldRaspBerryPI/arm-tutorial-rpi/part-1/armc-00/*.c -o /Users/gopal/projects/oldRaspBerryPI/arm-tutorial-rpi/part-1/armc-00/kernel.armc-00.rpi1.elf
/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/arm/v5te/hard/libc.a(lib_a-exit.o): in function exit': exit.c:(.text.exit+0x2c): undefined reference to _exit'
collect2: error: ld returned 1 exit status
ERROR: Failed to compile!

armc-01.c builds fine

Greetings gkankanh!

Per the tutorial at https://www.valvers.com/open-software/raspberry-pi/bare-metal-programming-in-c-part-1/ the error from the linker is the expected outcome. The author (Brian) uses the failure to illustrate the need for there to be an _exit routine, even if it's just a spin-loop.

And may-Brian-forgive-me if I'm getting this wrong. :-) Cheers!

@gkankanh as per @rwdavis3rd comment, this is expected behaviour. But if you're like me and tend to skim-read things it probably seems like a failure until you read on a bit further.