Skip to content

Commit c8f9f29

Browse files
filipnavaraam11jkotas
authored
[NativeAOT] Enable CI for macOS x64/arm64 (#75421)
* [NativeAOT] Enable CI for macOS x64/arm64 * Update CppCompilerAndLinker condition * Enable NativeAOT osx-arm64 build in regular runtime pipeline * Enable cross-compilation on macOS * Fix HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP when cross-compiling * 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. * Add hack to stop linker from corrupting DWARF CFI, bump darwin version in triple to get compact unwinding tables generated * Bump ObjWriter packages * Disable MessageSendTests on NativeAOT Co-authored-by: Adeel <[email protected]> Co-authored-by: Jan Kotas <[email protected]>
1 parent 85ddef1 commit c8f9f29

File tree

11 files changed

+82
-58
lines changed

11 files changed

+82
-58
lines changed

eng/Version.Details.xml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,69 +16,69 @@
1616
<Uri>https://github.com/dotnet/wcf</Uri>
1717
<Sha>7f504aabb1988e9a093c1e74d8040bd52feb2f01</Sha>
1818
</Dependency>
19-
<Dependency Name="runtime.linux-arm64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22458.3">
19+
<Dependency Name="runtime.linux-arm64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22478.1">
2020
<Uri>https://github.com/dotnet/llvm-project</Uri>
21-
<Sha>8688ea2538ef1287c6619d35a26b5750d355cc18</Sha>
21+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
2222
</Dependency>
23-
<Dependency Name="runtime.linux-x64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22458.3">
23+
<Dependency Name="runtime.linux-x64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22478.1">
2424
<Uri>https://github.com/dotnet/llvm-project</Uri>
25-
<Sha>8688ea2538ef1287c6619d35a26b5750d355cc18</Sha>
25+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
2626
</Dependency>
27-
<Dependency Name="runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22458.3">
27+
<Dependency Name="runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22478.1">
2828
<Uri>https://github.com/dotnet/llvm-project</Uri>
29-
<Sha>8688ea2538ef1287c6619d35a26b5750d355cc18</Sha>
29+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
3030
</Dependency>
31-
<Dependency Name="runtime.linux-musl-x64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22458.3">
31+
<Dependency Name="runtime.linux-musl-x64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22478.1">
3232
<Uri>https://github.com/dotnet/llvm-project</Uri>
33-
<Sha>8688ea2538ef1287c6619d35a26b5750d355cc18</Sha>
33+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
3434
</Dependency>
35-
<Dependency Name="runtime.win-arm64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22458.3">
35+
<Dependency Name="runtime.win-arm64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22478.1">
3636
<Uri>https://github.com/dotnet/llvm-project</Uri>
37-
<Sha>8688ea2538ef1287c6619d35a26b5750d355cc18</Sha>
37+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
3838
</Dependency>
39-
<Dependency Name="runtime.win-x64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22458.3">
39+
<Dependency Name="runtime.win-x64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22478.1">
4040
<Uri>https://github.com/dotnet/llvm-project</Uri>
41-
<Sha>8688ea2538ef1287c6619d35a26b5750d355cc18</Sha>
41+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
4242
</Dependency>
43-
<Dependency Name="runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22458.3">
43+
<Dependency Name="runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22478.1">
4444
<Uri>https://github.com/dotnet/llvm-project</Uri>
45-
<Sha>8688ea2538ef1287c6619d35a26b5750d355cc18</Sha>
45+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
4646
</Dependency>
47-
<Dependency Name="runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22458.3">
47+
<Dependency Name="runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.ObjWriter" Version="1.0.0-alpha.1.22478.1">
4848
<Uri>https://github.com/dotnet/llvm-project</Uri>
49-
<Sha>8688ea2538ef1287c6619d35a26b5750d355cc18</Sha>
49+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
5050
</Dependency>
51-
<Dependency Name="runtime.linux-arm64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22431.4">
51+
<Dependency Name="runtime.linux-arm64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22478.1">
5252
<Uri>https://github.com/dotnet/llvm-project</Uri>
53-
<Sha>c1304304028d603e34f6803b0740c34441f80d2e</Sha>
53+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
5454
</Dependency>
55-
<Dependency Name="runtime.linux-x64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22431.4">
55+
<Dependency Name="runtime.linux-x64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22478.1">
5656
<Uri>https://github.com/dotnet/llvm-project</Uri>
57-
<Sha>c1304304028d603e34f6803b0740c34441f80d2e</Sha>
57+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
5858
</Dependency>
59-
<Dependency Name="runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22431.4">
59+
<Dependency Name="runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22478.1">
6060
<Uri>https://github.com/dotnet/llvm-project</Uri>
61-
<Sha>c1304304028d603e34f6803b0740c34441f80d2e</Sha>
61+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
6262
</Dependency>
63-
<Dependency Name="runtime.linux-musl-x64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22431.4">
63+
<Dependency Name="runtime.linux-musl-x64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22478.1">
6464
<Uri>https://github.com/dotnet/llvm-project</Uri>
65-
<Sha>754d13817d834b716d339183e21aac7d2489c496</Sha>
65+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
6666
</Dependency>
67-
<Dependency Name="runtime.win-arm64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22431.4">
67+
<Dependency Name="runtime.win-arm64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22478.1">
6868
<Uri>https://github.com/dotnet/llvm-project</Uri>
69-
<Sha>c1304304028d603e34f6803b0740c34441f80d2e</Sha>
69+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
7070
</Dependency>
71-
<Dependency Name="runtime.win-x64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22431.4">
71+
<Dependency Name="runtime.win-x64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22478.1">
7272
<Uri>https://github.com/dotnet/llvm-project</Uri>
73-
<Sha>c1304304028d603e34f6803b0740c34441f80d2e</Sha>
73+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
7474
</Dependency>
75-
<Dependency Name="runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22431.4">
75+
<Dependency Name="runtime.osx.11.0-arm64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22478.1">
7676
<Uri>https://github.com/dotnet/llvm-project</Uri>
77-
<Sha>c1304304028d603e34f6803b0740c34441f80d2e</Sha>
77+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
7878
</Dependency>
79-
<Dependency Name="runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22431.4">
79+
<Dependency Name="runtime.osx.10.12-x64.Microsoft.NETCore.Runtime.JIT.Tools" Version="1.0.0-alpha.1.22478.1">
8080
<Uri>https://github.com/dotnet/llvm-project</Uri>
81-
<Sha>c1304304028d603e34f6803b0740c34441f80d2e</Sha>
81+
<Sha>2e1187ef495010c65842a001f34c46006d5a01bc</Sha>
8282
</Dependency>
8383
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.22355.1">
8484
<Uri>https://github.com/dotnet/command-line-api</Uri>

eng/Versions.props

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@
8080
<MicrosoftExtensionsDependencyModelVersion>6.0.0</MicrosoftExtensionsDependencyModelVersion>
8181
<!-- CoreClr dependencies -->
8282
<MicrosoftNETCoreILAsmVersion>8.0.0-alpha.1.22475.4</MicrosoftNETCoreILAsmVersion>
83-
<runtimelinuxarm64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22458.3</runtimelinuxarm64MicrosoftNETCoreRuntimeObjWriterVersion>
84-
<runtimelinuxx64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22458.3</runtimelinuxx64MicrosoftNETCoreRuntimeObjWriterVersion>
85-
<runtimelinuxmuslarm64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22458.3</runtimelinuxmuslarm64MicrosoftNETCoreRuntimeObjWriterVersion>
86-
<runtimelinuxmuslx64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22458.3</runtimelinuxmuslx64MicrosoftNETCoreRuntimeObjWriterVersion>
87-
<runtimewinarm64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22458.3</runtimewinarm64MicrosoftNETCoreRuntimeObjWriterVersion>
88-
<runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22458.3</runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion>
89-
<runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22458.3</runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion>
90-
<runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22458.3</runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion>
83+
<runtimelinuxarm64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22478.1</runtimelinuxarm64MicrosoftNETCoreRuntimeObjWriterVersion>
84+
<runtimelinuxx64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22478.1</runtimelinuxx64MicrosoftNETCoreRuntimeObjWriterVersion>
85+
<runtimelinuxmuslarm64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22478.1</runtimelinuxmuslarm64MicrosoftNETCoreRuntimeObjWriterVersion>
86+
<runtimelinuxmuslx64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22478.1</runtimelinuxmuslx64MicrosoftNETCoreRuntimeObjWriterVersion>
87+
<runtimewinarm64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22478.1</runtimewinarm64MicrosoftNETCoreRuntimeObjWriterVersion>
88+
<runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22478.1</runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion>
89+
<runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22478.1</runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion>
90+
<runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion>1.0.0-alpha.1.22478.1</runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion>
9191
<!-- Libraries dependencies -->
9292
<MicrosoftBclAsyncInterfacesVersion>6.0.0</MicrosoftBclAsyncInterfacesVersion>
9393
<MicrosoftBclHashCodeVersion>1.1.1</MicrosoftBclHashCodeVersion>
@@ -206,13 +206,13 @@
206206
<WixPackageVersion>1.0.0-v3.14.0.5722</WixPackageVersion>
207207
<MonoWorkloadManifestVersion>6.0.0-preview.5.21275.7</MonoWorkloadManifestVersion>
208208
<!-- JIT Tools -->
209-
<runtimelinuxarm64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22431.4</runtimelinuxarm64MicrosoftNETCoreRuntimeJITToolsVersion>
210-
<runtimelinuxx64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22431.4</runtimelinuxx64MicrosoftNETCoreRuntimeJITToolsVersion>
211-
<runtimelinuxmuslarm64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22431.4</runtimelinuxmuslarm64MicrosoftNETCoreRuntimeJITToolsVersion>
212-
<runtimelinuxmuslx64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22431.4</runtimelinuxmuslx64MicrosoftNETCoreRuntimeJITToolsVersion>
213-
<runtimewinarm64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22431.4</runtimewinarm64MicrosoftNETCoreRuntimeJITToolsVersion>
214-
<runtimewinx64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22431.4</runtimewinx64MicrosoftNETCoreRuntimeJITToolsVersion>
215-
<runtimeosx110arm64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22431.4</runtimeosx110arm64MicrosoftNETCoreRuntimeJITToolsVersion>
216-
<runtimeosx1012x64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22431.4</runtimeosx1012x64MicrosoftNETCoreRuntimeJITToolsVersion>
209+
<runtimelinuxarm64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22478.1</runtimelinuxarm64MicrosoftNETCoreRuntimeJITToolsVersion>
210+
<runtimelinuxx64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22478.1</runtimelinuxx64MicrosoftNETCoreRuntimeJITToolsVersion>
211+
<runtimelinuxmuslarm64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22478.1</runtimelinuxmuslarm64MicrosoftNETCoreRuntimeJITToolsVersion>
212+
<runtimelinuxmuslx64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22478.1</runtimelinuxmuslx64MicrosoftNETCoreRuntimeJITToolsVersion>
213+
<runtimewinarm64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22478.1</runtimewinarm64MicrosoftNETCoreRuntimeJITToolsVersion>
214+
<runtimewinx64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22478.1</runtimewinx64MicrosoftNETCoreRuntimeJITToolsVersion>
215+
<runtimeosx110arm64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22478.1</runtimeosx110arm64MicrosoftNETCoreRuntimeJITToolsVersion>
216+
<runtimeosx1012x64MicrosoftNETCoreRuntimeJITToolsVersion>1.0.0-alpha.1.22478.1</runtimeosx1012x64MicrosoftNETCoreRuntimeJITToolsVersion>
217217
</PropertyGroup>
218218
</Project>

eng/native/tryrun.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if(DARWIN)
6464
set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 1)
6565
set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 0)
6666
set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 1)
67-
set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 0)
67+
set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 1)
6868
else()
6969
message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!")
7070
endif()

eng/pipelines/runtime-extra-platforms-other.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ jobs:
8484
platforms:
8585
- windows_x64
8686
- windows_arm64
87+
- OSX_x64
88+
- OSX_arm64
8789
- Linux_x64
8890
- Linux_arm64
8991
- Linux_musl_x64

eng/pipelines/runtime.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ jobs:
273273
platforms:
274274
- windows_arm64
275275
- Linux_arm64
276+
- OSX_arm64
276277
jobParameters:
277278
testGroup: innerloop
278279
isSingleFile: true

eng/testing/tests.singlefile.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<PropertyGroup Condition="'$(TestNativeAot)' == 'true'">
2222
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
2323
<IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
24-
<CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows' and '$(RuntimeIdentifier)' == 'linux-musl-arm64'">clang-15</CppCompilerAndLinker>
25-
<CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows' and '$(RuntimeIdentifier)' != 'linux-musl-arm64'">clang-9</CppCompilerAndLinker>
24+
<CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' == 'linux' and '$(RuntimeIdentifier)' == 'linux-musl-arm64'">clang-15</CppCompilerAndLinker>
25+
<CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' == 'linux' and '$(RuntimeIdentifier)' != 'linux-musl-arm64'">clang-9</CppCompilerAndLinker>
2626
<SysRoot Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
2727
<IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
2828
<IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath>

src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
<OSHostArch Condition="$([MSBuild]::IsOSPlatform('Windows')) and
2424
$([System.Environment]::GetEnvironmentVariable('PROCESSOR_ARCHITECTURE', EnvironmentVariableTarget.Machine)) == 'ARM64'">arm64</OSHostArch>
2525

26+
<OSHostArch Condition="$([MSBuild]::IsOSPlatform('osx')) and '$(CrossBuild)' == 'true'">x64</OSHostArch>
27+
2628
<IlcHostArch Condition="'$(IlcHostArch)' == ''">$(OSHostArch)</IlcHostArch>
2729
<IlcHostPackageName>runtime.$(OSIdentifier)-$(IlcHostArch).Microsoft.DotNet.ILCompiler</IlcHostPackageName>
2830

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ The .NET Foundation licenses this file to you under the MIT license.
2929
<FullRuntimeName Condition="'$(ServerGarbageCollection)' == 'true'">libRuntime.ServerGC</FullRuntimeName>
3030

3131
<CrossCompileRid />
32-
<CrossCompileRid Condition="'$(TargetOS)' != 'OSX' and !$(RuntimeIdentifier.EndsWith('-$(OSHostArch)'))">$(RuntimeIdentifier)</CrossCompileRid>
32+
<CrossCompileRid Condition="!$(RuntimeIdentifier.EndsWith('-$(OSHostArch)'))">$(RuntimeIdentifier)</CrossCompileRid>
3333

3434
<CrossCompileArch />
3535
<CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-x64'))">x86_64</CrossCompileArch>
36-
<CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64'))">aarch64</CrossCompileArch>
36+
<CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(TargetOS)' != 'OSX'">aarch64</CrossCompileArch>
37+
<CrossCompileArch Condition="$(CrossCompileRid.EndsWith('-arm64')) and '$(TargetOS)' == 'OSX'">arm64</CrossCompileArch>
3738

3839
<TargetTriple />
3940
<TargetTriple Condition="'$(CrossCompileArch)' != ''">$(CrossCompileArch)-linux-gnu</TargetTriple>
@@ -85,7 +86,8 @@ The .NET Foundation licenses this file to you under the MIT license.
8586
<ItemGroup>
8687
<LinkerArg Include="@(NativeLibrary)" />
8788
<LinkerArg Include="--sysroot=$(SysRoot)" Condition="'$(SysRoot)' != ''" />
88-
<LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetTriple)' != ''" />
89+
<LinkerArg Include="--target=$(TargetTriple)" Condition="'$(TargetOS)' != 'OSX' and '$(TargetTriple)' != ''" />
90+
<LinkerArg Include="-arch $(CrossCompileArch)" Condition="'$(TargetOS)' == 'OSX' and '$(CrossCompileArch)' != ''" />
8991
<LinkerArg Include="-g" Condition="$(NativeDebugSymbols) == 'true'" />
9092
<LinkerArg Include="-Wl,--strip-debug" Condition="$(NativeDebugSymbols) != 'true' and '$(TargetOS)' != 'OSX'" />
9193
<LinkerArg Include="-Wl,-rpath,'$(IlcRPath)'" />

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,18 @@ public void EmitCFICodes(int offset)
713713
// Internal compiler error
714714
Debug.Assert(false);
715715
}
716+
717+
if (_targetPlatform.OperatingSystem == TargetOS.OSX)
718+
{
719+
// Emit a symbol for beginning of the frame. This is workaround for ld64
720+
// linker bug which would produce DWARF with incorrect pcStart offsets for
721+
// exception handling blocks if there is no symbol present for them.
722+
//
723+
// To make things simple we just reuse blobSymbolName and change `_lsda`
724+
// prefix to `_fram`.
725+
"_fram"u8.CopyTo(blobSymbolName);
726+
EmitSymbolDef(blobSymbolName);
727+
}
716728
}
717729

718730
// Emit individual cfi blob for the given offset
@@ -1272,7 +1284,7 @@ private static string GetLLVMTripleFromTarget(TargetDetails target)
12721284
break;
12731285
case TargetOS.OSX:
12741286
vendor = "apple";
1275-
sys = "darwin";
1287+
sys = "darwin16";
12761288
abi = "macho";
12771289
break;
12781290
case TargetOS.WebAssembly:

src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,13 @@ public void OSVersion_ValidVersion_OSX()
186186
{
187187
Version version = Environment.OSVersion.Version;
188188

189-
// verify that the Environment.OSVersion.Version matches the current RID
190-
// As of 12.0, only major version numbers are included in the RID
191-
Assert.Contains(version.ToString(1), RuntimeInformation.RuntimeIdentifier);
189+
// NativeAOT hard-codes the runtime identifier at build time
190+
if (!PlatformDetection.IsNativeAot)
191+
{
192+
// verify that the Environment.OSVersion.Version matches the current RID
193+
// As of 12.0, only major version numbers are included in the RID
194+
Assert.Contains(version.ToString(1), RuntimeInformation.RuntimeIdentifier);
195+
}
192196

193197
Assert.True(version.Minor >= 0, "OSVersion Minor should be non-negative");
194198
Assert.True(version.Build >= 0, "OSVersion Build should be non-negative");

src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ObjectiveC/MessageSendTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace System.Runtime.InteropServices.Tests
1616
{
1717
[PlatformSpecific(TestPlatforms.OSX)]
1818
[SkipOnMono("Not currently implemented on Mono")]
19+
[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))] // https://github.com/dotnet/runtimelab/issues/155
1920
public unsafe class MessageSendTests
2021
{
2122
private static int s_count = 1;

0 commit comments

Comments
 (0)