Patch "kbuild: rust: avoid creating temporary files" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    kbuild: rust: avoid creating temporary files

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kbuild-rust-avoid-creating-temporary-files.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 52c90d5dc37f0d8c14b282d189215706cf57b824
Author: Miguel Ojeda <ojeda@xxxxxxxxxx>
Date:   Sun Jul 23 16:21:28 2023 +0200

    kbuild: rust: avoid creating temporary files
    
    [ Upstream commit df01b7cfcef08bf3fdcac2909d0e1910781d6bfd ]
    
    `rustc` outputs by default the temporary files (i.e. the ones saved
    by `-Csave-temps`, such as `*.rcgu*` files) in the current working
    directory when `-o` and `--out-dir` are not given (even if
    `--emit=x=path` is given, i.e. it does not use those for temporaries).
    
    Since out-of-tree modules are compiled from the `linux` tree,
    `rustc` then tries to create them there, which may not be accessible.
    
    Thus pass `--out-dir` explicitly, even if it is just for the temporary
    files.
    
    Similarly, do so for Rust host programs too.
    
    Reported-by: Raphael Nestler <raphael.nestler@xxxxxxxxx>
    Closes: https://github.com/Rust-for-Linux/linux/issues/1015
    Reported-by: Andrea Righi <andrea.righi@xxxxxxxxxxxxx>
    Tested-by: Raphael Nestler <raphael.nestler@xxxxxxxxx> # non-hostprogs
    Tested-by: Andrea Righi <andrea.righi@xxxxxxxxxxxxx> # non-hostprogs
    Fixes: 295d8398c67e ("kbuild: specify output names separately for each emission type from rustc")
    Cc: stable@xxxxxxxxxxxxxxx
    Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
    Tested-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx>
    Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 9ae02542b9389..1827bc1db1e98 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -277,6 +277,9 @@ $(obj)/%.lst: $(src)/%.c FORCE
 
 rust_allowed_features := core_ffi_c
 
+# `--out-dir` is required to avoid temporaries being created by `rustc` in the
+# current working directory, which may be not accessible in the out-of-tree
+# modules case.
 rust_common_cmd = \
 	RUST_MODFILE=$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \
 	-Zallow-features=$(rust_allowed_features) \
@@ -285,7 +288,7 @@ rust_common_cmd = \
 	--extern alloc --extern kernel \
 	--crate-type rlib -L $(objtree)/rust/ \
 	--crate-name $(basename $(notdir $@)) \
-	--emit=dep-info=$(depfile)
+	--out-dir $(dir $@) --emit=dep-info=$(depfile)
 
 rust_handle_depfile = \
 	sed -i '/^\#/d' $(depfile)
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index d812241144d44..a447c91893de6 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -86,7 +86,11 @@ hostc_flags    = -Wp,-MMD,$(depfile) \
 hostcxx_flags  = -Wp,-MMD,$(depfile) \
                  $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
                  $(HOSTCXXFLAGS_$(target-stem).o)
-hostrust_flags = --emit=dep-info=$(depfile) \
+
+# `--out-dir` is required to avoid temporaries being created by `rustc` in the
+# current working directory, which may be not accessible in the out-of-tree
+# modules case.
+hostrust_flags = --out-dir $(dir $@) --emit=dep-info=$(depfile) \
                  $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \
                  $(HOSTRUSTFLAGS_$(target-stem))
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux