Skip to content

Support miri-specific entry point / start function for no-std binaries #3758

New issue

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

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

Already on GitHub? # to your account

Closed
RalfJung opened this issue Jul 22, 2024 · 0 comments · Fixed by #3769
Closed

Support miri-specific entry point / start function for no-std binaries #3758

RalfJung opened this issue Jul 22, 2024 · 0 comments · Fixed by #3769
Labels
A-target Area: concerns targets outside of what we currently support C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available

Comments

@RalfJung
Copy link
Member

For no-std binaries, Miri currently relies on the start feature, but that feature doesn't really make a lot of sense and should likely be removed. It also causes confusion for Miri users.

So we should instead say that in a no-std binary, we Miri will start the program by jumping to a function with link_name miri_start, and then if someone has a no-std binary they want to run in Miri, they can add something like

#[cfg(miri)]
#[no_mangle]
fn miri_start() {
  // Call the actual start function that your project implements, based on your target's conventions.
}
@RalfJung RalfJung added C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available A-target Area: concerns targets outside of what we currently support labels Jul 22, 2024
@bors bors closed this as completed in 4b649eb Aug 2, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-target Area: concerns targets outside of what we currently support C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant