Skip to content

Disable OpenBSD execute-only for NativeAOT stubs#129906

Merged
jkotas merged 1 commit into
dotnet:mainfrom
am11:patch-57
Jun 27, 2026
Merged

Disable OpenBSD execute-only for NativeAOT stubs#129906
jkotas merged 1 commit into
dotnet:mainfrom
am11:patch-57

Conversation

@am11

@am11 am11 commented Jun 26, 2026

Copy link
Copy Markdown
Member

The process was immediately terminating at startup; used AI to figure out that binary header having execute flag was causing the issue. --no-execute-only for the rescue.

am11@foo:~$ uname -a
OpenBSD foo.mshome.net 7.8 GENERIC.MP#54 amd64

am11@foo:~/projects/api1$ ~/projects/runtime/.dotnet/dotnet new webapiaot -n api1 && cd $_
am11@foo:~/projects/api1$ ~/projects/runtime/.dotnet/dotnet publish -p:PublishAot=true -o dist
am11@foo:~/projects/api1$ dist/api1
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /home/am11/projects/api1

# on second terminal
am11@foo:~$ curl -sSL http://localhost:5000/todos | jq
[
  {
    "id": 1,
    "title": "Walk the dog",
    "dueBy": null,
    "isComplete": false
  },
  {
    "id": 2,
    "title": "Do the dishes",
    "dueBy": "2026-06-22",
    "isComplete": false
  },
  {
    "id": 3,
    "title": "Do the laundry",
    "dueBy": "2026-06-23",
    "isComplete": false
  },
  {
    "id": 4,
    "title": "Clean the bathroom",
    "dueBy": null,
    "isComplete": false
  },
  {
    "id": 5,
    "title": "Clean the car",
    "dueBy": "2026-06-24",
    "isComplete": false
  }
]

Contributes to #124911.

@am11 am11 requested a review from MichalStrehovsky as a code owner June 26, 2026 19:38
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 26, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

@am11 am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 26, 2026
@am11

am11 commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

I have verified this works for both runtime's cross-build and PublishAot on the machine with the SDK.

OpenBSD uses patched lld linker in their tree, i.e. this hook isn't present in llvm's upstream https://github.com/openbsd/src/blob/9c6c7d7423d3065e68bbc75a33cb39f7775a364a/gnu/llvm/lld/ELF/DriverUtils.cpp#L241; which allows it to scan libinotify.so.* etc. using wildcard lookup. The upstream linker only looks for .so suffix https://github.com/llvm/llvm-project/blob/34d2a6d344a03cbad64d7d74dbc99cd47d23f9eb/lld/ELF/DriverUtils.cpp#L246. Therefore, we are using fixed version (as their ABI versions don't change often) to keep things simple and satisfy both cross-build (upstream) and native OS' lld flavors.

cc @jkotas, @sethjackson

@jkotas

jkotas commented Jun 27, 2026

Copy link
Copy Markdown
Member

/ba-g infrastructure timeouts

@jkotas jkotas merged commit 62bb596 into dotnet:main Jun 27, 2026
125 of 129 checks passed
@am11 am11 deleted the patch-57 branch June 27, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member os-openbsd OpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants