immunant / IA2-Phase2

5 stars 0 forks source link

Merge `INIT_RUNTIME(n)` into `__wrap_main` and remove other redundancies #320

Open ayrtonm opened 7 months ago

ayrtonm commented 7 months ago

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.

fw-immunant commented 7 months ago

From today's meeting: another redundancy is #define IA2_COMPARTMENT N vs. -DPKEY=N; we should not require both.