News for hackers. Stuff that matters.
Re:Where do argc and argv come from? by xandris on Monday August 10, 2020 @02:08PM (#24112207)
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.

Re:Where do argc and argv come from? by saagarjha on Monday August 10, 2020 @03:10PM (#24112874)
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.