From 721a24719514551da2d2396686d9e2aadd7ce9e0 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sun, 11 Sep 2022 21:08:26 +0200 Subject: [PATCH 01/10] [NativeAOT] Enable CI for macOS x64/arm64 --- eng/pipelines/runtime-extra-platforms-other.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eng/pipelines/runtime-extra-platforms-other.yml b/eng/pipelines/runtime-extra-platforms-other.yml index 95fe8858ba2ba5..6ea701939590a7 100644 --- a/eng/pipelines/runtime-extra-platforms-other.yml +++ b/eng/pipelines/runtime-extra-platforms-other.yml @@ -84,6 +84,8 @@ jobs: platforms: - windows_x64 - windows_arm64 + - OSX_x64 + - OSX_arm64 - Linux_x64 - Linux_arm64 - Linux_musl_x64 From d5c4cb91dde942554980b0c00c597d972fb969dd Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sun, 11 Sep 2022 22:37:54 +0200 Subject: [PATCH 02/10] Update CppCompilerAndLinker condition --- eng/testing/tests.singlefile.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets index 5081048c8032ca..ebe2867d78249e 100644 --- a/eng/testing/tests.singlefile.targets +++ b/eng/testing/tests.singlefile.targets @@ -21,8 +21,8 @@ $(CoreCLRILCompilerDir) $(CoreCLRCrossILCompilerDir) - clang-15 - clang-9 + clang-15 + clang-9 $(ROOTFS_DIR) $(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll $(CoreCLRAotSdkDir) From 5f2c51b7660320b2858133ac0b170a86e72a5a07 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sun, 11 Sep 2022 22:38:23 +0200 Subject: [PATCH 03/10] Enable NativeAOT osx-arm64 build in regular runtime pipeline --- eng/pipelines/runtime.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 04e209c541cfea..09b192f74b1efc 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -273,6 +273,7 @@ jobs: platforms: - windows_arm64 - Linux_arm64 + - OSX_arm64 jobParameters: testGroup: innerloop isSingleFile: true From c49d7bbd487f5e7d3676ce392e11ef838ffa5ba1 Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Mon, 12 Sep 2022 07:35:26 +0300 Subject: [PATCH 04/10] Enable cross-compilation on macOS --- .../Microsoft.DotNet.ILCompiler.SingleEntry.targets | 2 ++ .../Microsoft.NETCore.Native.Unix.targets | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index 4ea64f9b83be41..1b3d56e863c3fc 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -23,6 +23,8 @@ arm64 + x64 + $(OSHostArch) runtime.$(OSIdentifier)-$(IlcHostArch).Microsoft.DotNet.ILCompiler diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 58937c04c18da6..28b87236e7046c 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -29,11 +29,12 @@ The .NET Foundation licenses this file to you under the MIT license. libRuntime.ServerGC - $(RuntimeIdentifier) + $(RuntimeIdentifier) x86_64 - aarch64 + aarch64 + arm64 $(CrossCompileArch)-linux-gnu @@ -85,7 +86,8 @@ The .NET Foundation licenses this file to you under the MIT license. - + + From c08a6b4c2b61ec9ca2588b5cbae8bac4254fbcb7 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Tue, 13 Sep 2022 07:57:34 +0200 Subject: [PATCH 05/10] Fix HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP when cross-compiling --- eng/native/tryrun.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/native/tryrun.cmake b/eng/native/tryrun.cmake index 5c5344bd80161c..6355b0988f7ca9 100644 --- a/eng/native/tryrun.cmake +++ b/eng/native/tryrun.cmake @@ -64,7 +64,7 @@ if(DARWIN) set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 1) set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 0) set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 1) - set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 0) + set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 1) else() message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!") endif() From 6a1c98220a9ffd62636a7fe94af7f3a498f358b6 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Tue, 13 Sep 2022 08:22:12 +0200 Subject: [PATCH 06/10] Update OSVersion_ValidVersion_OSX test on NativeAOT The test tries to validate Environment.OSVersion.Version which works correctly. RuntimeInformation.RuntimeIdentifier, however, doesn't use versioned RIDs when NativeAOT is used. --- .../tests/System/EnvironmentTests.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs index 3c82cfe0032833..55c666ba0b8b4a 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs @@ -186,9 +186,13 @@ public void OSVersion_ValidVersion_OSX() { Version version = Environment.OSVersion.Version; - // verify that the Environment.OSVersion.Version matches the current RID - // As of 12.0, only major version numbers are included in the RID - Assert.Contains(version.ToString(1), RuntimeInformation.RuntimeIdentifier); + // NativeAOT hard-codes the runtime identifier at build time + if (!PlatformDetection.IsNativeAot) + { + // verify that the Environment.OSVersion.Version matches the current RID + // As of 12.0, only major version numbers are included in the RID + Assert.Contains(version.ToString(1), RuntimeInformation.RuntimeIdentifier); + } Assert.True(version.Minor >= 0, "OSVersion Minor should be non-negative"); Assert.True(version.Build >= 0, "OSVersion Build should be non-negative"); From 07b2b3a40a2ea39215338d9f4dc4284c429666ae Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Tue, 13 Sep 2022 16:42:43 +0200 Subject: [PATCH 07/10] Add hack to stop linker from corrupting DWARF CFI, bump darwin version in triple to get compact unwinding tables generated --- .../Compiler/DependencyAnalysis/ObjectWriter.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs index fb1f38266fbb1e..c18dc5f39b5c5c 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs @@ -713,6 +713,18 @@ public void EmitCFICodes(int offset) // Internal compiler error Debug.Assert(false); } + + if (_targetPlatform.OperatingSystem == TargetOS.OSX) + { + // Emit a symbol for beginning of the frame. This is workaround for ld64 + // linker bug which would produce DWARF with incorrect pcStart offsets for + // exception handling blocks if there is no symbol present for them. + // + // To make things simple we just reuse blobSymbolName and change `_lsda` + // prefix to `_fram`. + "_fram"u8.CopyTo(blobSymbolName); + EmitSymbolDef(blobSymbolName); + } } // Emit individual cfi blob for the given offset @@ -1272,7 +1284,7 @@ private static string GetLLVMTripleFromTarget(TargetDetails target) break; case TargetOS.OSX: vendor = "apple"; - sys = "darwin"; + sys = "darwin16"; abi = "macho"; break; case TargetOS.WebAssembly: From d4a521a1a37bbdc7c2e00acc5ca8539f49571e66 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Fri, 30 Sep 2022 10:19:59 +0200 Subject: [PATCH 08/10] Bump ObjWriter packages --- eng/Version.Details.xml | 64 ++++++++++++++++++++--------------------- eng/Versions.props | 32 ++++++++++----------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 14a3f8f9afda20..176c545e7e44f8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,69 +16,69 @@ https://github.com/dotnet/wcf 7f504aabb1988e9a093c1e74d8040bd52feb2f01 - + https://github.com/dotnet/llvm-project - 8688ea2538ef1287c6619d35a26b5750d355cc18 + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - 8688ea2538ef1287c6619d35a26b5750d355cc18 + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - 8688ea2538ef1287c6619d35a26b5750d355cc18 + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - 8688ea2538ef1287c6619d35a26b5750d355cc18 + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - 8688ea2538ef1287c6619d35a26b5750d355cc18 + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - 8688ea2538ef1287c6619d35a26b5750d355cc18 + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - 8688ea2538ef1287c6619d35a26b5750d355cc18 + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - 8688ea2538ef1287c6619d35a26b5750d355cc18 + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - c1304304028d603e34f6803b0740c34441f80d2e + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - c1304304028d603e34f6803b0740c34441f80d2e + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - c1304304028d603e34f6803b0740c34441f80d2e + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - 754d13817d834b716d339183e21aac7d2489c496 + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - c1304304028d603e34f6803b0740c34441f80d2e + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - c1304304028d603e34f6803b0740c34441f80d2e + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - c1304304028d603e34f6803b0740c34441f80d2e + 2e1187ef495010c65842a001f34c46006d5a01bc - + https://github.com/dotnet/llvm-project - c1304304028d603e34f6803b0740c34441f80d2e + 2e1187ef495010c65842a001f34c46006d5a01bc https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index c156052dd09503..5b1579d2d3981b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -80,14 +80,14 @@ 6.0.0 8.0.0-alpha.1.22475.4 - 1.0.0-alpha.1.22458.3 - 1.0.0-alpha.1.22458.3 - 1.0.0-alpha.1.22458.3 - 1.0.0-alpha.1.22458.3 - 1.0.0-alpha.1.22458.3 - 1.0.0-alpha.1.22458.3 - 1.0.0-alpha.1.22458.3 - 1.0.0-alpha.1.22458.3 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 6.0.0 1.1.1 @@ -206,13 +206,13 @@ 1.0.0-v3.14.0.5722 6.0.0-preview.5.21275.7 - 1.0.0-alpha.1.22431.4 - 1.0.0-alpha.1.22431.4 - 1.0.0-alpha.1.22431.4 - 1.0.0-alpha.1.22431.4 - 1.0.0-alpha.1.22431.4 - 1.0.0-alpha.1.22431.4 - 1.0.0-alpha.1.22431.4 - 1.0.0-alpha.1.22431.4 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22478.1 From fc84074ca6efda058afb5ffdc2276cbbdf3158b9 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Fri, 30 Sep 2022 17:47:21 +0200 Subject: [PATCH 09/10] Disable MessageSendTests on NativeAOT --- .../Runtime/InteropServices/ObjectiveC/MessageSendTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs index 6c45152e8fe2c7..2770abb7601c5e 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs @@ -16,6 +16,7 @@ namespace System.Runtime.InteropServices.Tests { [PlatformSpecific(TestPlatforms.OSX)] [SkipOnMono("Not currently implemented on Mono")] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))] public unsafe class MessageSendTests { private static int s_count = 1; From f652a3cc5f9e5989423dcd4df15f15fa1149f3b7 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 30 Sep 2022 13:20:05 -0700 Subject: [PATCH 10/10] Update src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs --- .../Runtime/InteropServices/ObjectiveC/MessageSendTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs index 2770abb7601c5e..1493fc255bf03a 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs @@ -16,7 +16,7 @@ namespace System.Runtime.InteropServices.Tests { [PlatformSpecific(TestPlatforms.OSX)] [SkipOnMono("Not currently implemented on Mono")] - [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))] + [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))] // https://github.com/dotnet/runtimelab/issues/155 public unsafe class MessageSendTests { private static int s_count = 1;