Interposing the C runtime's initialization in two ways is redundant and just adds noise to user-facing code/build system changes. Since we need to interpose main we should just keep __wrap_main and call everything included by INIT_RUNTIME(n) from there if possible. A potential minor issue is how to specify the number of pkeys that will be used (is this even necessary?).
Also __wrap_main assumes that the main binary uses pkey 1. This is a reasonable, but not well-documented assumption. We should add this to the docs and possibly add a way to validate this at build or run-time.
Interposing the C runtime's initialization in two ways is redundant and just adds noise to user-facing code/build system changes. Since we need to interpose
main
we should just keep__wrap_main
and call everything included byINIT_RUNTIME(n)
from there if possible. A potential minor issue is how to specify the number of pkeys that will be used (is this even necessary?).Also
__wrap_main
assumes that the main binary uses pkey 1. This is a reasonable, but not well-documented assumption. We should add this to the docs and possibly add a way to validate this at build or run-time.