3 ms·
It is indeed quite fun and educational to figure out how to construct an executable from scratch. I managed to do it for MachO and ELF executables a while back,
by foldr 3y ago
It is indeed quite fun and educational to figure out how to construct an executable from scratch. I managed to do it for MachO and ELF executables a while back, and got some 'Hello World' style programs working. Ten or twenty years ago it would have been a bit easier, but modern executables are quite complex – especially if you are dynamically linking libc.
As a strategy for implementing a compiler it does introduce a heavy maintenance burden. MacOS, for example, is constantly adding new requirements on valid executables and will often refuse to execute perfectly valid executables from only a few versions back.