[uClinux-dev] Compiler question
lsorense at csclub.uwaterloo.ca
Fri Nov 12 12:00:00 EST 2010
On Fri, Nov 12, 2010 at 02:55:30PM +0000, Philip Nye wrote:
> Convention has it that to build a cross compiler from scratch you need to
> do it twice - stage-1 is a restricted version to build the target
> library, the stage-2 is a full generic compiler. However, I don't know
> the workings of GCC sufficiently well to fully understand this.
> In all my uClinux projects, I have the library (uClibc) integrated with
> the project and have it configured and compiled differently for different
> projects. I then point the compiler explicitly at the project's uClibc
> build using command line switches. (including -nostdlib etc.)
> In this situation is there any benefit to carrying out the second
> compiler pass? What about C++ - can that be built with the first stage
I believe the idea is that whatever compiler you start with might be buggy
and not work correctly to compile your new compiler, so a minimal stage1 c
compiler is built that is known to be able to build the compiler properly.
The stage1 compiler is then used to compile the actual full compiler.
It does seem like a good idea. After all if you were on HP-UX or Solaris
or AIX, who knows if the compiler installed on the system is capable of
actually compiling gcc at all. By only having to compiler the minimal
stage1 c compiler you avoid all those issues.
More information about the uClinux-dev