This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question : i386's crt0 ?


On 04/22/2013 03:26 PM, Julio Guerra wrote:
Hi everyone,

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 !

--
Julio Guerra


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 libgloss/i386.

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 zero).

-- Jeff J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]