gccarchitecturecompiler-constructionbootstrapping

Why does GCC compile itself 3 times?


I have compiled GCC from source but I can't seem to fully understand the utility of gcc compiling itself three times.

What benefit does this serve ?

This answer says:

  • Build new version of GCC with existing C compiler
  • re-build new version of GCC with the one you just built
  • (optional) repeat step 2 for verification purposes.

Now my question is that once the first step is complete and the compiler is built why waste time rebuilding it ?

Is it just for verification ? If so, it seems pretty wasteful.

Things get more complicated over here,

The build for this is more complex than for prior packages, because you’re sending more information into the configure script and the make targets aren’t standard.

I mean the whole compiler is written in C right, so why not just do everything in one pass ?

What is the use of the 3-phase bootstrap ?

Thanks in advance.


Solution

  • If you prefer non-bootstrap for some reason, configure --disable-bootstrap.