diff --git a/src/tools/run-make-support/src/symbols.rs b/src/tools/run-make-support/src/symbols.rs index fd0c866bcc927..bb66e93138c76 100644 --- a/src/tools/run-make-support/src/symbols.rs +++ b/src/tools/run-make-support/src/symbols.rs @@ -28,12 +28,11 @@ pub fn any_symbol_contains(path: impl AsRef, substrings: &[&str]) -> bool with_symbol_iter(path, |syms| { for sym in syms { for substring in substrings { - if sym - .name_bytes() - .unwrap() - .windows(substring.len()) - .any(|x| x == substring.as_bytes()) - { + let name = sym.name_bytes().unwrap(); + if name.starts_with(b"__imp_") { + continue; + } + if name.windows(substring.len()).any(|x| x == substring.as_bytes()) { eprintln!("{:?} contains {}", sym, substring); return true; } diff --git a/tests/run-make/fmt-write-bloat/main.rs b/tests/run-make/fmt-write-bloat/main.rs index e86c48014c3aa..6f206d6515a37 100644 --- a/tests/run-make/fmt-write-bloat/main.rs +++ b/tests/run-make/fmt-write-bloat/main.rs @@ -5,7 +5,7 @@ use core::fmt; use core::fmt::Write; -#[link(name = "c")] +#[cfg_attr(not(windows), link(name = "c"))] extern "C" {} struct Dummy; diff --git a/tests/run-make/fmt-write-bloat/rmake.rs b/tests/run-make/fmt-write-bloat/rmake.rs index 4ae226ec0e234..141069cfb7d36 100644 --- a/tests/run-make/fmt-write-bloat/rmake.rs +++ b/tests/run-make/fmt-write-bloat/rmake.rs @@ -15,14 +15,11 @@ //! `NO_DEBUG_ASSERTIONS=1`). If debug assertions are disabled, then we can check for the absence of //! additional `usize` formatting and padding related symbols. -// Reason: This test is `ignore-windows` because the `no_std` test (using `#[link(name = "c")])` -// doesn't link on windows. -//@ ignore-windows //@ ignore-cross-compile use run_make_support::env::no_debug_assertions; -use run_make_support::rustc; use run_make_support::symbols::any_symbol_contains; +use run_make_support::{bin_name, rustc}; fn main() { rustc().input("main.rs").opt().run(); @@ -33,5 +30,5 @@ fn main() { // otherwise, add them to the list of symbols to deny. panic_syms.extend_from_slice(&["panicking", "panic_fmt", "pad_integral", "Display"]); } - assert!(!any_symbol_contains("main", &panic_syms)); + assert!(!any_symbol_contains(&bin_name("main"), &panic_syms)); }