Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

At least on the toolchains I'm familiar with, the linker will insert crt0.o, a very basic part of the C runtime, which contains a _start implementation that pulls argc, argv, and envp from the stack:

https://en.wikipedia.org/wiki/Crt0

So it's not really part of the "compiler" itself, it's usually an object file the linker includes in the linking job on your behalf.



Interestingly, macOS doesn't provide a crt0.o: execution begins in dyld for most programs, which calls the normal program entrypoint (usually main). Linux will do this too if you are dynamically linked.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: