rewrite resolve-rename in rmake

This commit is contained in:
Oneirical 2024-05-28 14:37:08 -04:00
parent f989d2f625
commit b4834a1c98
4 changed files with 21 additions and 8 deletions

View File

@ -70,6 +70,12 @@ pub fn opt_level(&mut self, option: &str) -> &mut Self {
self
}
/// Add a suffix in each output filename.
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self {
self.cmd.arg(format!("-Cextra-filename={suffix}"));
self
}
/// Specify type(s) of output files to generate.
pub fn emit(&mut self, kinds: &str) -> &mut Self {
self.cmd.arg(format!("--emit={kinds}"));

View File

@ -216,7 +216,6 @@ run-make/remap-path-prefix-dwarf/Makefile
run-make/remap-path-prefix/Makefile
run-make/reproducible-build-2/Makefile
run-make/reproducible-build/Makefile
run-make/resolve-rename/Makefile
run-make/return-non-c-like-enum-from-c/Makefile
run-make/return-non-c-like-enum/Makefile
run-make/rlib-chain/Makefile

View File

@ -1,7 +0,0 @@
include ../tools.mk
all:
$(RUSTC) -C extra-filename=-hash foo.rs
$(RUSTC) bar.rs
mv $(TMPDIR)/libfoo-hash.rlib $(TMPDIR)/libfoo-another-hash.rlib
$(RUSTC) baz.rs

View File

@ -0,0 +1,15 @@
// If a library is compiled with -C extra-filename, the rust compiler
// will take this into account when searching for libraries. However,
// if that library is then renamed, the rust compiler should fall back
// to its regular library location logic and not immediately fail to find
// the renamed library.
// See https://github.com/rust-lang/rust/pull/49253
use run_make_support::{rustc, tmp_dir};
use std::fs;
fn main() {
rustc().extra_filename("-hash").input("foo.rs").run();
rustc().input("bar.rs").run();
fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib"));
rustc().input("baz.rs").run();
}