[Gc] alloca() vs lcc

Fergus Henderson fjh@cs.mu.oz.au
Mon, 3 Nov 2003 02:16:53 +1100


We recently upgraded to gc-6.3alpha2 (from 6.2alpha4).
When I try to compile the collector with lcc, which previously used to work,
we get the following link error:

../boehm_gc/libgc.a(os_dep.o): In function `GC_apply_to_maps':
os_dep.o(.text+0x12f): undefined reference to `alloca'

This is because lcc does not define alloca().
Any suggestions?

The normal procedure for solving this would be to replace calls to
alloca() with calls to malloc(), but I don't think that is safe here.
There is a comment in GC_apply_to_maps() saying "Note that we may
not allocate", presumably because it might cause problems in the
case when malloc() is redirected to GC_malloc() or GC_malloc_atomic().

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: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.