diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-11-04 15:49:57 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-11-26 18:02:42 +0000 |
| commit | 98a6eaa7f8436cbedc79a21fe3ec62e8a35ef392 (patch) | |
| tree | a6835944334c03cdcf17cacf468a088c95d854c5 /compiler/rustc_codegen_ssa/src | |
| parent | eacbe65dfea942f40bf475658a154292077fde07 (diff) | |
| download | rust-98a6eaa7f8436cbedc79a21fe3ec62e8a35ef392.tar.gz rust-98a6eaa7f8436cbedc79a21fe3ec62e8a35ef392.zip | |
Serialize OutputFilenames into rmeta file
This ensures that linking will use the correct crate name even when `#![crate_name = "..."]` is used to specify the crate name.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/lib.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index a0d6e1885c2..bfd0a458884 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -216,6 +216,7 @@ impl CodegenResults { sess: &Session, rlink_file: &Path, codegen_results: &CodegenResults, + outputs: &OutputFilenames, ) -> Result<usize, io::Error> { let mut encoder = FileEncoder::new(rlink_file)?; encoder.emit_raw_bytes(RLINK_MAGIC); @@ -224,10 +225,14 @@ impl CodegenResults { encoder.emit_raw_bytes(&RLINK_VERSION.to_be_bytes()); encoder.emit_str(sess.cfg_version); Encodable::encode(codegen_results, &mut encoder); + Encodable::encode(outputs, &mut encoder); encoder.finish().map_err(|(_path, err)| err) } - pub fn deserialize_rlink(sess: &Session, data: Vec<u8>) -> Result<Self, CodegenErrors> { + pub fn deserialize_rlink( + sess: &Session, + data: Vec<u8>, + ) -> Result<(Self, OutputFilenames), CodegenErrors> { // The Decodable machinery is not used here because it panics if the input data is invalid // and because its internal representation may change. if !data.starts_with(RLINK_MAGIC) { @@ -256,6 +261,7 @@ impl CodegenResults { } let codegen_results = CodegenResults::decode(&mut decoder); - Ok(codegen_results) + let outputs = OutputFilenames::decode(&mut decoder); + Ok((codegen_results, outputs)) } } |
