[aot] Avoid `mono_defaults` when creating trampolines. (#32904)
authormonojenkins <jo.shields+jenkins@xamarin.com>
Thu, 27 Feb 2020 07:57:19 +0000 (02:57 -0500)
committerGitHub <noreply@github.com>
Thu, 27 Feb 2020 07:57:19 +0000 (08:57 +0100)
commit3266e9af9e9a0eb0871ead2cb896fb2ef798746f
treefce9d9360e8e45646146322e9b9d5074fa75c229
parent40e44e7ed07071bd2606b51cf0ac7071a23e3075
[aot] Avoid `mono_defaults` when creating trampolines. (#32904)

Fixes https://github.com/mono/mono/issues/19009.

https://github.com/mono/mono/pull/18505 made PLT initialization occur at
image load time. When initializing the PLT for mscorlib,
`mono_defaults.corlib` is not yet initialized.

This change works around this by using `mscorlib_aot_module`--which is
initialized relatively early--instead of `mono_defaults.corlib`. PLT
initialization is also moved slightly later: it now happens after
`use_page_trampolines` has been initialized. The `USE_PAGE_TRAMPOLINES`
macro has also been changed to dereference `mscorlib_aot_module`.

This commit also removes an unused parameter from
`mono_aot_create_specific_trampoline`.

Co-authored-by: imhameed <imhameed@microsoft.com>
src/mono/mono/mini/aot-runtime.c
src/mono/mono/mini/aot-runtime.h
src/mono/mono/mini/mini-trampolines.c