[mono] Add support for UnmanagedCallersOnlyAttribute (#38728)
* [marshal] Add mono_method_has_unmanaged_callers_only_attribute
* [marshal] Allow calls to mono_marshal_get_managed_wrapped without a delegate class
In that case, create a wrapper based on the signature of the method itself.
* [aot] Allow decode_method_ref to decode NATIVE_TO_MANAGED wrappers without a delegate class
Bump the AOT file format
* [interp] ldftn will return a native-to-managed wrapper to UnmanagedCallersOnly methods
* aot: emit byte when we don't expect a class
* jit: create wrapper creation for ldftn in method-to-ir
Do it at IR generation of the caller, not every time the ldftn is executed
* jit: don't create a jump trampoline for ldftn of a native-to-managed wrapper
The wrapper might be called from a thread that's not attached to the runtime, and the jump trampoline will look at TLS vars that are not initialized
* interp: transform LDFTN into LDC of a create_method_pointer for UnmanagedCallersOnly method
* marshal: throw invalid program exception for instance and generic methods
* Emit IPE throw instead of aborting JIT or interp compilation for bad UnmanagedCallersOnly methods
Instead of throwing while JITing (or transforming), throw when the LDFTN is executed.
* disallow delegate constructor calls on UnmanagedCallersOnly methods
* throw IPE if UnmanagedCallersOnly method has non-blittable args
* disallow DllImport and UnmanagedCallersOnly together
throw NotSupportedException
Co-authored-by: Ryan Lucia <ryan@luciaonline.net>