

How statically linked programs run on Linux (2012) - arunc
http://eli.thegreenplace.net/2012/08/13/how-statically-linked-programs-run-on-linux

======
daniel-levin
Eli Bendersky's blog. It gets reposted on HN quite often _and with very, very
good reason_. It's an absolute treasure trove of technicalia. I've spent many
hours deep in his articles. On all sorts of cool technical topics, like
parsers, debuggers, cool language features, abstract math...

And I'm sure I'm not the only frequenter of HN that loves this stuff.

------
lgeek
The diagram showing the stack on program entry misses the auxiliary vector[0].

As a sidenote, I find stack diagrams more intuitive (for typical descending
stacks) when the low address is drawn at the top. This way it looks like a
real-world stack and if you need to represent some data or executable code in
the same address space it will appear in natural order, from top to bottom.

[0]
[http://articles.manugarg.com/aboutelfauxiliaryvectors.html](http://articles.manugarg.com/aboutelfauxiliaryvectors.html)

~~~
eliben
Yep, I omitted it for simplicity in the diagram, though I do mention it later
on.

------
Animats
Does Linux just map the executable into memory, and then let it load memory
fault by memory fault? Or is the entire executable, or some large portion
therof, loaded at startup?

~~~
cfallin
The loader mmap()s the file and it's demand-paged in.

------
adm_hn
Love the articles on linux internals, I wish there were more coming in HN

