Hacker News new | ask | show | jobs
by asveikau 1396 days ago
I think your last paragraph is wrong. crt0.o is static even when linking to libc.so dynamically. The ELF format has something in the headers for an entry point which will point at _start in your own binary, not in libc.so.

I'm pretty sure it works that way on windows too, but they call the symbol mainCRTStartup or some such.

1 comments

What, exactly, is wrong?

The point I am making is that crt0.o usually comes from libc, even if it is linked separately.

I suspect that the loader expects the ELF entry point to be an address in the application, not a dynamically linked library, which is why crt0.o must be statically linked.