Skip to content

Commit

Permalink
rewrite symbols-include-type-name to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jul 9, 2024
1 parent 7c29298 commit d447321
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 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 @@ -170,7 +170,6 @@ run-make/staticlib-dylib-linkage/Makefile
run-make/std-core-cycle/Makefile
run-make/symbol-mangling-hashed/Makefile
run-make/symbol-visibility/Makefile
run-make/symbols-include-type-name/Makefile
run-make/sysroot-crates-are-unstable/Makefile
run-make/target-cpu-native/Makefile
run-make/target-specs/Makefile
Expand Down
18 changes: 8 additions & 10 deletions tests/run-make/cdylib-fewer-symbols/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@
// 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
//@ ignore-cross-compile
// Reason: The __rust_ symbol appears during cross-compilation.

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_"));
let out =
llvm_readobj().arg("--dyn-symbols").input(dynamic_lib_name("foo")).run().stdout_utf8();
assert!(!&out.contains("__rdl_"), "{out}");
assert!(!&out.contains("__rde_"), "{out}");
assert!(!&out.contains("__rg_"), "{out}");
assert!(!&out.contains("__rust_"), "{out}");
}
3 changes: 3 additions & 0 deletions tests/run-make/extern-flag-pathless/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// respected.
// See https://github.com/rust-lang/rust/pull/64882

//@ ignore-cross-compile
// Reason: the compiled binary is executed

use run_make_support::{dynamic_lib_name, fs_wrapper, run, run_fail, rust_lib_name, rustc};

fn main() {
Expand Down
9 changes: 0 additions & 9 deletions tests/run-make/symbols-include-type-name/Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions tests/run-make/symbols-include-type-name/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Method names used to be obfuscated when exported into symbols,
// leaving only an obscure `<impl>`. After the fix in #30328,
// this test checks that method names are successfully saved in the symbol list.
// See https://github.com/rust-lang/rust/issues/30260

use run_make_support::{invalid_utf8_contains, rustc};

fn main() {
rustc().crate_type("staticlib").emit("asm").input("lib.rs").run();
// Check that symbol names for methods include type names, instead of <impl>.
invalid_utf8_contains("lib.s", "Def");
}

0 comments on commit d447321

Please sign in to comment.