Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust 1.75.0 #22

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[rust] If $TMPDIR is unset, use $HOME/.tmp instead
This patch is needed because in sb2 the temp files written to /tmp
by rustc are no longer available when the linker tries to use them.
Work around the issue by setting $TMPDIR to $HOME/.tmp instead.
If $TMPDIR is already set, that value is used as expected.
direc85 committed Mar 15, 2024
commit b7fe716e7420cf657fa3948fa6c63adca6490677
38 changes: 38 additions & 0 deletions 0009-Relocate-unset-tmp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index dd9d277fb..160e472cf 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -48,7 +48,7 @@ use std::ffi::OsString;
use std::fs::{read, File, OpenOptions};
use std::io::{BufWriter, Write};
use std::ops::Deref;
-use std::path::{Path, PathBuf};
+use std::path::{MAIN_SEPARATOR, Path, PathBuf};
use std::process::{ExitStatus, Output, Stdio};
use std::{env, fmt, fs, io, mem, str};

@@ -95,11 +95,24 @@ pub fn link_binary<'a>(
});

if outputs.outputs.should_link() {
+ let mut clear_tmp = false;
+ if env::var_os("TMPDIR").is_none() && env::var_os("HOME").is_some() {
+ let home_tmp = env::var_os("HOME").unwrap();
+ let home_tmp = format!("{}{}{}", home_tmp.to_string_lossy(), MAIN_SEPARATOR, ".tmp");
+ env::set_var("TMPDIR", &home_tmp);
+ if !Path::new(&home_tmp).exists() {
+ let _ = fs::create_dir_all(home_tmp);
+ }
+ clear_tmp = true;
+ }
let tmpdir = TempFileBuilder::new()
.prefix("rustc")
.tempdir()
.unwrap_or_else(|error| sess.emit_fatal(errors::CreateTempDir { error }));
let path = MaybeTempDir::new(tmpdir, sess.opts.cg.save_temps);
+ if clear_tmp {
+ env::remove_var("TMP");
+ }
let output = out_filename(
sess,
crate_type,
1 change: 1 addition & 0 deletions rust.spec
Original file line number Diff line number Diff line change
@@ -77,6 +77,7 @@ Patch5: 0005-Provide-ENV-controls-to-bypass-some-sb2-calls-betwee.patch
Patch6: 0006-Scratchbox2-needs-to-be-able-to-tell-cargo-the-defau.patch
Patch7: 0007-Disable-aarch64-outline-atomics-for-now.patch
Patch8: 0008-Revert-Use-statx-s-64-bit-times-on-32-bit-linux-gnu.patch
Patch9: 0009-Relocate-unset-tmp.patch
# This is the real rustc spec - the stub one appears near the end.
%ifarch %ix86