-
Notifications
You must be signed in to change notification settings - Fork 1
cosinusoidally/tcc_simple
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
tcc_simple UPDATE: see experiments/m2min_v3 for a working bootstrap path from a minimal C/JS compiler all the way up to a bootstrappable version of tcc. Original README (TODO update). This repo is essentially the hypothetical v2 version of: https://github.com/cosinusoidally/tcc_bootstrap_alt To build tcc_simple, in general you also need tcc_bootstrap_alt checked out in the parent directory eg: $ ls tcc_bootstrap_alt tcc_simple $ cd tcc_simple $ ./mk_coverage_simple_c The above should in theory work on many Linux systems, but you will need to have the 32 bit libc installed, plus a copy of gcc that supports -m32. Works fine on a i386 Ubuntu Bionic 18.04 chroot (except the gcovr step) or an Ubuntu Jammy 22.04 64 bit system with 32 bit libs installed. Note some of the mk scripts depend on the exitence of a prebuilt copy of a stock tcc-0.9.27 (specifically the release tarball from 2017). The coverage mk scripts depend on gcovr (they also try to start firefox from a specific path). You might need to tweak things slightly. The code in this repo is not yet complete, but the general plan is as follows: Strip down The Tiny C Compiler (tcc-0.9.27) into 2 versions: tcc_27_refactor - a cut down version of tcc-0.9.27 that is complete enough to compile tcc-0.9.27 tcc_simple_c - a cut down version of tcc_27_refactor that is only capable of compiling a cut down version of the C language. Specifically the language supported by M2_simple_asm.c (also included in this repo). Once tcc_simple_c and tcc_27_refactor are complete the next step is to create 2 bootstrap compilers: tcc_boot_min - tcc_simple_c ported to the M2_simple_asm.c dialect. Will also be self hosted. tcc_boot_max - tcc_27_refactor ported to the M2_simple_asm.c dialect. Will also be self hosted. The bootstrap process would then be as follows: hex0 - A "compiler" for commented hex dumps. See tcc_bootstrap_alt, the base bootstrap tools are from stage0-posix hex1 - A "compiler" for commented hex dumps with support for single character labels. hex2 - similar to hex1 but has support for larger labels, plus relative and absolute addressing modes. M0 - A simple macro language used to implement a simple assembler cc_x86 - a C compiler written in assembly (the version from tcc_bootstrap_alt). cc_x86_min.M1 or M2_simple_asm.M1 could also be used. M2_simple_asm - a C compiler written in the "simple_c" dialect. tcc_boot_min - cut down version of tcc-0.9.27 implemented in the simple_c dialect. Implements the simple_c dialect. tcc_boot_max - cut down version of tcc-0.9.27 implemented in the simple_c dialect. Implements a large enough subset of C in order to to compile tcc-0.9.27. tcc_27 - a nearly stock tcc-0.9.27 from tcc_bootstrap_alt . This version is capable of compiling a stock tcc-0.9.27. More importantly this version of tcc can also compile the GNU C compiler. Further, this version can even be plugged into live-bootstrap to replace the mescc steps. For reference, fork of live-bootstrap that uses tcc_bootstrap_alt instead of mescc: https://github.com/cosinusoidally/live-bootstrap/tree/tcc_bootstrap_alt-refactor_nov24 FAQs Why not go from cc_x86 straight to tcc_boot_max? It will be a bigger job to port tcc_boot_max to the simple_c dialect. By starting with tcc_boot_min I can prove out the process. In theory once tcc_boot_max is done it can then replace tcc_boot_min, but if there there are any issues then tcc_boot_min would serve as a useful intermediate stepping stone. Even if I fail to finish tcc_boot_max I should still be able to use tcc_boot_min to simplify tcc_bootstrap_alt. I could even potentially use the unfinished version of tcc_boot_max to eliminate some steps in tcc_bootstrap_alt.
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published