public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* cannot find crt0.o file
@ 2022-03-25 10:30 Dalas Yoo
  2022-03-25 10:58 ` R. Diez
  2022-04-08 14:05 ` Richard Earnshaw
  0 siblings, 2 replies; 4+ messages in thread
From: Dalas Yoo @ 2022-03-25 10:30 UTC (permalink / raw)
  To: newlib

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cannot find crt0.o file
  2022-03-25 10:30 cannot find crt0.o file Dalas Yoo
@ 2022-03-25 10:58 ` R. Diez
  2022-03-25 12:10   ` Dalas Yoo
  2022-04-08 14:05 ` Richard Earnshaw
  1 sibling, 1 reply; 4+ messages in thread
From: R. Diez @ 2022-03-25 10:58 UTC (permalink / raw)
  To: Dalas Yoo; +Cc: newlib


> [...]
> 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".

This is a common annoyance with GCC for ARM. I filed a request about it more than 5 years ago:

Bug 68605 - Add -mno-crt0 to disable automatic crt0 injection
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68605

I normally just add an empty file called crt0.c (or crt0.cpp) to my project, search for it here:

https://github.com/rdiez/JtagDue/blob/master/Project/Makefile.am

The comments around it should provide you with enough information.

Regards,
   rdiez

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cannot find crt0.o file
  2022-03-25 10:58 ` R. Diez
@ 2022-03-25 12:10   ` Dalas Yoo
  0 siblings, 0 replies; 4+ messages in thread
From: Dalas Yoo @ 2022-03-25 12:10 UTC (permalink / raw)
  To: R. Diez; +Cc: newlib

Interesting.

Thanks for your help!

Regards,
Dalas



2022년 3월 25일 (금) 오후 7:58, R. Diez <rdiezmail-newlib@yahoo.de>님이 작성:

>
> > [...]
> > 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".
>
> This is a common annoyance with GCC for ARM. I filed a request about it
> more than 5 years ago:
>
> Bug 68605 - Add -mno-crt0 to disable automatic crt0 injection
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68605
>
> I normally just add an empty file called crt0.c (or crt0.cpp) to my
> project, search for it here:
>
> https://github.com/rdiez/JtagDue/blob/master/Project/Makefile.am
>
> The comments around it should provide you with enough information.
>
> Regards,
>    rdiez
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cannot find crt0.o file
  2022-03-25 10:30 cannot find crt0.o file Dalas Yoo
  2022-03-25 10:58 ` R. Diez
@ 2022-04-08 14:05 ` Richard Earnshaw
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Earnshaw @ 2022-04-08 14:05 UTC (permalink / raw)
  To: Dalas Yoo, newlib



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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-08 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-25 10:30 cannot find crt0.o file Dalas Yoo
2022-03-25 10:58 ` R. Diez
2022-03-25 12:10   ` Dalas Yoo
2022-04-08 14:05 ` Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).