@regehr My answer used to be Linkers and Loaders, too, but lately I've been pointing students at https://www.toolchains.net/ !
@regehr I still am constantly confused by this mess and I’ve written PE parsers like 4 times
@regehr i learned in 15-213 intro to systems programming. hilariously, frank pfenning was teaching it.
@regehr Executable and object file formats (ELF, Mach-O, PE) & debugging data formats (DWARF, PDB) in general: https://github.com/MattPD/cpplinks/blob/master/executables.md
Linking and loading in particular: https://github.com/MattPD/cpplinks/blob/master/executables.linking_loading.md
(^- both the blog post series and the talks above can be pretty good, depending on the topic).
@regehr Nowadays I would recommend reading the mold source code as a replacement for Levine's book. It also has a lot of explanatory text, e.g. the block comment at the top here is probably the best summary of how LTO works: https://github.com/rui314/mold/blob/main/elf/lto-unix.cc
@regehr Well, I am Old, so I learned about it when a.out got deprecated and I suddenly had to read the GNU binutils documentation. But I had already had something of an introduction from trying to build programs for AIX and understand what `-Bnodelcsect` was and why it was needed. Oh, and I probably spent some time trying to understand unexec() as a part of bootstrapping Emacs on some platform or other. If there was an actual book I never saw it.
@regehr I think I probably learned by reading the readelf documentation tbh, oh and maybe that post about how to make pathologically small but still valid ELF executables.
@regehr As an aside I still don't know how to get the pdb name without calling dumpbin yet :(
@regehr Although there was a required class called "systems programming", the main project of which was IIRC writing a two-pass assembler for a restricted dialect of S/360 assembly, and I for some reason thought I could do it in C++ and spent the entire course totally confused. (It didn't help that the instructor spoke barely intelligible English and the textbook was from like 1979.)
@regehr specifically this one: http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
@regehr yeah, that was (and presumably still is) the official book for the course, though i’m mostly thinking of a particular homework assignment that i’m not sure is drawn from any particular part of the book
@regehr @hovav It has links to Ian Lance Taylors 20-part Linker introduction from which I learned a lot (while at the same time reading Levines Linkers&Loaders book.
Here is Julia Evans quick recap of the content of the first half of Ians article series: https://jvns.ca/blog/2013/12/10/day-40-learning-about-linkers/
@regehr I learned these things by reading manuals and messing around. I've never read a book about a specific system or product. Maybe reading a book upfront would be more efficient, but there's no time for that when you have a problem to solve.