[mono] Add a no-exec code manager for AOT compilation; switch Catalyst CI to JustInte...
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Wed, 2 Jun 2021 17:00:34 +0000 (13:00 -0400)
committerGitHub <noreply@github.com>
Wed, 2 Jun 2021 17:00:34 +0000 (13:00 -0400)
commit1d9ff9eff0593e3b2cc83f8aeb699ff6d05d795d
tree475d7f47bb5ab672d4cd38438102fdb2da8ef90d
parenta71ea4d112988921b4a8e4170b24ccb67953b0d4
[mono] Add a no-exec code manager for AOT compilation; switch Catalyst CI to JustInterp AOT mode (#53197)

* Initial pass at trying to run catalyst in aot interp only mode

* Cleanup

* Remove yml dup

* Incorporate changes and identify native libraries to skip during System.Diagnostics.FileVersionInfo test run

* [mini] Add a no-exec code manager for AOT compilation

   Don't allocate pages with execute permission if we're never going to be executing code.  Also don't try to toggle per-thread write protection if we're not expecting to write to executable pages.

* also set no_exec earlier and create the ALC codeman with noexec

* Don't assert on Catalyst in mono_codeman_enable_write

   We defensively also toggle the page write protect bits when resolving some AOT patch targets in mono_resolve_patch_target_ext.  Instead allow the call, but don't do anything.

* Set ENABLE_MONOTOUCH for MacCatalyst arm64.  Define MONOTOUCH in one place

* [aot] mscorlib.dll isn't CoreLib on netcore

   It's a forwarding assembly.  Don't treat it specially

* [testing] In JustInterp mode, only AOT System.Private.CoreLib

   We only need to AOT the trampolines in System.Private.CoreLib in interpreter-only mode.  We don't need to AOT any of the user code in other assemblies.

   Side effect: fixes the System.Runtime.Loader.DefaultContext testsuite in JustInterp mode.  Still broken in Full AOT mode. (That testsuite references the System.Runtime.Loader.Noop.Assembly assembly, but with a different filename
System.Runtime.Loader.Noop.Assembly_test.dll which causes linking errors due to incorrect symbols in AOT module registration in AppleAppBuilder)

* Update iOS sample to use JustInterp

   and adhoc signing

* Don't run iOS sample on the CI build machine

* Disable some tests

Fixes https://github.com/dotnet/runtime/issues/53106

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
Co-authored-by: Steve Pfister <steve@Steves-M1.fios-router.home>
20 files changed:
eng/pipelines/runtime-staging.yml
eng/testing/tests.mobile.targets
src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj
src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs
src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs
src/libraries/System.Linq.Expressions/tests/InterpreterTests.cs
src/mono/CMakeLists.txt
src/mono/Directory.Build.props
src/mono/mono/metadata/memory-manager.c
src/mono/mono/mini/aot-compiler.c
src/mono/mono/mini/aot-runtime.c
src/mono/mono/mini/mini-runtime.c
src/mono/mono/utils/mono-codeman.c
src/mono/mono/utils/mono-codeman.h
src/mono/mono/utils/mono-mmap.c
src/mono/sample/iOS/Makefile
src/mono/sample/iOS/Program.csproj
src/tasks/AppleAppBuilder/AppleAppBuilder.cs
src/tasks/AppleAppBuilder/Templates/runtime.m
src/tasks/AppleAppBuilder/Xcode.cs