4 ms·
Can you, though? Compiling that source on Windows using visual studio produces a 98K executable.
by m1el 6y ago
Can you, though?
Compiling that source on Windows using visual studio produces a 98K executable.
- userbinator 6y agoYou 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: /MD /link /align:4096 /filealign:512 /merge:.rdata=.text /merge:.data=.text That produced a 1.5K binary, which with a custom stub should reach 1K.
- simlevesque 6y agoSo the point is moot, you can't have a simple 1k C example.
- mcountryman 6y agoIn order to get that to 1Kb you would probably have to drop the `.idata` section and resolve syscalls from the PEB like I did.
- ChrisSD 6y agoHave 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
- deleted 6y ago[deleted]