diff --git a/rust/kernel/jump_label.rs b/rust/kernel/jump_label.rs index 7757e4f8e85e..ccfd20589c21 100644 --- a/rust/kernel/jump_label.rs +++ b/rust/kernel/jump_label.rs @@ -36,7 +36,7 @@ macro_rules! static_key_false { /// Assert that the assembly block evaluates to a string literal. #[cfg(CONFIG_JUMP_LABEL)] -const _: &str = include!("arch_static_branch_asm.rs"); +const _: &str = include!(concat!(env!("OBJTREE"), "/rust/kernel/arch_static_branch_asm.rs")); #[macro_export] #[doc(hidden)] @@ -45,7 +45,7 @@ macro_rules! static_key_false { macro_rules! arch_static_branch { ($key:path, $keytyp:ty, $field:ident, $branch:expr) => {'my_label: { $crate::asm!( - include!(concat!(env!("SRCTREE"), "/rust/kernel/arch_static_branch_asm.rs")); + include!(concat!(env!("OBJTREE"), "/rust/kernel/arch_static_branch_asm.rs")); l_yes = label { break 'my_label true; }, @@ -65,7 +65,7 @@ macro_rules! arch_static_branch { macro_rules! arch_static_branch { ($key:path, $keytyp:ty, $field:ident, $branch:expr) => {'my_label: { $crate::asm!( - include!(concat!(env!("SRCTREE"), "/rust/kernel/arch_static_branch_asm.rs")); + include!(concat!(env!("OBJTREE"), "/rust/kernel/arch_static_branch_asm.rs")); l_yes = label { break 'my_label true; }, diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 4f0f6b13ebd7..746cce80545f 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -269,7 +269,7 @@ rust_allowed_features := asm_const,asm_goto,new_uninit # current working directory, which may be not accessible in the out-of-tree # modules case. rust_common_cmd = \ - SRCTREE=$(abspath $(srctree)) \ + OBJTREE=$(abspath $(objtree)) \ RUST_MODFILE=$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \ -Zallow-features=$(rust_allowed_features) \ -Zcrate-attr=no_std \