-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add support for Rust backed camkes components #17
Conversation
Thanks for the PRs!
The old rust rules that are hanging around in seL4_tools should probably be deleted. If you are concerned that the environment variables declared in Makefile.flags I'm happy to handle removing them myself. |
This reverts commit 34ec8c8.
Thanks for the feedback! Some comments below:
Agreed.
My concern is that the sel4 rust target should be available to multiple components - so it should probably be stored somewhere else. Not sure if it makes sense to let components choose their own target - what would be the benefit?
Agreed.
yes that is work in progress.
Do you have examples of what needs to be changed for CMake builds? |
This exposes mutexes provided by libsel4camkes in a rust runtime
Rustcamkes library that provides mutexes on a camkes platform
Build libsel4sync before libsel4camkes
This PR is simple - just allows camkes to understand rust components |
The concern was that any changes to the Makefile template will immediately become deprecated with the migration to cmake. |
Oh that is great! CMake and ninja make the build process so much nicer - good work! I updated the hellorust and cmake files to use the custom rust compiler with build-in seL4 support (rather than Xargo), so you can use some 'std' features. The PRs are here: seL4/camkes#6 You just have to download the rust compiler by calling I am not sure if it makes sense to keep Xargo around, since it is not being actively developed anymore. You can do |
Thanks! Regarding Xargo, my understanding is that it is in maintenance mode while they try and merge its functionality upstream into cargo (japaric/xargo#193 (comment)). The only thing I am hesitant about these PRs is having to depend on a custom rust compiler as the default rather than something to opt into. I had been meaning to look into getting the Camkes issues that require changes to libstd fixed but I haven't had time. In the interest of not leaving these ignored for another few months, I'll look into getting these merged early next week. |
Kent, I experimented with Xargo more, and it looks like we can get the same functionality (i.e. the std/alloc support) as with our custom compiler. In which case it IMHO makes more sense to stick with Xargo for both std/no-std builds. I will update this PR with a sample app that uses std/alloc features so it will be clearer. What I had to do to get it working was the slightly modify the target json file: seL4/seL4_tools@dbd2af0 I am pretending that we are compiling for Redox OS, so we get the right OS bindings for free. Imagine that in this commit all |
I believe using xargo and providing different target files is enough policy freedom for anyone wanting to build rust components in camkes. |
The only lost feature (with Xargo) is the panic info - with Xargo you get only the output from the fault handler, while with our custom compiler you get at least some useful panic info. See GaloisInc/sel4-rust@6fb404c This was related to missing thread-local-storage I believe, but I ll try to feature gate our changes and make a PR to the rust compiler. Regarding hellorust/hellorust_std, I believe you can merge these two PRs: |
I am not sure how exactly is Redox OS build, but using this little kludge seems to work fine with seL4. |
Not sure if the linux-musl target would work, it seems to be missing bunch of |
Edit(you probably know that): with the x86_64-unknown-linux-musl target I can indeed compile the no-std example, but the std/alloc example is running into problems when compiling alloc:
And the relevant solution is discussed here: japaric/xargo#133 |
Regarding x86_64-unknown-linux-musl, I had to use .cargo/config to specify the -L flag so that it could statically link our C library.
To clarify, I meant a customtarget.json with os: linux and env:musl. (Interestingly, I found that I had to put these in the name of the file otherwise os and env weren't being set correctly. I haven't found out why this is)
TLS support is on our roadmap and someone is actively working on it at the moment. We also want to use unwind to get the backtrace support working. How come you prefer to use std instead of no_std and explicitly using core and alloc? (And use panic_fmt to provide a custom panic impl in no_std)
Well, we are just swapping out one unimplemented OS backend for another right? So if this target is easiest to get everything to link, it works for me.
I'll comment on them directly. But I agree that they are ready without requiring significant changes. |
That is a good point - I think for the firewall/rustwall it was handy to have |
Arc and format are both provided by alloc and reexported by std. When I was debugging the rustwall a few months ago it was possible to run it as no_std using some of the following:
|
(Closing due to stale after discussion with @podhrmic on the dev call) |
This commits allows camkes tool to understand Rust backed components.
Originally written by @aisamanra