rewrite symbols-include-type-name to rmake

This commit is contained in:
Oneirical 2024-06-26 16:21:58 -04:00
parent 7c29298ea9
commit d44732120c
5 changed files with 23 additions and 20 deletions

View File

@ -170,7 +170,6 @@ run-make/staticlib-dylib-linkage/Makefile
run-make/std-core-cycle/Makefile run-make/std-core-cycle/Makefile
run-make/symbol-mangling-hashed/Makefile run-make/symbol-mangling-hashed/Makefile
run-make/symbol-visibility/Makefile run-make/symbol-visibility/Makefile
run-make/symbols-include-type-name/Makefile
run-make/sysroot-crates-are-unstable/Makefile run-make/sysroot-crates-are-unstable/Makefile
run-make/target-cpu-native/Makefile run-make/target-cpu-native/Makefile
run-make/target-specs/Makefile run-make/target-specs/Makefile

View File

@ -4,20 +4,18 @@
// four such symbols are successfully hidden. // four such symbols are successfully hidden.
// See https://github.com/rust-lang/rust/pull/45710 // See https://github.com/rust-lang/rust/pull/45710
//FIXME(Oneirical): try it on windows, restore ignore //@ ignore-cross-compile
// See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753 // Reason: The __rust_ symbol appears during cross-compilation.
//FIXME(Oneirical): I also removed cross-compile ignore since there is no binary execution
use run_make_support::{dynamic_lib_name, llvm_readobj, rustc}; use run_make_support::{dynamic_lib_name, llvm_readobj, rustc};
fn main() { fn main() {
// Compile a cdylib // Compile a cdylib
rustc().input("foo.rs").run(); rustc().input("foo.rs").run();
let out = llvm_readobj().arg("--symbols").input(dynamic_lib_name("foo")).run().stdout_utf8(); let out =
let out = // All hidden symbols must be removed. llvm_readobj().arg("--dyn-symbols").input(dynamic_lib_name("foo")).run().stdout_utf8();
out.lines().filter(|&line| !line.trim().contains("HIDDEN")).collect::<Vec<_>>().join("\n"); assert!(!&out.contains("__rdl_"), "{out}");
assert!(!&out.contains("__rdl_")); assert!(!&out.contains("__rde_"), "{out}");
assert!(!&out.contains("__rde_")); assert!(!&out.contains("__rg_"), "{out}");
assert!(!&out.contains("__rg_")); assert!(!&out.contains("__rust_"), "{out}");
assert!(!&out.contains("__ruse_"));
} }

View File

@ -5,6 +5,9 @@
// respected. // respected.
// See https://github.com/rust-lang/rust/pull/64882 // 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}; use run_make_support::{dynamic_lib_name, fs_wrapper, run, run_fail, rust_lib_name, rustc};
fn main() { fn main() {

View File

@ -1,9 +0,0 @@
include ../tools.mk
# Check that symbol names for methods include type names, instead of <impl>.
OUT=$(TMPDIR)/lib.s
all:
$(RUSTC) --crate-type staticlib --emit asm lib.rs
$(CGREP) Def < $(OUT)

View File

@ -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");
}