live-bootstrap icon indicating copy to clipboard operation
live-bootstrap copied to clipboard

Bootstrap TCC using pnut

Open laurenthuberdeau opened this issue 7 months ago • 7 comments

Context

This draft PR shows that pnut can provide an alternative path to TCC.

This is still work in progress as it currently need a prebuilt pnut-exe binary since the live-bootstrap environment doesn't provide a POSIX compliant shell when bootstrapping TCC . However, the binary can be built reproducibly from a POSIX shell with a script in the pnut repository per the instructions below.

Alternatively, the C subset used by pnut is relatively simple (only 1 struct that could be easily removed, very few dynamic memory allocations, no sizeof, everything is a signed integer or pointer) and could probably be ported to M2-Planet.

Prebuilt binary

To make the prebuilt pnut-exe binary:

> git clone [email protected]:udem-dlteam/pnut.git
> cd pnut
> git checkout origin/laurent/small-fixes-for-TCC
> ./utils/make-pnut-exe-for-tcc.sh --shell <shell> # To make pnut-exe with pnut-sh.sh
> ./utils/make-pnut-exe-for-tcc.sh # To make pnut-exe with pnut-exe-from-gcc

Getting the sources

Running ./download-distfiles.sh will download the .tar.gz file but Github will return 404 for the .tar, that's expected. To get the .tar, use gunzip distfiles/79832069f0d44c20a620a923a15e38a545c5e911.tar.gz.

laurenthuberdeau avatar Mar 31 '25 03:03 laurenthuberdeau