jamesmunns / irr-embedded-2018

Increasing Rust's Reach, Embedded Group, 2018
2 stars 0 forks source link

Add binary size regression tests #5

Open v-thakkar opened 6 years ago

v-thakkar commented 6 years ago

The binary size of a program, compiled with opt-level=s, is tracked over time (per PR) and the CI fails if the binary size of the program regresses. The deadline for adding these tests is September 8, 2018.

sekineh commented 6 years ago

https://internals.rust-lang.org/t/llvm-tools-a-new-rustup-component-for-binary-inspection-objdump-nm-size-and-profiling-profdata/7830

sekineh commented 6 years ago

Of course GNU version is more easily accessible now:

sekineh@sekineh-VirtualBox:~/rustme5$ arm-none-eabi-size --version
GNU size (2.26-4ubuntu1+8) 2.26
sekineh commented 6 years ago

Library crates create .rlib file which is not easy to analyze because of the lack of tooling. In addition, they are essentially compressed form of LLVM bitcodes. Not suitable for binary size checking!

So we must use 1) binary crates or 2) custom main for binary size regression tests.

jamesmunns commented 6 years ago

@sekineh you could also try building a staticlib, which would create a standard .a file. However, I am not sure how it behaves if you have not exposed the symbols (e.g. with #[no_mangle] and/or pub extern). It might be worth a check though :)

sekineh commented 6 years ago

@jamesmunns staticlib might increase the visibility of codes in target arch. In that case, we could edit Cargo.toml using sed, etc.

sekineh commented 6 years ago

The past regression: