Repository navigation
Binary size regression on msp430 due to #98582 #99685
Description
Activity
- addedC-bugCategory: This is a bug.Category: This is a bug.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
on Jul 24, 2022 - addedregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}Issue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}and removedregression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
on Jul 24, 2022 - removedI-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}Issue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
on Jul 27, 2022 - removedregression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
on Jul 29, 2022 - addedWG-llvmWorking group: LLVM backend code generationWorking group: LLVM backend code generation
on Aug 31, 2022 can you check whether #99806 does not have the same issue?
There's a try build that you can download at 2a2d919ccd8dc0e7f8c61e9e8d07f865fb05e842
@oli-obk I wasn't sure how to download the try build, so I checked out the PR, compiled it locally, and then compared it to a recent commit (48de123) I also compiled:
william@xubuntu-dtrain:~/Projects/toolchains/rust$ git fetch origin pull/99806/head:oli-fix william@xubuntu-dtrain:~/Projects/toolchains/rust$ git checkout oli-fixShort version, assuming that commit I checked is close enough, looks like #99806 does not have the same issue and is good to go :).
AT2XToli-fixmsp430-elf-size target/msp430-none-elf/release/at2xt text data bss dec hex filename 2010 2 48 2060 80c target/msp430-none-elf/release/at2xt48de123
msp430-elf-size target/msp430-none-elf/release/at2xt text data bss dec hex filename 2010 2 48 2060 80c target/msp430-none-elf/release/at2xtmsp430-sizeoli-fix+ msp430-elf-size target/msp430-none-elf/release/examples/once text data bss dec hex filename 186 0 2 188 bc target/msp430-none-elf/release/examples/once48de123
+ msp430-elf-size target/msp430-none-elf/release/examples/once text data bss dec hex filename 186 0 2 188 bc target/msp430-none-elf/release/exampleReacted by Oli SchererI wasn't sure how to download the try build
You can use rustup-toolchain-install-master with
rustup-toolchain-install-master 2a2d919ccd8dc0e7f8c61e9e8d07f865fb05e842to download thetrybuild artifacts.Thanks for checking! I'm going to go ahead and close this issue then.
@lqd I will try
rustup-toolchain-install-masterwith2a2d919ccd8dc0e7f8c61e9e8d07f865fb05e842just for completeness' sake, but... how do I get past this error?william@xubuntu-dtrain:~/Projects/embedded/msp430/msp430-size$ rustup component add rust-src --toolchain 2a2d919ccd8dc0e7f8c61e9e8d07f865fb05e842 error: 2a2d919ccd8dc0e7f8c61e9e8d07f865fb05e842 is a custom toolchainI'm pretty sure I've seen this before, but have since forgotten how to solve it (the MCVE requires
build-std=core)...IIRC you can use -c when you initially install the try build artifacts.
IIRC you can use -c when you initially install the try build artifacts.
Okay, just to make crystal clear, the try build at 2a2d919c is identical to the results I have above (i.e. no problems). Didn't think it would be different, but no harm in trying since I have all the toolchain stuff already installed.
Thanks for the help :D!
Reacted by Rémy Rakic and Oli Scherer- added a commit that references this issue
on Sep 22, 2022 - added a commit that references this issue
on Sep 25, 2022
I recently had CI start failing for some firmware I use to make sure Rust still compiles msp430 code correctly. It appears that as of #98582, Rust has stopped optimizing out dead panic code; there is no I/O device to send the panic strings to, and so panic strings- and setting up arguments to access panic strings- should be considered dead code.
Normally, the firmware size should take 1994 (1992+2) bytes:
However, the firmware size had gone up 100 bytes (2048+46 = 2094- 5% regression) before #98582 was reverted by #99495:
I've created an MVCE from the failing CI to illustrate:
Code
Instructions
Make sure the
msp430-elf-gcctoolchain is installed. Optionally installjustfor convenience.git clone https://github.com/cr1901/msp430-size. Use commit e44cf66 specifically.Compile
rustcand add your newrustctorustupusingrustup toolchain link override-name /path/to/override. Use this override for bothrustccommits in the next step.Run the below command twice (using different
targetdirs):The above command needs to be run with two different compilers:
Extra compiler artifacts can be generated like so:
Expected Results
For both Rust compiler commits, I expected to see the following output from
msp430-elf-size, with no panic strings emitted:Instead, the compiler which had PR #98582 had a different size, and a panic string for
Option::unwrap()failure was emitted into the binary:Regression Commits
Based on
git bisect, this regression was introduced by PR #98582. Specifically 728c7e8 introduced the regression. This regression was fixed by #99495. However, @oli-obk asked me to open an issue anyway.@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged
Other Context
Although I don't have numbers handy, this regression also affects
libcores compiled with thepanic_immediate_abortfeature for less marked size regression.