Disable native image usage for collectible assemblies (dotnet/coreclr#21378)
* Disable native image usage for collectible assemblies
There are couple of issues with using native images as collectible
assemblies. The most important one is that statics handling is different
for collectible and non-collectible classes. Collectible classes have
statics stored in per class allocated blocks while the non-collectible ones
are all stored per module. So the code that accesses them needs to use
different offsets relative to a statics base address in each of these cases.
The crossgen generates just a single form of code that corresponds to the
non-collectible case and so such code cannot be used when a module is
loaded as collectible.
To mitigate that, we disable using the native code from crossgen-ed
assemblies and JIT all the code instead.
We may want to revisit this in the future and e.g. unify the statics
handling for collectible and non-collectible classes.
Commit migrated from https://github.com/dotnet/coreclr/commit/
f940ccc633088d657e6d34c1e56bb0f0be4a4a73