-
Notifications
You must be signed in to change notification settings - Fork 24
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
Mustang nostd support #156
Conversation
Interesting! Would it work for c-gull to instead have a |
Ya that seems like a much better solution. I am not the biggest fan with how I wrote those cargo features anyway but it was the best I could get when needing to explictly mention |
Also, would you be able to add something like that no-std main as a test crate in the |
Yep, I can do that. Also found this from the unstable book.
So I'll stick with the shim. |
All updated, but not a fan of the mess of features in c-gull's |
b3ae893
to
c421877
Compare
tz-rs = "0.6.11" | ||
printf-compat = "0.1.1" | ||
log = { version = "0.4.14", default-features = false } | ||
c-scape = { path = "../c-scape", version = "0.6.1", default-features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does c-scape need default-features = false
?
If that were removed, could we also remove the c-scape/default below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c-scape by default builds with std which propagates down to its dependencies such as rustix. I was trying to avoid breaking any of the current default features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked into it a little more, c-scape also by default builds with resolve
which relies on resolve-sync
which is a library that uses std.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move resolve out into c-gull then? I think that makes sense, but don't know offhand if there's some subtle dependency there. We could also do that in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, moving resolve it into c-gull seems like the right call. I can do that in a separate PR. I went through the git history and resolve was around before c-gull existed. I am not sure if there was a reason it wasn't moved to c-gull, but simplest guess is it just got missed.
6e3fa58
to
2ade5ef
Compare
I also updated the test/readme to work with |
Looks good! Could you also add an entry to .github/workflows/main.yml at the bottom to test the new mustang-nostd test-crate? |
Added two entries, a cargo run & test. |
Fixed the CI declaration I think |
Looks like it still gets
|
Found it, was using host_target not mustang_target. |
Looked into why it failed, because default handle_alloc_error to panic isn't stabilized on the specified nightly toolchain. I can either implement a handle_alloc_error, use the default feature, or bump the toolchain version used by the tests. I prefer updating the toolchain. edit: Just added the default feature with a TODO comment to remove when the toolchain is updated (in another PR) in case other things need to be changed. |
Updating the toolchain works! It's just pinned so that we can deal with the churn at our own pace :-). |
A TODO also works for now. We can update the toolchain whenever it's convenient. |
c-scape
had an accidental dependance onstd::f64
which prevented compiling on no_std which is fixed by usinglibm
.Added feature support for
nostd
which exportsc_scape
rather thanc_gull
which still includes enough for a workingdlmalloc
/unwinding
. I was able to compile and run ano_std
executable with the following program. It also works if you use the#[start]
feature. Build command isIn terms of documentation, not entirely sure what the
#[start]
is adding vs. directly implementingmain
. Also becausemustang
is controlling all of program startup we can probably determine the safety of the start function pretty easily. related tracking issue.What I am looking to next is pulling out c-scape's thread implementation, switching dlmalloc to rustix/rust threads, and implementing the rustix backend for unwinding to remove the need for any
libc
hackery.