On Mon, 17 Oct 2011 08:55:42 +0100, Simon Marlow <[email protected]> wrote: > I think if we just add those functions to the table unconditionally, it > may break the C backend on certain other platforms or perhaps other > versions of gcc. I agree it should work out of the box, but we did not > need this change in the past, so why is it necessary now? > > We need to identify exactly where this change is necessary. Perhaps it > is a recent change in gcc? If so, we need to know which version. > Fair enough. A little bit of Googling confirmed that GCC does tree malloc, et al. as builtins[1]. It seems the correct approach here might be to instead pass the -fno-builtin option[2] to gcc. This hides, e.g., malloc() while keeping the function available as __builtin_malloc(). I still don't know what version of GCC turned malloc() into a builtin, but the -fno-builtin option has been around since before gcc 4.0.4 (didn't check earlier versions) so it should be safe. If we want a more minimal change, we can just pass "-fno-builtin-free -fno-builtin-realloc -fno-builtin-malloc" to only exclude these functions.
Cheers, - Ben [1] http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html [2] http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
