program loading/execution
c++, elf, gcc, linux, llvm
Solution
Compilers and executable binaries are remotely related. (the actual executable is built by the linker `ld`, not the compiler).
On Linux systems, the linux kernel use copy-on-write and demand-paging techniques to lazily load the program pages, for ELF executables. Shared libraries may be dynamically loaded and preferably contain position independent code.
You could be interested in reading about compiler construction, Levine's book on linkers & loaders, the Linux Assembly Howto, the Program Library Howto, the ldd(1), execve(2), intro(2), fork(2), mmap(2), dlopen(3), elf(5), proc(5), signal(7) man pages.
Try also to understand what `cat /proc/self/maps` is showing you (the memory map of the process doing that `cat`). You can also play with `objdump`.
Problem
I'm a beginner in compilers but I'm very interested in learning about how a program is structured (the binary) and how it is read and loaded in memory for execution. What ebooks/books/tutorials do you guys suggest me reading for a quick start?