rewrite emit-stack-sizes to rmake

This commit is contained in:
Oneirical 2024-06-21 15:05:54 -04:00
parent cb1281b76d
commit 133b47ab38
4 changed files with 24 additions and 14 deletions

View File

@ -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

View File

@ -1,3 +1,4 @@
#![allow(internal_features)]
#![feature(rustc_attrs)]
#![deny(warnings)]

View File

@ -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

View File

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