about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-21 15:05:54 -0400
committerOneirical <manchot@videotron.ca>2024-06-28 11:18:46 -0400
commit133b47ab3837baf7d1a7f9f03a7166c137667797 (patch)
tree03bf1cdfeaf4c06d8631895efaed48cb3ef8c895
parentcb1281b76d4d90fd66bd76507e583c69625e037d (diff)
downloadrust-133b47ab3837baf7d1a7f9f03a7166c137667797.tar.gz
rust-133b47ab3837baf7d1a7f9f03a7166c137667797.zip
rewrite emit-stack-sizes to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt2
-rw-r--r--tests/run-make/debug-assertions/debug.rs1
-rw-r--r--tests/run-make/emit-stack-sizes/Makefile12
-rw-r--r--tests/run-make/emit-stack-sizes/rmake.rs23
4 files changed, 24 insertions, 14 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 6199dce7d98..f6c091ee412 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -26,7 +26,6 @@ run-make/dump-mono-stats/Makefile
 run-make/dylib-chain/Makefile
 run-make/emit-path-unhashed/Makefile
 run-make/emit-shared-files/Makefile
-run-make/emit-stack-sizes/Makefile
 run-make/emit-to-stdout/Makefile
 run-make/env-dep-info/Makefile
 run-make/export-executable-symbols/Makefile
@@ -147,7 +146,6 @@ run-make/raw-dylib-link-ordinal/Makefile
 run-make/raw-dylib-stdcall-ordinal/Makefile
 run-make/redundant-libs/Makefile
 run-make/remap-path-prefix-dwarf/Makefile
-run-make/remap-path-prefix/Makefile
 run-make/reproducible-build-2/Makefile
 run-make/reproducible-build/Makefile
 run-make/return-non-c-like-enum-from-c/Makefile
diff --git a/tests/run-make/debug-assertions/debug.rs b/tests/run-make/debug-assertions/debug.rs
index c6e4bddc34c..1f27c04a16d 100644
--- a/tests/run-make/debug-assertions/debug.rs
+++ b/tests/run-make/debug-assertions/debug.rs
@@ -1,3 +1,4 @@
+#![allow(internal_features)]
 #![feature(rustc_attrs)]
 #![deny(warnings)]
 
diff --git a/tests/run-make/emit-stack-sizes/Makefile b/tests/run-make/emit-stack-sizes/Makefile
deleted file mode 100644
index b546fcba512..00000000000
--- a/tests/run-make/emit-stack-sizes/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-include ../tools.mk
-
-# ignore-windows
-# ignore-apple
-#
-# This feature only works when the output object format is ELF so we ignore
-# Apple and Windows
-
-# check that the .stack_sizes section is generated
-all:
-	$(RUSTC) -C opt-level=3 -Z emit-stack-sizes --emit=obj foo.rs
-	size -A $(TMPDIR)/foo.o | $(CGREP) .stack_sizes
diff --git a/tests/run-make/emit-stack-sizes/rmake.rs b/tests/run-make/emit-stack-sizes/rmake.rs
new file mode 100644
index 00000000000..53cc9ee5943
--- /dev/null
+++ b/tests/run-make/emit-stack-sizes/rmake.rs
@@ -0,0 +1,23 @@
+// Running rustc with the -Z emit-stack-sizes
+// flag enables diagnostics to seek stack overflows
+// at compile time. This test compiles a rust file
+// with this flag, then checks that the output object
+// file contains the section "stack_sizes", where
+// this diagnostics information should be located.
+// See https://github.com/rust-lang/rust/pull/51946
+
+//@ ignore-windows
+//@ ignore-apple
+// Reason: this feature only works when the output object format is ELF.
+// This won't be the case on Windows/OSX - for example, OSX produces a Mach-O binary.
+
+use run_make_support::{llvm_readobj, rustc};
+
+fn main() {
+    rustc().opt_level("3").arg("-Zemit-stack-sizes").emit("obj").input("foo.rs").run();
+    llvm_readobj()
+        .arg("--section-headers")
+        .input("foo.o")
+        .run()
+        .assert_stdout_contains(".stack_sizes");
+}