Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlton-script: OpenBSD link-opt for no xonly text #555

Merged
merged 1 commit into from
Mar 28, 2024

Commits on Mar 28, 2024

  1. mlton-script: OpenBSD link-opt for no xonly text

    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.
    
    Fixes MLton#538
    
    Signed-off-by: Dan Cross <cross@gajendra.net>
    Dan Cross committed Mar 28, 2024
    Configuration menu
    Copy the full SHA
    e2e3227 View commit details
    Browse the repository at this point in the history