Try to fix issues with Unicode on big endian OSes (dotnet/coreclr#18254)
Mono had some patches in their fork of referencesource to resolve
issues on big endian. Essentially, compile-time endianness handling
is no good for big endian platforms, because they have to consume a
Monolite intended for all platforms in order to bootstrap. So then,
all big endian platforms are now consuming a bootstrap tarball made
on little endian systems, and bad things happen as a result.
This makes it so that endianness is checked at runtime by using
System.BitConverter.IsLittleEndian, not by a compiler definition.
This integrates mono/mono@
1f9b218 and mono/mono@
92cec46, which won't
apply cleanly to current CoreFX.
mono/monodotnet/coreclr#8679 may get fixed by this, but as the comments say,
there could be more patches missing. This just integrates the
patches known to me on UnicodeEncoding and UTF8Encoding.
Commit migrated from https://github.com/dotnet/coreclr/commit/
6da69e6536a596a6b2141374bd2c9e96bdebbc62