Skip to content

Commit dff354e

Browse files
committed
rewrite metadata-flag-frobs-symbols to rmake
1 parent 9e2ace8 commit dff354e

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

src/tools/run-make-support/src/rustc.rs

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ impl Rustc {
7373
self
7474
}
7575

76+
/// Incorporate a hashed string to mangled symbols.
77+
pub fn metadata(&mut self, meta: &str) -> &mut Self {
78+
self.cmd.arg(format!("-Cmetadata={meta}"));
79+
self
80+
}
81+
7682
/// Add a suffix in each output filename.
7783
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self {
7884
self.cmd.arg(format!("-Cextra-filename={suffix}"));

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ run-make/macos-fat-archive/Makefile
119119
run-make/manual-link/Makefile
120120
run-make/many-crates-but-no-match/Makefile
121121
run-make/metadata-dep-info/Makefile
122-
run-make/metadata-flag-frobs-symbols/Makefile
123122
run-make/min-global-align/Makefile
124123
run-make/mingw-export-call-convention/Makefile
125124
run-make/mismatching-target-triples/Makefile

tests/run-make/metadata-flag-frobs-symbols/Makefile

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// In this test, foo.rs is compiled twice with different hashes tied to its
2+
// symbols thanks to the metadata flag. bar.rs then ensures that the memory locations
3+
// of foo's symbols are different even though they came from the same original source code.
4+
// This checks that the metadata flag is doing its job.
5+
// See https://github.com/rust-lang/rust/issues/14471
6+
7+
//@ ignore-cross-compile
8+
9+
use run_make_support::{run, rust_lib_name, rustc};
10+
11+
fn main() {
12+
rustc().input("foo.rs").metadata("a").extra_filename("-a").run();
13+
rustc().input("foo.rs").metadata("b").extra_filename("-b").run();
14+
rustc()
15+
.input("bar.rs")
16+
.extern_("foo1", rust_lib_name("foo-a"))
17+
.extern_("foo2", rust_lib_name("foo-b"))
18+
.print("link-args")
19+
.run();
20+
run("bar");
21+
}

0 commit comments

Comments
 (0)