Re:Show HN: Tiny 1k Rust binary on Windows
by userbinator on Tuesday December 01, 2020 @09:36AM
(#25265491)
You just need to add some compiler options; /MD should get the size down quite a bit already, then decrease the file alignment and merge sections together:
That produced a 1.5K binary, which with a custom stub should reach 1K.
[ Parent
| on HN ]
Re:Show HN: Tiny 1k Rust binary on Windows
by simlevesque on Tuesday December 01, 2020 @09:43AM
(#25265561)
So the point is moot, you can't have a simple 1k C example.
Re:Show HN: Tiny 1k Rust binary on Windows
by ChrisSD on Tuesday December 01, 2020 @11:10AM
(#25266416)
Have you actually tried this? Merging .data into .text doesn't work. The binary doesn't run and there's this link warning:
> LINK : warning LNK4254: section '.data' (C0000040) merged into '.text' (60000020) with different attributes
Re:Show HN: Tiny 1k Rust binary on Windows
by mcountryman on Tuesday December 01, 2020 @10:57AM
(#25266250)
In order to get that to 1Kb you would probably have to drop the `.idata` section and resolve syscalls from the PEB like I did.