Re:TCC – Tiny C Compiler
by buserror on Monday September 18, 2017 @05:27AM
(#15274439)
I'm a huge fan of tcc. I use it on embedded systems -- a good trick is to pre-process any headers you need via cpp preprocessor, 'compress' them in a single file, and add your .c to that. That way you don't need to cart around all the -dev packages etc.
The 'hidden gem' of tcc is libtcc (the backend), which you can use as a JIT subsystem in your own code. For example I've written a full JIT translator for simavr [0] like that. The code translates each AVR opcode into it's own little piece of C, then compile the whole 'firmware' and runs it.
The 'hidden gem' of tcc is libtcc (the backend), which you can use as a JIT subsystem in your own code. For example I've written a full JIT translator for simavr [0] like that. The code translates each AVR opcode into it's own little piece of C, then compile the whole 'firmware' and runs it.
[0]: https://github.com/buserror/simavr/tree/wip/jit