This appears to be a problem with allocating memory for the stack.  The
call to mmap is failing with EINVAL but I can't see why.  It's line 407
in libpolyml/osmemunix.cpp which adds MAP_STACK to the arguments.  This
is necessary for OpenBSD which segfaults if the stack is not allocated
with MAP_STACK but commenting it out in FreeBSD seems to solve the problem.

So it is anything but 'insufficient memory' (I suspected ENOMEM).
EINVAL there is because sysctl security.bsd.stack_guard_page default value
is 1, which means that at least one page of the stack is reserved as guard.
Kernel does not allow to map stack that would have no data pages (all pages
are guard).

Your mapping request is for one page, and one page is due to guard, so
you get EINVAL.  Generally MAP_STACK is magic and requires caller to know
what it does.

I've changed this so that MAP_STACK is only used on OpenBSD where it is necessary and appears to be happy with a single page.
./configure --disable-shared && make && make compiler
now works on FreeBSD 32 without needing any other options.

David

_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to