pts / pts-pcc

a self-contained port of PCC to Linux i386

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pts-pcc: a self-contained port of PCC to Linux i386

pts-pcc is a self-contained port of PCC (Portable C Compiler) to Linux i386. Self-contained means that the driver, preprocessor and compiler are in the same executable program, so they don't have to find each other. pts-pcc also contains some bugfixes and convenience features.

pts-pcc is based on PCC 1.1.0 (released on 2014-12-10). Important changes:

  • The pcc, cpp and ccom executables were merged, all into pcc. It still calls fork(2), but instead of exec(...), it runs another main(...) function in the child process. This makes it easier to ship PCC, because now it's a single executable, and there is no need to set up the $PATH if only assembly .s output is needed (with -S). (For ELF object .o output, it still needs GNU as(1) (as) on $PATH.)

  • Some bugs were fixed (see bugfix in the commit history).

  • Some convenience features were added, such as the -ansi flag (currently it doesn't do anything).

  • The original build system using Makefiles were replaced with a single shell script, rebuilding th project in one C compiler run.

  • It has been ported to many compilers in addition to GCC and Clang: TinyCC and OpenWatcom. (Of course PCC is still able to compile itself.)

  • Lots of GCC and OpenWatcom compilation warnings have been pacified (i.e. fixed, eliminated). Now it compiles cleanly, without warning. See compile.sh for details.

  • Some warnings flags were added for GCC compatibility, e.g. -Wextra, and for GCC 4.1: -Werror-implicit-function-declaration (without an = in the middle).

  • Implementation of BSD-specific functions (strlcpy(3) and strlcat(3)) were added.

  • Floating point calculations were rewritten in assembly language (this is optional), so C compilers without long double support (e.g. OpenWatcom) targeting i386 can compile PCC, and the thus compiled PCC will have long double support with correct constant folding.

To compile it, run these commands without the leading $:

$ git clone --depth 1 https://github.com/pts/pts-pcc
$ cd pts-pcc
$ ./compile.sh
...
$ ./pts-pcc
$ pccbin/pcc -v
pts-pcc 1.1.0 20141014 + 20230707 for i386-pc-linux-gnu
error: no input files

About

a self-contained port of PCC to Linux i386


Languages

Language:C 90.4%Language:Yacc 4.4%Language:Lex 2.7%Language:Roff 2.1%Language:Shell 0.3%