Skip to content

Commit e377765

Browse files
committed
Only run the symbols-all-mangled test on Linux
Other platforms may add other unmangled symbols through crt1.o and such.
1 parent 275f3fa commit e377765

File tree

1 file changed

+3
-6
lines changed
  • tests/run-make/symbols-all-mangled

1 file changed

+3
-6
lines changed

tests/run-make/symbols-all-mangled/rmake.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Check that all symbols in cdylibs, staticlibs and bins are mangled
2+
//@ only-linux (non-linux has other symbols, unreasonable to exhaustively check)
23

34
use run_make_support::object::read::{Object, ObjectSymbol};
45
use run_make_support::{bin_name, dynamic_lib_name, object, rfs, rustc, static_lib_name};
@@ -21,7 +22,7 @@ fn symbols_check_archive(path: &str) {
2122
let file = object::read::archive::ArchiveFile::parse(&*binary_data).unwrap();
2223
for symbol in file.symbols().unwrap().unwrap() {
2324
let symbol = symbol.unwrap();
24-
let name = strip_underscore_if_apple(std::str::from_utf8(symbol.name()).unwrap());
25+
let name = std::str::from_utf8(symbol.name()).unwrap();
2526
if name.starts_with("_ZN") || name.starts_with("_R") {
2627
continue; // Correctly mangled
2728
}
@@ -54,7 +55,7 @@ fn symbols_check(path: &str) {
5455
if symbol.is_weak() {
5556
continue; // Likely an intrinsic from compiler-builtins
5657
}
57-
let name = strip_underscore_if_apple(symbol.name().unwrap());
58+
let name = symbol.name().unwrap();
5859
if name.starts_with("_ZN") || name.starts_with("_R") {
5960
continue; // Correctly mangled
6061
}
@@ -78,7 +79,3 @@ fn symbols_check(path: &str) {
7879
panic!("Unmangled symbol found: {name}");
7980
}
8081
}
81-
82-
fn strip_underscore_if_apple(symbol: &str) -> &str {
83-
if cfg!(target_vendor = "apple") { symbol.strip_prefix("_").unwrap() } else { symbol }
84-
}

0 commit comments

Comments
 (0)