r/linux • • Feb 19 '19

Linux x86 Program Start Up

http://dbp-consulting.com/tutorials/debugging/linuxProgramStartup.html
23 Upvotes

2 comments sorted by

12

u/matheusmoreira Feb 19 '19 edited Feb 21 '19

This assumes your Linux program is linked to a C library. The symbols are probably specific to glibc. So a more accurate title would be "GNU/Linux x86 Hosted C Program Start Up". It is possible to make a Linux program without any of those elements. I frequently wonder why programming language implementations don't do that.

The program's entry point is specified by the ELF header. The programmer can specify any function or address as the entry point by passing an option to the linker. The loader is the interpreter specified by the ELF header. The init and fini handling is surprisingly complex and sometimes I wonder if it's possible to get rid of it.

1

u/foxes708 Feb 21 '19

love this,really nice to see a deeper look at the startup process of executables in userspace