Note, part of the problem is that EVERY MLton program links to mlton-lib.o, and thus you get it all (bad) and this includes a call to tmpnam(). This is part of the reason that linking statically creates such huge files. This really must be broken up into many small .c files.