about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-22 13:04:32 -0400
committerOneirical <manchot@videotron.ca>2024-07-26 10:17:39 -0400
commit3cc1056ff77a9a6fb338549b712aebfef1959be0 (patch)
treea2b647be593415db72002a7d638796e1c60a485a
parent2a3e4c547b35c44461bc8c3c2dcf4b99c3bafd63 (diff)
downloadrust-3cc1056ff77a9a6fb338549b712aebfef1959be0.tar.gz
rust-3cc1056ff77a9a6fb338549b712aebfef1959be0.zip
rewrite export-executable-symbols to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/c-unwind-abi-catch-lib-panic/rmake.rs6
-rw-r--r--tests/run-make/export-executable-symbols/Makefile11
-rw-r--r--tests/run-make/export-executable-symbols/rmake.rs25
-rw-r--r--tests/run-make/foreign-rust-exceptions/rmake.rs4
5 files changed, 30 insertions, 17 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index e35b69449ac..c3993e41a50 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/dep-info-doesnt-run-much/Makefile
 run-make/dep-info-spaces/Makefile
 run-make/dep-info/Makefile
 run-make/emit-to-stdout/Makefile
-run-make/export-executable-symbols/Makefile
 run-make/extern-fn-reachable/Makefile
 run-make/fmt-write-bloat/Makefile
 run-make/foreign-double-unwind/Makefile
diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/rmake.rs b/tests/run-make/c-unwind-abi-catch-lib-panic/rmake.rs
index 4bdb8579af5..62e1748b6fb 100644
--- a/tests/run-make/c-unwind-abi-catch-lib-panic/rmake.rs
+++ b/tests/run-make/c-unwind-abi-catch-lib-panic/rmake.rs
@@ -8,7 +8,7 @@
 //@ needs-unwind
 // Reason: this test exercises unwinding a panic
 
-use run_make_support::{cc, is_msvc, llvm_ar, run, rustc};
+use run_make_support::{cc, is_msvc, llvm_ar, run, rustc, static_lib_name};
 
 fn main() {
     // Compile `add.c` into an object file.
@@ -25,9 +25,9 @@ fn main() {
 
     // Now, create an archive using these two objects.
     if is_msvc() {
-        llvm_ar().obj_to_ar().args(&["libadd.a", "add.obj", "panic.o"]).run();
+        llvm_ar().obj_to_ar().args(&[&static_lib_name("add"), "add.obj", "panic.o"]).run();
     } else {
-        llvm_ar().obj_to_ar().args(&["libadd.a", "add.o", "panic.o"]).run();
+        llvm_ar().obj_to_ar().args(&[&static_lib_name("add"), "add.o", "panic.o"]).run();
     };
 
     // Compile `main.rs`, which will link into our library, and run it.
diff --git a/tests/run-make/export-executable-symbols/Makefile b/tests/run-make/export-executable-symbols/Makefile
deleted file mode 100644
index c4d29aa2bf4..00000000000
--- a/tests/run-make/export-executable-symbols/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-include ../tools.mk
-
-# ignore-wasm32
-# ignore-wasm64
-# ignore-none no-std is not supported
-# only-linux
-
-all:
-	$(RUSTC) -Zexport-executable-symbols  main.rs --target $(TARGET) --crate-type=bin
-	nm $(TMPDIR)/main | $(CGREP) exported_symbol
-
diff --git a/tests/run-make/export-executable-symbols/rmake.rs b/tests/run-make/export-executable-symbols/rmake.rs
new file mode 100644
index 00000000000..77f968189b6
--- /dev/null
+++ b/tests/run-make/export-executable-symbols/rmake.rs
@@ -0,0 +1,25 @@
+// The unstable flag `-Z export-executable-symbols` exports symbols from executables, as if
+// they were dynamic libraries. This test is a simple smoke test to check that this feature
+// works by using it in compilation, then checking that the output binary contains the exported
+// symbol.
+// See https://github.com/rust-lang/rust/pull/85673
+
+//@ only-unix
+// Reason: the export-executable-symbols flag only works on Unix
+// due to hardcoded platform-specific implementation
+// (See #85673)
+//@ ignore-wasm32
+//@ ignore-wasm64
+//@ ignore-none
+// Reason: no-std is not supported
+
+use run_make_support::{bin_name, llvm_readobj, rustc};
+
+fn main() {
+    rustc().arg("-Zexport-executable-symbols").input("main.rs").crate_type("bin").run();
+    llvm_readobj()
+        .symbols()
+        .input(bin_name("main"))
+        .run()
+        .assert_stdout_contains("exported_symbol");
+}
diff --git a/tests/run-make/foreign-rust-exceptions/rmake.rs b/tests/run-make/foreign-rust-exceptions/rmake.rs
index 06f7a07c62d..9c917078aaa 100644
--- a/tests/run-make/foreign-rust-exceptions/rmake.rs
+++ b/tests/run-make/foreign-rust-exceptions/rmake.rs
@@ -10,8 +10,8 @@
 //@ needs-unwind
 // Reason: unwinding panics is exercised in this test
 
-//FIXME(Oneirical): ignore-i686-pc-windows-gnu
-// This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder
+//@ ignore-i686-pc-windows-gnu
+// Reason: This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder
 // so cross-DLL unwinding does not work.
 
 use run_make_support::{run_fail, rustc};