new file mode 100644
@@ -0,0 +1,28 @@
+Backport a commit that remap OUT_DIR paths to fix build script path leakage in artifacts
+
+Upstream-Status: Backport [https://github.com/rust-lang/rust/commit/e743a4db62336027dcc1f1a755f4ca35f56b67df]
+
+Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
+
+diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
+index f785254..0264667 100644
+--- a/src/bootstrap/src/core/builder/cargo.rs
++++ b/src/bootstrap/src/core/builder/cargo.rs
+@@ -1077,6 +1077,8 @@ impl Builder<'_> {
+ // rustc creates absolute paths (in part bc of the `rust-src` unremap
+ // and for working directory) so let's remap the build directory as well.
+ format!("{}={map_to}", self.build.src.display()),
++ // remap OUT_DIR so they don't leak into artifacts.
++ format!("{}={map_to}/out", self.build.out.display()),
+ ]
+ .join("\t");
+ cargo.env("RUSTC_DEBUGINFO_MAP", map);
+@@ -1097,6 +1099,8 @@ impl Builder<'_> {
+ // rustc creates absolute paths (in part bc of the `rust-src` unremap
+ // and for working directory) so let's remap the build directory as well.
+ format!("{}={map_to}", self.build.src.display()),
++ // remap OUT_DIR so they don't leak into artifacts.
++ format!("{}={map_to}/out", self.build.out.display()),
+ ]
+ .join("\t");
+ cargo.env("RUSTC_DEBUGINFO_MAP", map);
@@ -9,6 +9,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n
file://0002-Fix-rust-build-failure-with-unstable-options.patch;patchdir=${RUSTSRC} \
file://0003-explicit-tail-calls-disable-two-tests.patch;patchdir=${RUSTSRC} \
file://0004-explicit-tail-calls-ignore-tests-on-unsupported-llvm.patch;patchdir=${RUSTSRC} \
+ file://0005-remap-OUT_DIR-paths-to-fix-build-script-path-leakage-in-artifacts.patch;patchdir=${RUSTSRC} \
"
SRC_URI[rust.sha256sum] = "77a6ff3003a4ad0cb00697b043c879e3e1a15d945b1a1f63818903bfc3fa8b98"