-
Notifications
You must be signed in to change notification settings - Fork 448
Out-of-tree module failed to build if the kernel source path is different #792
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
Comments
Yeah, I think rustc should hash the file contents rather than the file path. |
…agisa Make debug_triple depend on target json file content rather than file path This ensures that changes to target json files will force a recompilation. And more importantly that moving the files doesn't force a recompilation. This should fix Rust-for-Linux/linux#792 (cc `@ojeda)`
…agisa Make debug_triple depend on target json file content rather than file path This ensures that changes to target json files will force a recompilation. And more importantly that moving the files doesn't force a recompilation. This should fix Rust-for-Linux/linux#792 (cc ``@ojeda)``
rust-lang/rust#98225 has landed. This issue should be fixed in rustc 1.63.0. |
Thanks a lot @bjorn3! |
Thank you for fixing this issue which troubled me for a long time! |
Now with Rust 1.63.0, which btw hasn't required further patching, I could confirm that I'm able to build out of tree modules with the kernel build system using v9 of the patchset.
Said module, alongside a C counterpart, was tested in a QEMU VM, both loading and removing work as expected. If Rust 1.63.0 becomes mandatory then this issue can be closed indeed. |
Thanks for confirming the fix @YakoYakoYokuYoku! @ojeda will probably update to Rust 1.63.0 soon. |
Nowadays we require a way higher version. |
As most of the Linux distribution install the kernel with their package (.deb, .rpm, ...). I also tried to do the same thing to test Linux kernel with Rust support. However, when I build some out-of-tree Rust kernel module, it failed to compile with the following message:
After digging some codes, I found that rustc record the target triple as the path of target.json file.
https://doc.rust-lang.org/stable/nightly-rustc/rustc_target/spec/enum.TargetTriple.html
And the target triple appears in the error messages can be calculated with the following codes:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=aa52d204a7d4167cfd84076776ab957a
The above codes is reference from rust-lang/rust/compiler/rustc_target/src/spec/mod.rs:2445
P.s. I think that this is the problem of the compiler, however, this issue must be resolved if we want to support out-of-tree Rust kernel module in the future.
The text was updated successfully, but these errors were encountered: