diff --git a/src/tools/run-make-support/src/external_deps/rustc.rs b/src/tools/run-make-support/src/external_deps/rustc.rs
index 71d28dd9675fb..584aa1191465f 100644
--- a/src/tools/run-make-support/src/external_deps/rustc.rs
+++ b/src/tools/run-make-support/src/external_deps/rustc.rs
@@ -193,6 +193,11 @@ impl Rustc {
         self
     }
 
+    /// Make `rustc` prefere dynamic linking
+    pub fn prefer_dynamic(&mut self) -> &mut Self {
+        self.arg("-Cprefer-dynamic")
+    }
+
     /// Specify directory path used for profile generation
     pub fn profile_generate<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
         let mut arg = OsString::new();
diff --git a/src/tools/run-make-support/src/symbols.rs b/src/tools/run-make-support/src/symbols.rs
index fd0c866bcc927..4ac74f9014f19 100644
--- a/src/tools/run-make-support/src/symbols.rs
+++ b/src/tools/run-make-support/src/symbols.rs
@@ -42,3 +42,29 @@ pub fn any_symbol_contains(path: impl AsRef<Path>, substrings: &[&str]) -> bool
         false
     })
 }
+
+/// Check if an object file contains *all* of the given symbols.
+///
+/// The symbol names must match exactly.
+///
+/// Panics if `path` is not a valid object file readable by the current user.
+pub fn contains_exact_symbols(path: impl AsRef<Path>, symbol_names: &[&str]) -> bool {
+    let mut found = vec![false; symbol_names.len()];
+    with_symbol_iter(path, |syms| {
+        for sym in syms {
+            for (i, symbol_name) in symbol_names.iter().enumerate() {
+                found[i] |= sym.name_bytes().unwrap() == symbol_name.as_bytes();
+            }
+        }
+    });
+    let result = found.iter().all(|x| *x);
+    if !result {
+        eprintln!("does not contain symbol(s): ");
+        for i in 0..found.len() {
+            if !found[i] {
+                eprintln!("* {}", symbol_names[i]);
+            }
+        }
+    }
+    result
+}
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index a7c8df3e27478..bd6963e491c42 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -8,7 +8,6 @@ run-make/dep-info-doesnt-run-much/Makefile
 run-make/dep-info-spaces/Makefile
 run-make/dep-info/Makefile
 run-make/emit-to-stdout/Makefile
-run-make/extern-fn-reachable/Makefile
 run-make/foreign-double-unwind/Makefile
 run-make/foreign-exceptions/Makefile
 run-make/incr-add-rust-src-component/Makefile
diff --git a/tests/run-make/extern-fn-reachable/Makefile b/tests/run-make/extern-fn-reachable/Makefile
deleted file mode 100644
index 3297251bfd1aa..0000000000000
--- a/tests/run-make/extern-fn-reachable/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# ignore-windows-msvc
-
-NM=nm -D
-
-ifeq ($(UNAME),Darwin)
-NM=nm -gU
-endif
-
-ifdef IS_WINDOWS
-NM=nm -g
-endif
-
-# This overrides the LD_LIBRARY_PATH for RUN
-TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR)
-
-all:
-	$(RUSTC) dylib.rs -o $(TMPDIR)/libdylib.so -C prefer-dynamic
-
-	[ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun1)" -eq "1" ]
-	[ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun2)" -eq "1" ]
-	[ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun3)" -eq "1" ]
-	[ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun4)" -eq "1" ]
-	[ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun5)" -eq "1" ]
diff --git a/tests/run-make/extern-fn-reachable/rmake.rs b/tests/run-make/extern-fn-reachable/rmake.rs
new file mode 100644
index 0000000000000..c9c822f01150f
--- /dev/null
+++ b/tests/run-make/extern-fn-reachable/rmake.rs
@@ -0,0 +1,7 @@
+//@ ignore-cross-compile
+use run_make_support::{rustc, symbols::contains_exact_symbols};
+
+fn main() {
+    rustc().input("dylib.rs").output("dylib.so").prefer_dynamic().run();
+    assert!(contains_exact_symbols("dylib.so", &["fun1", "fun2", "fun3", "fun4", "fun5"]));
+}