Configuring for bare hw ia32 PC's

duane ellis
Tue May 13 13:49:00 GMT 2008

duane> If you look at the makefile - it builds GCC in 2 stages stage 1 - is
duane> just a straight up C compiler, nothing else. No standard library. 
duane> should be enough to build your kernel as I describe.

jonathan> I gree, though I recommend building the kernel with the second
jonathan> round gcc. [snip]


jonathan> Yes. But having done that, don't try to use stage1 GCC to 
build your
jonathan> kernel. Use stage2 GCC for everything, if only to reduce the 
number of
jonathan> variants of tools that can hurt you.

Wait - hold on for a second.

The stage1 GCC has *zero* header files, and only 'libgcc'.

White lie: GCC supplied <limits.h> and <stddef.h>  are present
(look in the 'lib' directory)

The benefit here is there is no accidental #include of a user space 
header file. Yes, you can do the same with "--nostdinc" and other
command line hackery :-(

It really depends on your needs, fears, etc. Perhaps my fear is over 
blow - why? Because linux x86 builds with "gcc" - the default compiler
and uses the "--nostdinc" trick.

BTW - you might also want to check out the -fnobuiltin options.


More information about the Newlib mailing list