Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a big PR, but most of it is interdependent to the rest.
Shared Rust infrastructure:
libkernel,libmodule,libcore,liballoc,libcompiler_builtins..koon release is just 12 KiB, down from 1.3 MiB. For reference (i.e. the bulk is now shared):vmlinuxon release with Rust is 23 MiB (compressed: 2.1 MiB)vmlinuxon release without Rust is 22 MiB (compressed: 1.9 MiB).rlibs (and the.sofor the proc macro). For loadable modules, we need to rely on the upcoming v0 Rust mangling scheme, plus we need to export the Rust symbols needed by the.kos.Simpler, flat file structure: now a small driver may only need a single file like
drivers/char/rust_example.rs, like in C.rust/*anddriver/char/rust_example/*files moved to fit in the new structure: less files around.Only
rust-lang/{rust,rust-bindgen,compiler-builtins}as dependencies.Dependency handling integration with
Kbuild/fixdep.rust/source files,.rschanges, command-line changes, flag changes, etc. all trigger recompilation as needed.-j).Support for custom
--sysrootviaKRUSTCFLAGS.Proper
make cleansupport.Offline builds by default (there is no "online compilation" anymore; fixes Create a way for offline building #17).
No interleaved Cargo output (fixes Makefile ui #29).
No nightly dependency on Cargo's
build-std; since now we manage the cross-compilation ourselves (should fix Compilation error: can't find crate forstd; thex86_64-linux-kerneltarget may not be installed #27).Since now a kernel can be "Rust-enabled", a new
CONFIG_RUSToption is added to enable/disable it manually, regardless of whether one hasrustcavailable or not (CONFIG_HAS_RUST).Improved handling of
rustcflags (opt-level,debuginfo, etc.), following what the user selected for C (no Cargo profiles).Added Kconfig menu for tweaking relevant
rustcoptions, like overflow checks, debug assertions, optimization level, etc.This rewrite of the Kbuild support is cleaner, i.e. less hacks in general handling paths (e.g. no more
shell readlinkforO=).Duplicated the example driver 3 times so that we can test in the CI that 2 builtins and 2 loadables work, all at the same time.
Updated the quick start guide.
Updated CI
.configs:EXPERTand changed a few things to make it look more like a normal configuration.(I could have split a few of these ones off into another PR, but anyway it is for the CI only and I had already done it).
Less
extern crates needed since we pass it viarustc(closer to idiomatic 2018 edition Rust code).Things to note:
There is two more nightly features used:
The hack at
exports.cto export symbols to loadable modules.The hack at
allocator.rsto get the__rust_*()functions.Signed-off-by: Miguel Ojeda ojeda@kernel.org