9 ms·
Any good resources to learn about that?
by 22SAS 3y ago
Any good resources to learn about that?
- duped 3y agoThe book "Linkers an Loaders" by Levine is the Bible on the subject
- ndesaulniers 3y agoYes; but there's also descriptions of legacy container formats no one cares about any more. I still recommend it and have my own copy, I just recall skipping over quite a bit of material.
- Findecanor 3y agoIt used to be available online for free at <https://www.iecc.com/linker/ https://www.iecc.com/linker/>, but isn't any more. You could get it from archive.org though, and I think I've seen mirrors in other formats on Hacker News in previous discussions about the book.
- bluetomcat 3y ago"man 5 elf" should be the ultimate source of truth :-)
- convolvatron 3y agothe elf specification is: https://refspecs.linuxfoundation.org/elf/elf.pdf https://refspecs.linuxfoundation.org/elf/elf.pdf
- yrro 3y agoI've found that searching for stories with ELF in the title then trawling through the comments for the links is really informative.
- eddtests 3y agoI just hope they catch this Sauron before it’s too late…
- mimimi31 3y agoThere's a great summary from LWN[1] with lots of references and links to other articles for further reading. [1] https://lwn.net/Articles/631631 https://lwn.net/Articles/631631
- emidln 3y agoThe source code to the kernel's elf "binfmt"[0] is very readable. The elf binfmt is registered (along with a few others like `binfmt_misc`) and you get dispatched there via `exec_binprm`[1] which is invoked by the `execve` syscall[2]. When loading a shared library, you also dispatch to a binfmt via the `uselib`[3] syscall. [0] https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be514f4abbfc071004cbe7/fs/binfmt_elf.c#L823 https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be5... [1] https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be514f4abbfc071004cbe7/fs/exec.c#L1764 https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be5... [2] https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be514f4abbfc071004cbe7/fs/exec.c#L1812 https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be5... [3] https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be514f4abbfc071004cbe7/fs/exec.c#L158 https://github.com/torvalds/linux/blob/9fdfb15a3dbf818e06be5...
- proto_lambda 3y agoIf you're interested in or already comfortable with Rust, Amos (fasterthanlime) has a nice long-form series that goes into this, basically building a custom ELF loader in the end. The writing style isn't everyone's cup of tea, but maybe you like it: https://fasterthanli.me/series/making-our-own-executable-packer/ https://fasterthanli.me/series/making-our-own-executable-pac...
- dharmab 3y agoCPU Land is an accessible introduction. This chapter covers ELF https://cpu.land/becoming-an-elf-lord https://cpu.land/becoming-an-elf-lord