TODO: Support ELF

2014-04-03 | Dagger Team

Currently, the best supported object file format is mach-o, for a few different reasons, the most important being that in recent mach-o executables, there is a load command specifying the address of the main function.

There is no equivalent on ELF: the C runtime entrypoint is statically linked to the binary; the ELF entrypoint is start (or a variant thereof), which isn't really what we want to start the translation on.

There are a few alternative solutions to support ELF binaries: figuring out where the actual main function is might be doable by looking at the start function, which usually calls libc_start_main, providing us with all the information we need; however, this is somewhat messier to implement than just looking at object file format fields, which is why we chose to leave this for later. Another way would be to actually translate the start function; this would also provide support for constructor/destructor functions, which are usually called somewhere in the start function (for instance by libc_start_main).