Add a -target-link-opt for OpenBSD that disables "xonly" text.
OpenBSD's linker, by default, makes a program's text segment executable-only ("xonly"): that is, executable but not readable. However, MLton needs to be able to read the text segment when mapping return addresses to stack frame indices, possibly among other things. This causes programs compiled with MLton's native code generator to fault and die with SIGSEGV.
However, the default "xonly" behavior can be disabled with a linker option (--no-execute-only), so we can turn it off with a -target-link-opt specific to OpenBSD in mlton-script. Binaries built in this configuration run as expected.
Add a
-target-link-opt
for OpenBSD that disables "xonly" text.OpenBSD's linker, by default, makes a program's text segment executable-only ("xonly"): that is, executable but not readable. However, MLton needs to be able to read the text segment when mapping return addresses to stack frame indices, possibly among other things. This causes programs compiled with MLton's native code generator to fault and die with
SIGSEGV
.However, the default "xonly" behavior can be disabled with a linker option (
--no-execute-only
), so we can turn it off with a-target-link-opt
specific to OpenBSD inmlton-script
. Binaries built in this configuration run as expected.Fixes #538