Horgan: Linux x86 Program Start Up
Well, __libc_start_main calls __libc_init_first, who immediately uses secret inside information to find the environment variables just after the terminating null of the argument vector and then sets a global variable __environ which __libc_start_main uses thereafter whenever it needs it including when it calls main. After the envp is established, then __libc_start_main uses the same trick and surprise! Just past the terminating null at the end of the envp array, there's another vector, the ELF auxiliary vector the loader uses to pass some information to the process. An easy way to see what's in there is to set the environment variable LD_SHOW_AUXV=1 before running the program.
Posted Nov 4, 2021 15:28 UTC (Thu)
by wtarreau (subscriber, #51152)
[Link]
Posted Nov 6, 2021 2:45 UTC (Sat)
by unixbhaskar (guest, #44758)
[Link]
Posted Nov 11, 2021 2:58 UTC (Thu)
by ncm (guest, #165)
[Link]
This is a pretty good example of Conway's Law, with various bits branching off according to who is responsible for them.
Horgan: Linux x86 Program Start Up
Horgan: Linux x86 Program Start Up
Horgan: Linux x86 Program Start Up