Cygwin cross compiler
Stephen Weeks
MLton@sourcelight.com
Wed, 13 Mar 2002 14:20:29 -0800
--IMkTSrqzIS
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit
> Among the options are:
> 1. update your kernel to 2.4
> 2. always run mlton with "@MLton fixed-heap XXX --" to force the heap size
> (and avoid the RAM lookup). You can edit the /usr/local/bin/mlton script
> to do this automatically
> 3. complain loudly to the MLton developers ;)
>
> I've lasted with option 2 for a while now. On the downside, you also need
> to include this option on any program compiled by MLton and run on a 2.2
> kernel, because the RAM lookup functions are in the runtime system which
> is linked into every program.
Yuck. We need to produce executables that work on 2.2. I just
checked in a fix, suggested by Henry a few weeks ago, but lost in the
shuffle.
If you are compiling on a 2.4 kernel, then at run-time check if
mem_unit is 0. If so, pretend it is 1 (and don't try to grab any
fields that were added in 2.4 kernels).
Anoq, here is a new gc.c file. Remake the runtime and try
hello-world.sml. If that works, go ahead and remake mlton. Or, I can
post new rpms.
--IMkTSrqzIS
Content-Type: application/octet-stream
Content-Disposition: attachment;
filename="gc.c"
Content-Transfer-Encoding: base64
LyogQ29weXJpZ2h0IChDKSAxOTk3LTE5OTkgTkVDIFJlc2VhcmNoIEluc3RpdHV0ZS4KICog
UGxlYXNlIHNlZSB0aGUgZmlsZSBMSUNFTlNFIGZvciBsaWNlbnNlIGluZm9ybWF0aW9uLgog
Ki8KCiNpbmNsdWRlICJnYy5oIgojaW5jbHVkZSA8ZXJybm8uaD4KI2luY2x1ZGUgPGZjbnRs
Lmg+CiNpbmNsdWRlIDxtYXRoLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPHN5
cy9tbWFuLmg+CiNpbmNsdWRlIDxzeXMvcmVzb3VyY2UuaD4KI2luY2x1ZGUgPHN5cy90aW1l
cy5oPgojaW5jbHVkZSA8dGltZS5oPgojaWYgKGRlZmluZWQgKF9fbGludXhfXykpCiNpbmNs
dWRlIDx2YWx1ZXMuaD4KI2VuZGlmCg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