diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index e2ebdbca281..e9034c631af 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -9,7 +9,6 @@ run-make/c-unwind-abi-catch-lib-panic/Makefile run-make/c-unwind-abi-catch-panic/Makefile run-make/cat-and-grep-sanity-check/Makefile run-make/cdylib-dylib-linkage/Makefile -run-make/cdylib-fewer-symbols/Makefile run-make/compiler-lookup-paths-2/Makefile run-make/compiler-lookup-paths/Makefile run-make/compiler-rt-works-on-mingw/Makefile diff --git a/tests/run-make/cdylib-fewer-symbols/Makefile b/tests/run-make/cdylib-fewer-symbols/Makefile deleted file mode 100644 index d587cece5be..00000000000 --- a/tests/run-make/cdylib-fewer-symbols/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# ignore-cross-compile - -# Test that allocator-related symbols don't show up as exported from a cdylib as -# they're internal to Rust and not part of the public ABI. -# See https://github.com/rust-lang/rust/commit/fbf98697021173a30b84d9145df0966a23a2f9d2 - -include ../tools.mk - -# ignore-windows -# FIXME: The __rdl_ and __rust_ symbol still remains, no matter using MSVC or GNU -# See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753 - -all: - $(RUSTC) foo.rs - nm -g "$(call DYLIB,foo)" | $(CGREP) -v __rdl_ __rde_ __rg_ __rust_ diff --git a/tests/run-make/cdylib-fewer-symbols/rmake.rs b/tests/run-make/cdylib-fewer-symbols/rmake.rs new file mode 100644 index 00000000000..8a8d31e6e49 --- /dev/null +++ b/tests/run-make/cdylib-fewer-symbols/rmake.rs @@ -0,0 +1,23 @@ +// Symbols related to the allocator should be hidden and not exported from a cdylib, +// for they are internal to Rust +// and not part of the public ABI (application binary interface). This test checks that +// four such symbols are successfully hidden. +// See https://github.com/rust-lang/rust/pull/45710 + +//FIXME(Oneirical): try it on windows, restore ignore +// See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753 +//FIXME(Oneirical): I also removed cross-compile ignore since there is no binary execution + +use run_make_support::{dynamic_lib_name, llvm_readobj, rustc}; + +fn main() { + // Compile a cdylib + rustc().input("foo.rs").run(); + let out = llvm_readobj().arg("--symbols").input(dynamic_lib_name("foo")).run().stdout_utf8(); + let out = // All hidden symbols must be removed. + out.lines().filter(|&line| !line.trim().contains("HIDDEN")).collect::>().join("\n"); + assert!(!&out.contains("__rdl_")); + assert!(!&out.contains("__rde_")); + assert!(!&out.contains("__rg_")); + assert!(!&out.contains("__ruse_")); +}