rewrite metadata-flag-frobs-symbols to rmake
This commit is contained in:
parent
9e2ace85f9
commit
dff354e57f
4 changed files with 27 additions and 12 deletions
|
@ -73,6 +73,12 @@ impl Rustc {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Incorporate a hashed string to mangled symbols.
|
||||||
|
pub fn metadata(&mut self, meta: &str) -> &mut Self {
|
||||||
|
self.cmd.arg(format!("-Cmetadata={meta}"));
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Add a suffix in each output filename.
|
/// Add a suffix in each output filename.
|
||||||
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self {
|
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self {
|
||||||
self.cmd.arg(format!("-Cextra-filename={suffix}"));
|
self.cmd.arg(format!("-Cextra-filename={suffix}"));
|
||||||
|
|
|
@ -119,7 +119,6 @@ run-make/macos-fat-archive/Makefile
|
||||||
run-make/manual-link/Makefile
|
run-make/manual-link/Makefile
|
||||||
run-make/many-crates-but-no-match/Makefile
|
run-make/many-crates-but-no-match/Makefile
|
||||||
run-make/metadata-dep-info/Makefile
|
run-make/metadata-dep-info/Makefile
|
||||||
run-make/metadata-flag-frobs-symbols/Makefile
|
|
||||||
run-make/min-global-align/Makefile
|
run-make/min-global-align/Makefile
|
||||||
run-make/mingw-export-call-convention/Makefile
|
run-make/mingw-export-call-convention/Makefile
|
||||||
run-make/mismatching-target-triples/Makefile
|
run-make/mismatching-target-triples/Makefile
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
# ignore-cross-compile
|
|
||||||
include ../tools.mk
|
|
||||||
|
|
||||||
all:
|
|
||||||
$(RUSTC) foo.rs -C metadata=a -C extra-filename=-a
|
|
||||||
$(RUSTC) foo.rs -C metadata=b -C extra-filename=-b
|
|
||||||
$(RUSTC) bar.rs \
|
|
||||||
--extern foo1=$(TMPDIR)/libfoo-a.rlib \
|
|
||||||
--extern foo2=$(TMPDIR)/libfoo-b.rlib \
|
|
||||||
--print link-args
|
|
||||||
$(call RUN,bar)
|
|
21
tests/run-make/metadata-flag-frobs-symbols/rmake.rs
Normal file
21
tests/run-make/metadata-flag-frobs-symbols/rmake.rs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
// In this test, foo.rs is compiled twice with different hashes tied to its
|
||||||
|
// symbols thanks to the metadata flag. bar.rs then ensures that the memory locations
|
||||||
|
// of foo's symbols are different even though they came from the same original source code.
|
||||||
|
// This checks that the metadata flag is doing its job.
|
||||||
|
// See https://github.com/rust-lang/rust/issues/14471
|
||||||
|
|
||||||
|
//@ ignore-cross-compile
|
||||||
|
|
||||||
|
use run_make_support::{run, rust_lib_name, rustc};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
rustc().input("foo.rs").metadata("a").extra_filename("-a").run();
|
||||||
|
rustc().input("foo.rs").metadata("b").extra_filename("-b").run();
|
||||||
|
rustc()
|
||||||
|
.input("bar.rs")
|
||||||
|
.extern_("foo1", rust_lib_name("foo-a"))
|
||||||
|
.extern_("foo2", rust_lib_name("foo-b"))
|
||||||
|
.print("link-args")
|
||||||
|
.run();
|
||||||
|
run("bar");
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue