I'm wondering if our binaries have really bloated this much, or if there was something the old GCC's did that we no longer get "for free".
On my Rocky Linux 8.5 machine with kernel 4.18.x, gcc 8.5.x, and glibc 2.28.x, the sample C program compiles to 17,800 bytes - after stripping, it's down to 6,768 bytes. 16,292 bytes in 32 bit mode, 6,148 after stripping.
To put things in perspective, the AVR ATTiny85 only has 8KB of program memory, meaning this simple "return 42" program wouldn't even fit as-is.
Seems glibc does add a considerable amount of "bloat" to the binary. I wonder what a properly "golfed" ELF binary file size would be today?
I think large chunk of it is from dynamic linker, rather than glibc. At least that appear to be the case according to "file a.out". Adding "-static" option seems to prevent that:
11 comments
[ 2.2 ms ] story [ 39.2 ms ] thread- very first, unoptimized program compiles to 15440 bytes (vs 3998 on OP's system);
- super-optimized hand-rolled assembly (tiny.s) compiles to 12780 bytes (vs 368 on OP's system).
On my Rocky Linux 8.5 machine with kernel 4.18.x, gcc 8.5.x, and glibc 2.28.x, the sample C program compiles to 17,800 bytes - after stripping, it's down to 6,768 bytes. 16,292 bytes in 32 bit mode, 6,148 after stripping.
To put things in perspective, the AVR ATTiny85 only has 8KB of program memory, meaning this simple "return 42" program wouldn't even fit as-is.
Seems glibc does add a considerable amount of "bloat" to the binary. I wonder what a properly "golfed" ELF binary file size would be today?