[Gc] tcc & boehm_gc

Fergus Henderson fjh@cs.mu.oz.au
Mon, 10 Feb 2003 03:00:24 +1100

I've been testing tcc, the Tiny C Compiler
<https://fabrice.bellard.free.fr/tcc/>, for use with the Mercury compiler
<https://www.cs.mu.oz.au/mercury/>, which compiles to C.  Unfortunately,
however, tcc is not yet suitable for use with Mercury, because the Boehm
conservative collector <https://www.hpl.hp.com/personal/Hans_Boehm/gc/>,
which we use for Mercury, does not work when compiled with tcc.

There are several problems.  One is that tcc does not define __ELF__.
This of course can be worked around by compiling with `-D__ELF__'.
Another is related to the collector's use of `_DYNAMIC'.  With
gcc/binutils, `_DYNAMIC' is a linker-defined symbol that does not seem
to be defined when linking with tcc.  But even if I use gcc to do the
final link, so that `_DYNAMIC' gets defined, the `gctest' program fails,
with the error message "List reversal produced incorrect list -
collector is broken".

I don't know whether the problem is a non-portability in the Boehm
collector or a bug in tcc.  But either way, this one is a show-stopper
for using tcc for Mercury.

Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <https://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.