3 ms·
Oh cool. I stumbled across this a while back and got inspired wrote some ELFs in gas (GNU assembler). It's surprisingly straightforward and there's even a manpa
by xelxebar 7y ago
Oh cool. I stumbled across this a while back and got inspired wrote some ELFs in gas (GNU assembler). It's surprisingly straightforward and there's even a manpage elf(5), which is pretty much exactly the 32- and 64-bit specifications rolled into one.
If this kind of thing sounds fun to you then you'll probably want a System V ABI reference [0] to look up all the different relocations etc. Also, /etc/include/elf.h can be helpful.
The part I started having trouble with was getting dynamically linked binares working. At the time I didn't quite understand what the PLE amd GOT were, so set things down. Maybe it's time to pick this back up.
As always, the OS Dev wiki [1] is also a really good source for these kinds of low level implementation details.
[0]:http://www.sco.com/developers/gabi/latest/contents.html http://www.sco.com/developers/gabi/latest/contents.html
[1]:https://wiki.osdev.org/ https://wiki.osdev.org/
- saagarjha 7y ago> At the time I didn't quite understand what the PLE amd GOT were, so set things down. Did you mean the procedure linkage table (PLT), which contains trampolines to call addresses kept in the GOT?
- breadbox 7y agoYou might be interested in the sequel essay, which covers dynamic linking under ELF: http://www.muppetlabs.com/~breadbox/software/tiny/somewhat.html http://www.muppetlabs.com/~breadbox/software/tiny/somewhat.h...