rust-teeny-nostd: 4 KiB

This commit is contained in:
2026-06-16 22:57:36 +02:00
parent 5bc6a32c6a
commit aabd7b9d84
9 changed files with 158 additions and 3 deletions
+39
View File
@@ -0,0 +1,39 @@
alias b := build
alias s := stat
alias z := stat-size
target := "x86_64-unknown-linux-gnu"
build:
RUSTFLAGS="\
-Zunstable-options \
\
-Zlocation-detail=none -Zfmt-debug=none \
\
-Clinker=clang -Clink-arg=-fuse-ld=lld \
-Clink-arg=-Wl,--gc-sections -Clink-arg=-Wl,--as-needed -Clink-arg=-Wl,--strip-all -Clink-arg=-Wl,--build-id=none \
\
-Cpanic=immediate-abort --remap-path-prefix=$PWD=[src] \
" cargo \
\
-Zbuild-std=core,alloc,std,panic_abort \
-Zbuild-std-features="optimize_for_size" \
\
b -r --target {{ target }}
# Base, does like nothing
strip --strip-all --strip-unneeded target/{{ target }}/release/rust-teeny
# BS, I don't want these
strip -R .comment -R .note.\* target/{{ target }}/release/rust-teeny
# Only OK because we don't do unwinding
strip -R .eh_frame\* target/{{ target }}/release/rust-teeny
# Not sure why .gnu.version and .gnu.hash don't break if I remove them in my machine, but that's very relative and its related to dynamic loading, but they could reduce size by `0.2 KiB`
stat:
stat target/{{ target }}/release/rust-teeny
stat-size:
stat target/{{ target }}/release/rust-teeny -c "%s" | numfmt --to=iec-i