Skip to content

Commit 22d3c0d

Browse files
Prepend temp files with a string per invocation of rustc
1 parent 3c3a6a2 commit 22d3c0d

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/back/write.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,16 @@ pub(crate) unsafe fn codegen(
3131
// TODO(antoyo): remove this environment variable.
3232
let fat_lto = env::var("EMBED_LTO_BITCODE").as_deref() == Ok("1");
3333

34-
let bc_out = cgcx.output_filenames.temp_path_for_cgu(OutputType::Bitcode, &module.name);
35-
let obj_out = cgcx.output_filenames.temp_path_for_cgu(OutputType::Object, &module.name);
34+
let bc_out = cgcx.output_filenames.temp_path_for_cgu(
35+
OutputType::Bitcode,
36+
&module.name,
37+
cgcx.invocation_temp.as_deref(),
38+
);
39+
let obj_out = cgcx.output_filenames.temp_path_for_cgu(
40+
OutputType::Object,
41+
&module.name,
42+
cgcx.invocation_temp.as_deref(),
43+
);
3644

3745
if config.bitcode_needed() {
3846
if fat_lto {
@@ -113,15 +121,22 @@ pub(crate) unsafe fn codegen(
113121
}
114122

115123
if config.emit_ir {
116-
let out =
117-
cgcx.output_filenames.temp_path_for_cgu(OutputType::LlvmAssembly, &module.name);
124+
let out = cgcx.output_filenames.temp_path_for_cgu(
125+
OutputType::LlvmAssembly,
126+
&module.name,
127+
cgcx.invocation_temp.as_deref(),
128+
);
118129
std::fs::write(out, "").expect("write file");
119130
}
120131

121132
if config.emit_asm {
122133
let _timer =
123134
cgcx.prof.generic_activity_with_arg("GCC_module_codegen_emit_asm", &*module.name);
124-
let path = cgcx.output_filenames.temp_path_for_cgu(OutputType::Assembly, &module.name);
135+
let path = cgcx.output_filenames.temp_path_for_cgu(
136+
OutputType::Assembly,
137+
&module.name,
138+
cgcx.invocation_temp.as_deref(),
139+
);
125140
context.compile_to_file(OutputKind::Assembler, path.to_str().expect("path to str"));
126141
}
127142

@@ -235,6 +250,7 @@ pub(crate) unsafe fn codegen(
235250
config.emit_asm,
236251
config.emit_ir,
237252
&cgcx.output_filenames,
253+
cgcx.invocation_temp.as_deref(),
238254
))
239255
}
240256

0 commit comments

Comments
 (0)