3 ms·
As someone who started programming in DOS, where binaries are usually much smaller, it's always annoyed me a bit that compilers and linkers don't seem to even m
by userbinator 6y ago
As someone who started programming in DOS, where binaries are usually much smaller, it's always annoyed me a bit that compilers and linkers don't seem to even make the slightest effort at not putting unnecessary bytes into their outputs, with things like:
Used for explicitly requesting that the stack is executable (note in the output above, this bit is not set)
...and 42(!) section headers in a binary definitely seems overkill; a normal Windows PE file has less than half a dozen.
Nonetheless, the ELF format can be trimmed down considerably:
https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html https://www.muppetlabs.com/~breadbox/software/tiny/teensy.ht...
- ynik 6y agoWindows PE files have, in addition to the section table, also the "Data directories" which are a whole bunch of pointers into some of the sections. Some of these serve the same purposes as some ELF sections. So it's a bit unfair not to include them in the count when comparing the systems. And of course many of those 42 ELF sections are for debug info. On Windows debug information is usually stored in a separate file (.pdb), which also makes the comparison unfair. I have to admit though that Windows' handling of debug symbols is much more useful (especially when you have a symbol server).
- bregma 6y agoThat link demonstrates a file that can be loaded by the x86 Linux kernel can be trimmed down. It ends up no longer an ELF file, but the x86 Linux kernel will load it as if it is one. The whole article confuses the question of "what will a 32-bit x86 Linux kernel load?" with "what is the smallest ELF file I can make?"