Open nickdesaulniers opened 2 years ago
This only works for Rust translation units as a whole, i.e. crates (and currently for the ones outside rust/
, i.e. not for the kernel
crate).
We test it in the CI, so it shouldn't have regressed.
For instance, you can try:
make LLVM=1 -j72 samples/rust/rust_minimal.rsi
make LLVM=1 -j72 samples/rust/rust_minimal.s
make LLVM=1 -j72 samples/rust/rust_minimal.o
make LLVM=1 -j72 samples/rust/rust_minimal.ll
I will make that clearer in the help and add support for the rust/
crates.
$ make LLVM=1 -j72 samples/rust/rust_minimal.rsi
error: macros that expand to items must be delimited with braces or followed by a semicolon
--> /android0/kernel-all/samples/rust/rust_minimal.rsi:29:13
|
29 | ...m! (".section \".initcall6.init\", \"a\"\n __rust_minimal_initcall:\n .long __rust_minimal_init - .\n .previous\n ")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change the delimiters to curly braces
|
29 | global_asm! {".section \".initcall6.init\", \"a\"\n __rust_minimal_initcall:\n .long __rust_minimal_init - .\n .previous\n "}
| ~ ~
help: add a semicolon
|
29 | global_asm! (".section \".initcall6.init\", \"a\"\n __rust_minimal_initcall:\n .long __rust_minimal_init - .\n .previous\n ");
| +
the rest seem to work, once I enable a few extra configs (SAMPLES, SAMPLES_RUST, SAMPLE_RUST_MINIMAL, SAMPLE_RUST_HOSTPROGS)
Interesting, this looks like a bug in the compiler -- it removes the semicolon in its output, and then rustfmt
detects the error.
Having said that, the output is not promised to be valid Rust, so I guess they may not fix it, but I will reduce it and open an issue.
You can workaround it with: make LLVM=1 -j72 samples/rust/rust_minimal.rsi RUSTFMT=n
to avoid formatting. I could make it so that formatting is attempted only, though it would mean we don't detect this sort of thing (perhaps I could print a message, though).
I forgot to mention: this reproduces only when building the module as built-in since that uses the global_asm!
. The CI didn't detect it because it currently tries the single-file targets with an external module.
This should also fix itself when we move to the approach of using directly the MODULE_*
C macros, though it is orthogonal to the issue.
I'm trying to review v9 of the kernel series. I'm having a hard time building a few of the make targets.
are there specific files that I can build the .ll, .s, .o, or .rsi files for, or did this regress?