From 77af897c9b8b29205885c8a50160a2585630f60d Mon Sep 17 00:00:00 2001 From: Miguel Young de la Sota Date: Wed, 4 Mar 2020 13:58:53 -0500 Subject: [PATCH 1/2] rust: disable frame points in the Tock kernel Disabling frame pointer accounting in rustc has a significant impact on binary size. For ARM cores, this tends to drop size by 2-3%, but on RISC-V cores, we see size improvements of 9-10%. This change disables frame pointers, which appear to be otherwise unused, as a binary sliming measure. --- boards/Makefile.common | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/Makefile.common b/boards/Makefile.common index 0d4eae0f2c..5613b2f414 100644 --- a/boards/Makefile.common +++ b/boards/Makefile.common @@ -16,7 +16,8 @@ RUSTUP ?= rustup # lld the actual page size so it doesn't have to be conservative. RUSTFLAGS_FOR_CARGO_LINKING ?= -C link-arg=-Tlayout.ld -C linker=rust-lld \ -C linker-flavor=ld.lld -C relocation-model=dynamic-no-pic \ --C link-arg=-zmax-page-size=512 +-C link-arg=-zmax-page-size=512 \ +-C force-frame-pointers=no # Disallow warnings for continuous integration builds. Disallowing them here # ensures that warnings during testing won't prevent compilation from succeeding. From 4a3051ff4f3ba3a8bd666fd81869f3ca3d70c346 Mon Sep 17 00:00:00 2001 From: Amit Levy Date: Thu, 12 Mar 2020 15:43:20 -0400 Subject: [PATCH 2/2] Fix spacing nits --- boards/Makefile.common | 2 -- 1 file changed, 2 deletions(-) diff --git a/boards/Makefile.common b/boards/Makefile.common index a7621282ab..3e63b338d3 100644 --- a/boards/Makefile.common +++ b/boards/Makefile.common @@ -15,7 +15,6 @@ RUSTUP ?= rustup # lld uses the page size to align program sections. It defaults to 4096 and this # puts a gap between before the .relocate section. `zmax-page-size=512` tells # lld the actual page size so it doesn't have to be conservative. - # # We use `remap-path-prefix` to remove user-specific filepath strings for error # reporting from appearing in the generated binary. @@ -28,7 +27,6 @@ RUSTFLAGS_FOR_CARGO ?= \ -C force-frame-pointers=no \ --remap-path-prefix=$(MAKEFILE_PARENT_PATH)= \ - # Disallow warnings for continuous integration builds. Disallowing them here # ensures that warnings during testing won't prevent compilation from succeeding. ifeq ($(CI),true)