move calls to application init functions after crt1 entry point
commitc87a52103399135d2f57a91a8bcc749d8cb2ca83
authorRich Felker <dalias@aerifal.cx>
Tue, 22 Sep 2015 20:24:28 +0000 (22 20:24 +0000)
committerRich Felker <dalias@aerifal.cx>
Tue, 22 Sep 2015 20:24:28 +0000 (22 20:24 +0000)
tree07d5dbff936447fba9d92c26126d4652c73a8a44
parent78f430295c92ae15510082c04e537da4256aa7a7
move calls to application init functions after crt1 entry point

this change is needed to be compatible with fdpic, where some of the
main application's relocations may be performed as part of the crt1
entry point. if we call init functions before passing control, these
relocations will not yet have been performed, and the init code will
potentially make use of invalid pointers.

conceptually, no code provided by the application or third-party
libraries should run before the application entry point. the
difference is not observable to programs using the crt1 we provide,
but it could come into play if custom entry point code is used, so
it's better to be doing this right anyway.
src/env/__libc_start_main.c
src/ldso/dynlink.c