cannot find crt0.o file

Richard Earnshaw Richard.Earnshaw@foss.arm.com
Fri Apr 8 14:05:41 GMT 2022



On 25/03/2022 10:30, Dalas Yoo wrote:
> Hello, I tried to build a newlib for cross-compile toolchain.
> 
> I configured it as below.
> 
> ../newlib/configure --disable-newlib-io-float
> --disable-newlib-supplied-syscalls --target=arm-none-eabi
> 
> With the configuration, the newlib was successfully built. But when trying
> to compile and link the program, the arm-none-eabi-gcc prints error "crt0.o
> not found".
> When searching the newlib lib directory, crt0.o file is not found though
> other types of crt0.o are found such as rdimon-crt0.o.
> 
> If the arm-none-eabi-gcc gets applied with --specs=rdimon.specs options, it
> compiles the program fine.
> But if the newlib is configured without --disable-newlib-supplied-syscalls,
> it normally generates crt0.o.
> 
> Would there be any suggestions on this case?
> Thanks,
> Dalas

Newlib is constructed in a way that allows significant customization for 
different boards.  Most of that customization lives in libgloss (if you 
build newlib with the embedded syscalls then you lose all that ability 
to customize for your own platform).

When you target the 'bare metal' for a specific board you will likely 
need to do your own customization and provide your own startup code to 
handle the very first few operations of your program.  The code in 
libgloss can then act as a guide for what you need to do.  In particular 
you will likely need to write a customized gcc driver script.  Some 
examples come with libgloss, such as rdimon.specs which is a 
customization for using newlib with Arm's semihosting protocol.  There 
are other examples, such as one using redboot as well.

R.


More information about the Newlib mailing list