-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_outputs.sh
executable file
·24 lines (19 loc) · 1.59 KB
/
generate_outputs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
opt_levels=("z" "3")
rg_size_filter=".text|.rodata|section"
rg_nm_filter=" t | r " # Local text and rodata
mkdir -p outputs
for opt_level in ${opt_levels[@]}; do
echo "base - $opt_level"
RUSTFLAGS="-C opt-level=$opt_level" cargo +nightly build --release
llvm-size -A ./target/thumbv7em-none-eabihf/release/rust-embedded-size-tester | rg "$rg_size_filter" >outputs/$opt_level-base.txt
llvm-nm -S --size-sort -r -t d ./target/thumbv7em-none-eabihf/release/rust-embedded-size-tester | rg "$rg_nm_filter" | rustfilt >> outputs/$opt_level-base.txt
echo "panic_abort - $opt_level"
RUSTFLAGS="-C opt-level=$opt_level" cargo +nightly build --release -Z unstable-options -Z build-std="panic_abort,core" -Z build-std-features="panic_immediate_abort"
llvm-size -A ./target/thumbv7em-none-eabihf/release/rust-embedded-size-tester | rg "$rg_size_filter" >outputs/$opt_level-panic_abort.txt
llvm-nm -S --size-sort -r -t d ./target/thumbv7em-none-eabihf/release/rust-embedded-size-tester | rg "$rg_nm_filter" | rustfilt >> outputs/$opt_level-panic_abort.txt
echo "opt_for_size - $opt_level"
RUSTFLAGS="-C opt-level=$opt_level" cargo +stage1 build --release -Z unstable-options -Z build-std="panic_abort,core" -Z build-std-features="panic_immediate_abort,optimize_for_size"
llvm-size -A ./target/thumbv7em-none-eabihf/release/rust-embedded-size-tester | rg "$rg_size_filter" >outputs/$opt_level-opt_for_size.txt
llvm-nm -S --size-sort -r -t d ./target/thumbv7em-none-eabihf/release/rust-embedded-size-tester | rg "$rg_nm_filter" | rustfilt >> outputs/$opt_level-opt_for_size.txt
done