Skip to content

Commit

Permalink
rewrite cdylib-fewer-symbols to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jun 28, 2024
1 parent db21af1 commit 7c29298
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions tests/run-make/cdylib-fewer-symbols/Makefile

This file was deleted.

23 changes: 23 additions & 0 deletions tests/run-make/cdylib-fewer-symbols/rmake.rs
Original file line number Diff line number Diff line change
@@ -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::<Vec<_>>().join("\n");
assert!(!&out.contains("__rdl_"));
assert!(!&out.contains("__rde_"));
assert!(!&out.contains("__rg_"));
assert!(!&out.contains("__ruse_"));
}

0 comments on commit 7c29298

Please sign in to comment.