Can TCC be modified to compile with Emscripten? If not, where can I find an x86-generating C compiler that does?

StackOverflow https://stackoverflow.com/questions/16418669

Question

After unzipping tcc-0.9.26, I edit configure to point at emcc instead of gcc and at emar instead of ar. Next, I uncomment the include of ucontext in tcc.h since it seems to be needed only for tccrun. Now I disable all the builtins (sub_ddmmss and so on) in lib/libtcc1.c, but I get an error because Emscripten tries to compile an assembly source file (an implementation of alloca), and I don't know how to get around that.

Was it helpful?

Solution

The functions implemented in assembly are much more fundamental, and are required by tcc. They are not optional in the sense you can remove them with a define or a comment. You can of course modify tcc itself not to use them, but you will have to provide your implementation of the functions you removed. So the only way to compile tcc with a non gcc/clang compiler is to significantly modify it or reimplement assembly functions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top