Skip to content

Commit 50f3293

Browse files
committed
Use llvm-readobj for run-make/crate-hash-rustc-version
1 parent b4bb099 commit 50f3293

File tree

1 file changed

+14
-4
lines changed
  • tests/run-make/crate-hash-rustc-version

1 file changed

+14
-4
lines changed

tests/run-make/crate-hash-rustc-version/rmake.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,27 @@
33

44
//@ ignore-cross-compile
55

6-
use run_make_support::{cmd, diff, dynamic_lib_name, is_darwin, run, run_fail, rustc};
6+
use run_make_support::llvm;
7+
use run_make_support::{diff, dynamic_lib_name, is_darwin, run, run_fail, rustc};
8+
9+
fn llvm_readobj() -> llvm::LlvmReadobj {
10+
let mut cmd = llvm::llvm_readobj();
11+
if is_darwin() {
12+
cmd.symbols();
13+
} else {
14+
cmd.dynamic_table();
15+
}
16+
cmd
17+
}
718

819
fn main() {
920
let flags = ["-Cprefer-dynamic", "-Csymbol-mangling-version=v0"];
10-
let nm_flag = if is_darwin() { [].as_slice() } else { ["-D"].as_slice() };
1121

1222
// a.rs is compiled to a dylib
1323
rustc().input("a.rs").crate_type("dylib").args(&flags).run();
1424

1525
// Store symbols
16-
let symbols_before = cmd("nm").args(nm_flag).arg(dynamic_lib_name("a")).run().stdout_utf8();
26+
let symbols_before = llvm_readobj().arg(dynamic_lib_name("a")).run().stdout_utf8();
1727

1828
// b.rs is compiled to a binary
1929
rustc()
@@ -34,7 +44,7 @@ fn main() {
3444
.run();
3545

3646
// After compiling with a different rustc version, store symbols again.
37-
let symbols_after = cmd("nm").args(nm_flag).arg(dynamic_lib_name("a")).run().stdout_utf8();
47+
let symbols_after = llvm_readobj().arg(dynamic_lib_name("a")).run().stdout_utf8();
3848

3949
// As a sanity check, test if the symbols changed:
4050
// If the symbols are identical, there's been an error.

0 commit comments

Comments
 (0)