From b508b8a47acc603aac2090a0e7396a04b45c73b5 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Thu, 30 Jan 2025 16:02:59 +0200 Subject: [PATCH] fixup! build(core): allow exporting Rust functions' stack sizes --- core/Makefile | 2 -- core/SConscript.firmware | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/core/Makefile b/core/Makefile index a5b74c73862..7af1fc48951 100644 --- a/core/Makefile +++ b/core/Makefile @@ -45,7 +45,6 @@ QUIET_MODE ?= 0 TREZOR_DISABLE_ANIMATION ?= $(if $(filter 0,$(PYOPT)),1,0) STORAGE_INSECURE_TESTING_MODE ?= 0 RUST_PRINT_TYPES_SIZES ?= 0 -RUST_EMIT_STACK_SIZES ?= 0 # OpenOCD interface default. Alternative: ftdi/olimex-arm-usb-tiny-h OPENOCD_INTERFACE ?= stlink @@ -125,7 +124,6 @@ SCONS_VARS = \ PYOPT="$(PYOPT)" \ QUIET_MODE="$(QUIET_MODE)" \ RUST_PRINT_TYPES_SIZES="$(RUST_PRINT_TYPES_SIZES)" \ - RUST_EMIT_STACK_SIZES="$(RUST_EMIT_STACK_SIZES)" \ SCM_REVISION="$(SCM_REVISION)" \ STORAGE_INSECURE_TESTING_MODE="$(STORAGE_INSECURE_TESTING_MODE)" \ THP="$(THP)" \ diff --git a/core/SConscript.firmware b/core/SConscript.firmware index a6a0fced555..ce6ee5867b5 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -794,11 +794,11 @@ def cargo_build(): # see https://nnethercote.github.io/perf-book/type-sizes.html#measuring-type-sizes for more details env.Append(ENV={'RUSTFLAGS': '-Z print-type-sizes'}) - if ARGUMENTS.get('RUST_EMIT_STACK_SIZES', '0') == '1': - # see the following links for more details: - # - https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/emit-stack-sizes.html - # - https://blog.japaric.io/stack-analysis/ - env.Append(ENV={'RUSTFLAGS': '-Z emit-stack-sizes'}) + # Adds an ELF section with Rust functions' stack sizes. See the following links for more details: + # - https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/emit-stack-sizes.html + # - https://blog.japaric.io/stack-analysis/ + # - https://github.com/japaric/stack-sizes/ + env.Append(ENV={'RUSTFLAGS': '-Z emit-stack-sizes'}) bindgen_macros = tools.get_bindgen_defines(env.get("CPPDEFINES"), ALLPATHS) build_dir = str(Dir('.').abspath)