Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rewrite metadata-flag-frobs-symbols to rmake
  • Loading branch information
Oneirical committed Jun 18, 2024
commit dff354e57fe030f8fa0467f092b75e8979a3cce9
6 changes: 6 additions & 0 deletions src/tools/run-make-support/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ impl Rustc {
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.
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self {
self.cmd.arg(format!("-Cextra-filename={suffix}"));
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ run-make/macos-fat-archive/Makefile
run-make/manual-link/Makefile
run-make/many-crates-but-no-match/Makefile
run-make/metadata-dep-info/Makefile
run-make/metadata-flag-frobs-symbols/Makefile
run-make/min-global-align/Makefile
run-make/mingw-export-call-convention/Makefile
run-make/mismatching-target-triples/Makefile
Expand Down
11 changes: 0 additions & 11 deletions tests/run-make/metadata-flag-frobs-symbols/Makefile

This file was deleted.

21 changes: 21 additions & 0 deletions tests/run-make/metadata-flag-frobs-symbols/rmake.rs
Original file line number Diff line number Diff line change
@@ -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();
Copy link
Member

@jieyouxu jieyouxu Jun 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: is this supposed to be checking output of --print=link-args? I know the original test does the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean, if it should be run_unchecked? I don't see why, if the original test worked on all platforms as run, why would we need to reduce the exactitude of the test by not checking?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I mean that this invocation uses --print=link-args but we're not checking what stdout contains (or what the content of --print=link-args is), is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is quite weird indeed, my guess is that the test writer left it in as a way to debug their own test if it failed. The test works locally without it, so I am removing it now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, r=me when CI passes

run("bar");
}