From 2edb0840f48390095d722ddb417f90ae361ef0ec Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Thu, 4 Feb 2021 13:51:36 -0500 Subject: [PATCH 1/5] Adds support for running mono tests on Apple M1 Tweaked the mono build a bit to produce arm64 binaries & Enabled CI --- eng/pipelines/libraries/helix-queues-setup.yml | 4 ++++ eng/pipelines/runtime.yml | 3 +++ src/mono/mono.proj | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index 5ec4f832af03eb..bb326b40944e01 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -94,6 +94,10 @@ jobs: - ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}: - OSX.1014.Amd64.Open - OSX.1015.Amd64.Open + + # OSX arm64 + - ${{ if eq(parameters.platform, 'OSX_x64') }}: + - OSX.1100.ARM64.Open # Android - ${{ if in(parameters.platform, 'Android_x86', 'Android_x64') }}: diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 23ff8d993fe99e..19d2df2743a033 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -463,6 +463,7 @@ jobs: buildConfig: debug platforms: - OSX_x64 + - OSX_arm64 - Linux_x64 - Linux_arm64 # - Linux_musl_arm64 @@ -567,6 +568,7 @@ jobs: buildConfig: release platforms: - OSX_x64 + - OSX_arm64 - Linux_arm64 jobParameters: condition: >- @@ -882,6 +884,7 @@ jobs: platforms: - windows_x64 - OSX_x64 + - OSX_arm64 - Linux_arm64 - Linux_x64 helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 0c7077d0e59de4..5ab37d33c9ca3e 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -199,7 +199,7 @@ <_MonoCXXFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> <_MonoLDFLAGS Condition="'$(TargetArchitecture)' == 'arm64'" Include="-arch arm64" /> - <_MonoBuildEnv Condition="'$(Platform)' == 'arm64'" Include="arch -arch arm64" /> + <_MonoBuildEnv Condition="'$(BuildArchitecture)' == 'arm64'" Include="arch -arch arm64" /> @@ -231,6 +231,9 @@ <_MonoCMakeVersionMin Condition="'$(TargetsiOS)' == 'true'">$(iOSVersionMin) <_MonoCMakeVersionMin Condition="'$(TargetstvOS)' == 'true'">$(tvOSVersionMin) + + <_MonoCMakeArgs Include="-DCMAKE_OSX_ARCHITECTURES=arm64"/> + <_MonoCMakeArgs Include="-DCMAKE_SYSTEM_NAME=$(_MonoCMakeSystemName)"/> <_MonoCMakeArgs Include="-DCMAKE_OSX_DEPLOYMENT_TARGET=$(_MonoCMakeVersionMin)" /> From e76b92dc3b906132803cb2d95a89e9462e9b7edb Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Thu, 4 Feb 2021 14:29:12 -0500 Subject: [PATCH 2/5] Cleanup unused variable --- src/mono/mono/mini/tramp-arm64.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index cab924cf77337e..8d2d1f3711dbab 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -376,7 +376,6 @@ mono_arch_get_static_rgctx_trampoline (MonoMemoryManager *mem_manager, gpointer { guint8 *code, *start; guint32 buf_len = 32; - MonoDomain *domain = mono_domain_get (); start = code = mono_mem_manager_code_reserve (mem_manager, buf_len); From 609784a01483d0cea9080440af0d3fd0cf51a888 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Thu, 4 Feb 2021 15:41:41 -0500 Subject: [PATCH 3/5] Fix typeo --- eng/pipelines/libraries/helix-queues-setup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index bb326b40944e01..382f56cc83976f 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -96,7 +96,7 @@ jobs: - OSX.1015.Amd64.Open # OSX arm64 - - ${{ if eq(parameters.platform, 'OSX_x64') }}: + - ${{ if eq(parameters.platform, 'OSX_arm64') }}: - OSX.1100.ARM64.Open # Android From 8a09274e0bea7dd66d9b60bc6e10a3256449b2ae Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Fri, 5 Feb 2021 09:36:01 -0500 Subject: [PATCH 4/5] Apply zoltan's fix --- src/mono/mono/utils/mono-sigcontext.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mono/mono/utils/mono-sigcontext.h b/src/mono/mono/utils/mono-sigcontext.h index 699af6e37d1fbf..b4be9bc4c9ff91 100644 --- a/src/mono/mono/utils/mono-sigcontext.h +++ b/src/mono/mono/utils/mono-sigcontext.h @@ -474,6 +474,9 @@ typedef struct ucontext { #else #define UCONTEXT_REG_PC(ctx) (((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__pc) #define UCONTEXT_REG_SP(ctx) (((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__sp) + #define UCONTEXT_REG_SET_PC(ctx,val) do { \ + UCONTEXT_REG_PC (ctx) = (__uint64_t)(val); \ + } while (0) #endif #define UCONTEXT_REG_R0(ctx) (((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__x [ARMREG_R0]) @@ -497,6 +500,8 @@ typedef struct ucontext { #define UCONTEXT_REG_SET_PC(ctx, val) do { \ UCONTEXT_REG_PC (ctx) = (val); \ } while (0) +#endif +#ifndef UCONTEXT_REG_SET_SP #define UCONTEXT_REG_SET_SP(ctx, val) do { \ UCONTEXT_REG_SP (ctx) = (val); \ } while (0) From 0bde2608503301b1a1d8369d0c1df6a9ea813f60 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Tue, 2 Mar 2021 19:24:21 -0500 Subject: [PATCH 5/5] Merge tweak --- eng/pipelines/libraries/helix-queues-setup.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index f56ad2f52cf634..7f66f5b0b61711 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -98,10 +98,6 @@ jobs: - ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}: - OSX.1014.Amd64.Open - OSX.1015.Amd64.Open - - # OSX arm64 - - ${{ if eq(parameters.platform, 'OSX_arm64') }}: - - OSX.1100.ARM64.Open # Android - ${{ if in(parameters.platform, 'Android_x86', 'Android_x64') }}: