This is the mail archive of the
mailing list for the newlib project.
Re: Question : i386's crt0 ?
- From: Jeff Johnston <jjohnstn at redhat dot com>
- To: newlib at sourceware dot org
- Date: Mon, 29 Apr 2013 12:51:44 -0400
- Subject: Re: Question : i386's crt0 ?
- References: <CAFAwnGP8Xp752=rKFOFBpuD89cqRhMooYcmSeO_1u9sZZeaRAA at mail dot gmail dot com>
On 04/22/2013 03:26 PM, Julio Guerra wrote:
I am trying find out why crt0.S is not provided for i386 target as it
is the case with, for example, powerpc's. If we consider it is
supposed to initialize the C runtime, I don't understand why I should
write it myself since every i386's crt0 will do the same : stack
pointer initialization, constructor calls, etc. I really need hints
about that, it looks like I missed something...
Thank you !
Well, the short answer is that no one has submitted one.
The long answer is that historically, newlib started out as a C Library
for embedded tool ports by Cygnus Solutions. Native platforms such as
i386 Linux were expected to use glibc with gcc supplying crt0.o.
An x86-linux port has been added for for newlib (see libc/sys/linux) if
you are using Linux. There is also a Cygmon port of libgloss in
So, you could certainly put something together from the Cygmon
cygmon-crt0.S or use the crt0.o from gcc (which the sys/linux port uses).
For the other minimum newlib syscalls required, you can use libnosys if
you do not have an OS. This will create failure stubs for most things
except for sbrk which expects you to set up a variable in your linkage
script. For _exit, you can cause an exception to occur (e.g. divide by
-- Jeff J.