[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] tcc bootstrap
From: |
Patrick Lauer |
Subject: |
Re: [Tinycc-devel] tcc bootstrap |
Date: |
Mon, 10 Mar 2014 07:27:44 +0800 |
User-agent: |
KMail/4.12.3 (Linux/3.13.1-gentoo; KDE/4.12.3; x86_64; ; ) |
On Sunday 09 March 2014 17:12:11 Christian Jullien wrote:
> Hi all,
>
> This is just a question I'm doing for myself.
>
> Currently, when you do a ./configure; make you generate a tcc that is a gcc
> compiled program implementing a tcc compiler. So far so good. The challenge
> for a compiler is to compile itself.
> Long ago, you were able to bootstrap gcc with any decent C compiler. The
> process was the following:
>
> - use alien C to produce a subset of gcc (xgcc if I recall well)
> - use xgcc to compile a first working gcc
> - use this interim gcc to produce final gcc.
>
> Now the questions:
> - Why tcc remains a gcc compiled code?
Not sure if there's any deep reason behind it -
* tcc started as a self-compiling demonstrator
* most people don't care (and even gcc often isn't 'properly' bootstrapped)
* in between (iirc before the 0.9.26 release) tcc was not well handled and
unlearned to build itself. Mostly because of Makefile stupidity calling gcc
directly and such funny things
* recent tcc can self-compile properly
> - Corollary, can we use this tcc binary on a machine gcc free?
That depends on if it links to the libgcc bits. I think that's a configure
option?
> - Do we want a tcc compiler compiled by tcc (an extra step can easily do
> that)?
Upside: It's a good demonstration that tcc is functional (especially if you do
the classical triple bootstrap and run the testsuite)
Downside: Increases compile time (up to ... almost 5 seconds! ;) ), adds more
complexity to the Makefiles, ...
Maybe it would be useful as a Makefile target?
> Ok, using gcc -O3 you can generate a tcc that compiles faster any program
> than tcc compiled with itself.
That is mildly funny, but not unexpected ...
Have fun,
Patrick