On Mon, 6 Jul 2026 at 14:41, Charlie Gordon <[email protected]> wrote:
>
> John,
>
> I am also curious about the historical side of the story. Do we know what 
> compiler Fabrice Bellard actually used to build the original OTCC release, 
> and whether that bootstrap path has ever been documented? I'm interested both 
> from a historical perspective and because it seems like an important part of 
> understanding TinyCC's origins.
>
> The answer is quite simple: Fabrice used gcc to compile the original OTCC 
> project, as well as TinyCC itself.
> He used gcc 2.95 to compile the code, but not as a source of ideas for how to 
> implement it!  He always starts
> from a blank page for his projects, writing down just a few ideas regarding 
> architecture and implementation and
> off he goes writing code and marking achievements by crossing out the 
> corresponding line on his paper roadmap.

I've found that otcc will actually compile with even older versions of
gcc. The earliest version I've tested is gcc 1.27 (circa 1988). This
make sense as otcc implements a tiny subset of C.

Thanks for the interesting insight into the development process. Do
you know if the paper design docs/roadmap still exist? Might be of
interest to new contributors. Having said that I assume they may not
be suitable for distribution if they were never written in a style
intended to be read by others.

> Fabrice must have been a bit frustrated by the many restrictions he had to 
> settle for in OTCC so he kept working
> on the compiler that later became TinyCC.  We had been working on a single 
> pass javascript interpreter and he
> insisted on the same approach in TinyCC.

Is that a single pass javascript interpreter you were writing in 2001
or are you referring to your quickjs project?

> I cannot remember the exact dates, but the IOCCC announced the 2000 awards on 
> Dec 1st 2000 and opened the submissions for the 2001 awards from Oct 1st to 
> Dec 1st 2001.
> OTCC announced its 2001 award winners on March 8, 2002.
> I have a version 0.9.1 version of TInyCC without floating point support dated 
> Dec 2nd, 2001 (just after the deadline for the IOCCC 2001 submissions)

When tcc was migrated from CVS to git it also migrated the CVS
commits. For example, I think this will be approximately tcc-0.9.1
https://github.com/TinyCC/tinycc/tree/a88b855866a1bb85e6eed52de1bc555f23ae8b53
(2nd of December 2001).

In terms of bootstrapping tcc, I created a project that chained
together multiple releases of tcc in order to build all the way up to
tcc-0.9.27. The earliest version I was able to start with was 0.9.2.
From looking through some of the commit messages I can see that
Fabrice was aware of bootstrapping (I think he mentions it when he
introduced long long support, and how that breaks bootstrapping from
earlier versions) but it doesn't appear to have been an explicit goal.
When I was constructing my chain of tcc versions I landed on:

0.9.2 -> 0.9.3 -> 0.9.10 -> 0.9.23 -> 0.9.24 -> 0.9.26 -> 0.9.27

I also had to patch multiple versions since they couldn't build
subsequent versions out of the box. I then went further and cut an
integer only "0.9.2m" variant. After that I cut some 0.9.1.X releases
that used fewer and fewer language features. Finally I cut a
JavaScript version (which was close enough to C that it could be
mechanically translated back to C). This allows me to build all the
way up to tcc-0.9.27 starting from either a minimal C compiler (like
cc_x86 from stage0-posix) or a JavaScript VM. The project is here:

https://github.com/cosinusoidally/tcc_bootstrap_alt

There are too many tcc versions in my project but it may be a useful
reference to see how a bootstrap chain can be constructed for tcc.
There are other shorter bootstrap paths available (which have been
mentioned in this thread) and there is also my tcc_simple project on
github (which replaces most of the tcc versions with a JS port of the
pnut C99 compiler that is simultaneously valid C and JS).

Going back to the original thread subject. I did try compiling tcc
with gcc in ansi mode. This fails because of the single line //
comments and (iirc) a couple of other gnuisms in the codebase. I think
the reality is the current codebase is implemented in a subset gnu89.
Having said that I found that I could not get gcc-2.95 to build mob.
Would it maybe be worth tightening up the codebase to be valid ANSI C
code, or at least the subset of ANSI C that is also valid C99, C11,
C++, etc? That would increase the number of compilers that can build
tcc.

Thanks
Liam

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to