Re: [PATCH v1] rust: jump_label: skip arch-specific asm in `testlib` builds
Miguel Ojeda <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <CANiq72kwncSLRAY09p3DL_f03Bcjpjf5e91v2d6QxmfEeY2ehg@mail.gmail.com> |
On Sun, Aug 9, 2026 at 3:49 PM FUJITA Tomonori <[email protected]> wrote: > > From: FUJITA Tomonori <[email protected]> > > Running `make rusttest` with `ARCH=` set to an architecture other than > the host's fails, e.g. `ARCH=arm64` on an x86_64 host: > > error: alignment must be a power of 2 > --> rust/kernel/jump_label.rs:51:13 > | > 51 | include!(concat!(env!("OBJTREE"), "/rust/kernel/generated_arch_static_branch_asm.rs")); > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > | > note: instantiated into assembly here > --> <inline asm>:3:10 > | > 3 | .align 3 > | ^ > > The reason is that `rusttest` builds the kernel crate as a host > library: it passes the `CONFIG_*` cfgs of the configured architecture, > but not `--target`, so code generation happens for the > host. `arch_static_branch!` then selects the arch-specific inline asm > arm based on CONFIG_*, and the host assembler rejects it. > > This does not happen with the current master because > `arch_static_branch!` has no user inside the kernel crate itself yet, > but fix it now to avoid surprises later. > > Signed-off-by: FUJITA Tomonori <[email protected]> Applied to `rust-fixes` -- thanks! [ Reworded slightly to clarify it "may fail in the future". - Miguel ] Cheers, Miguel