Skip to content

Commit 0fd8747

Browse files
committed
Clarify UPX section
1 parent 3a26f23 commit 0fd8747

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,6 @@ Available starting `1.45.0-nightly (2020-05-28)`,
4949
$ cargo +nightly build -Z strip=symbols
5050
```
5151

52-
# Compress the binary
53-
54-
[`uxp`](https://github.com/upx/upx) is a powerful tool for creating a self contained, compressed binary with no addition
55-
runtime requirements. It claims to typically reduce file size by 50-70% but the actual result depends on your
56-
executable. For our example we see a respectable 23% reduction.
57-
58-
```bash
59-
$ uxp --best --lzma target/release/min-sized-rust
60-
```
61-
62-
6352
# Optimize For Size
6453

6554
![Minimum Rust: 1.28](https://img.shields.io/badge/Minimum%20Rust%20Version-1.28-brightgreen.svg)
@@ -301,6 +290,22 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! {
301290
}
302291
```
303292

293+
# Compress the binary
294+
295+
Up until this point, all size-reducing techniques were Rust-specific. This section describes
296+
a language-agnostic binary packing tool that is an option to reduce binary size further.
297+
298+
[UPX](https://github.com/upx/upx) is a powerful tool for creating a self contained, compressed
299+
binary with no addition runtime requirements. It claims to typically reduce binary size by 50-70%,
300+
but the actual result depends on your executable.
301+
302+
```bash
303+
$ upx --best --lzma target/release/min-sized-rust
304+
```
305+
306+
It should be noted that there have been times that UPX-packed binaries have flagged
307+
heuristic-based anti-virus software because malware often uses UPX.
308+
304309
# Tools
305310

306311
- [`cargo-bloat`](https://github.com/RazrFalcon/cargo-bloat) - Find out what takes most of the

0 commit comments

Comments
 (0)