From d44732120cfd6f49d49bc333ad60c0539aedee19 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 26 Jun 2024 16:21:58 -0400 Subject: [PATCH] rewrite symbols-include-type-name to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/cdylib-fewer-symbols/rmake.rs | 18 ++++++++---------- tests/run-make/extern-flag-pathless/rmake.rs | 3 +++ .../symbols-include-type-name/Makefile | 9 --------- .../symbols-include-type-name/rmake.rs | 12 ++++++++++++ 5 files changed, 23 insertions(+), 20 deletions(-) delete mode 100644 tests/run-make/symbols-include-type-name/Makefile create mode 100644 tests/run-make/symbols-include-type-name/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index e9034c631af..17f4c5883a7 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -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 diff --git a/tests/run-make/cdylib-fewer-symbols/rmake.rs b/tests/run-make/cdylib-fewer-symbols/rmake.rs index 8a8d31e6e49..da11f036f7c 100644 --- a/tests/run-make/cdylib-fewer-symbols/rmake.rs +++ b/tests/run-make/cdylib-fewer-symbols/rmake.rs @@ -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::>().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}"); } diff --git a/tests/run-make/extern-flag-pathless/rmake.rs b/tests/run-make/extern-flag-pathless/rmake.rs index 2f151136c33..9cf828abcb8 100644 --- a/tests/run-make/extern-flag-pathless/rmake.rs +++ b/tests/run-make/extern-flag-pathless/rmake.rs @@ -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() { diff --git a/tests/run-make/symbols-include-type-name/Makefile b/tests/run-make/symbols-include-type-name/Makefile deleted file mode 100644 index ac26a852e36..00000000000 --- a/tests/run-make/symbols-include-type-name/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# Check that symbol names for methods include type names, instead of . - -OUT=$(TMPDIR)/lib.s - -all: - $(RUSTC) --crate-type staticlib --emit asm lib.rs - $(CGREP) Def < $(OUT) diff --git a/tests/run-make/symbols-include-type-name/rmake.rs b/tests/run-make/symbols-include-type-name/rmake.rs new file mode 100644 index 00000000000..746c7486bf0 --- /dev/null +++ b/tests/run-make/symbols-include-type-name/rmake.rs @@ -0,0 +1,12 @@ +// Method names used to be obfuscated when exported into symbols, +// leaving only an obscure ``. 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 . + invalid_utf8_contains("lib.s", "Def"); +}