2 ms·
I get 8392 bytes on MacOS. $ echo 'main(){puts("hello, world");}' | cc -fno-PIE -m32 -w -xc - && wc -c a.out 8392 a.out (Other code generation and l
by smitherfield 9y ago
I get 8392 bytes on MacOS.
$ echo 'main(){puts("hello, world");}' | cc -fno-PIE -m32 -w -xc - && wc -c a.out
8392 a.out
(Other code generation and linker options,[1] GCC instead of Clang, different C/C++ standards, printf(3) or write(2) instead of puts(3) and `void main()` instead of `int main()` all had no effect on the binary size).
[1] I tried all the ones listed here, although I didn't try the more exotic methods at the end: http://ptspts.blogspot.com/2013/12/how-to-make-smaller-c-and-c-binaries.html http://ptspts.blogspot.com/2013/12/how-to-make-smaller-c-and...