Initial Rust support#4
Merged
Merged
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.
Currently we have several lines of work:
rustc; and another one I have been working on, based oncargo).cargo).This patch effectively merges the work we have been doing and integrates it in the latest mainline kernel tree.
This does not mean anything needs to stay as-is, but this gives us a working, common base to work and experiment upon. Hopefully, it will also attract external people to join!
As a summary, I added:
cargointegration with the kernelMakefiles:cargoworkspace to have a single lock file and to share deps betweencargojobs.V=1.cargocleantarget to clean all the Rust-related artifacts.Initial support for built-in modules (i.e.
Yas well asM):TODOs), but it is enough to start playing with things that depend onMODULE.--cfg moduleto built-in modules to be able to compile conditionally inside Rust.KSYM_NAME_LENlength to avoid warnings due to Rust long mangled symbols.Rust infrastructure in a new top level folder
rust/:kernelpackage which contains the sources from Alex & Geoffrey's work plus some changes:build.rs.THIS_MODULEemulation until it is implemented.Makefilelogic and the code thatcfg-depended on kernel version (no need in mainline).rust_*and exported viaEXPORT_SYMBOLinstead.shlexpackage which serves as an example of an "inline" dependency (i.e. package checked out copy to avoid the network)The example driver was setup at
drivers/char/rust_example/.Misc
Documentation/rust/with a quick start guide.MAINTAINERSentry.Other notes that aren't in
TODOs:We could minimize the network requirements (use
bindgenbinary, use more inline dependencies...), but it is not clear it would be a good idea for the moment due tocore/alloc/compiler-builtins.The intention of
rust/is to have a place to put extra dependencies and split thekernelpackage into several in the future if it grows. It could resemble the usual kernel tree structure.With several drivers being built-in,
cargorecompileskerneland triggers duplicate symbol errors when merging thin archives. We need to make it only compilekernelonce.When the above works, then
make's-jcalling concurrentcargos (e.g. several drivers at the same time) should be OK, I think. According to Fix running Cargo concurrently rust-lang/cargo#2486 it shouldn't miscompile anything, but if they start locking on each other we will have make jobs waiting that could have been doing something else.Signed-off-by: Miguel Ojeda miguel.ojeda.sandonis@gmail.com