Skip to content

Commit c331c54

Browse files
committed
Enable hosted builds on arm64
With this commit, I can build core-sdk on RHEL 8 on arm64 directly, without cross compilation. Bump the sourcelink version to pick up the ability to parse git info without depending on libgit2sharp. This allows sourcelink to work on arm64. The version is the same as the one recently added to core-setup: dotnet/core-setup#7696 Introduce a new 'HostArch' msbuild property that contains the host architecture (arm64, x64, etc). This is the architecture of the currently running machine, and may be different from the architecture we are targetting in the case of cross compilation. Use HostArch to determine whether _crossDir and LibCLRJitRid need to be special-cased for arm64 or or not.
1 parent 9df6ca6 commit c331c54

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
<PackageLicenseExpression>MIT</PackageLicenseExpression>
88
</PropertyGroup>
99

10+
<PropertyGroup>
11+
<HostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</HostArch>
12+
<Architecture Condition="'$(Architecture)' == ''">$(HostArch)</Architecture>
13+
</PropertyGroup>
14+
1015
<PropertyGroup>
1116
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
1217
<DebugType>embedded</DebugType>

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<VersionToolsVersion>$(BuildTasksFeedToolVersion)</VersionToolsVersion>
8888
<DotnetDebToolVersion>2.0.0</DotnetDebToolVersion>
8989
<MicrosoftNETTestSdkVersion>15.8.0</MicrosoftNETTestSdkVersion>
90-
<MicrosoftSourceLinkVersion>1.0.0-beta2-18618-05</MicrosoftSourceLinkVersion>
90+
<MicrosoftSourceLinkVersion>1.0.0-beta2-19367-01</MicrosoftSourceLinkVersion>
9191
</PropertyGroup>
9292
<PropertyGroup>
9393
<!-- pinned dependency. This package is not being produced outside of the 2.0 branch of corefx and should not change. -->

src/redist/targets/Crossgen.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
<PropertyGroup>
77
<RuntimeNETCoreAppPackageName>runtime.$(SharedFrameworkRid).microsoft.netcore.app</RuntimeNETCoreAppPackageName>
8-
<_crossDir Condition="'$(Architecture)' == 'arm64'">/x64_arm64</_crossDir>
8+
<_crossDir Condition="'$(Architecture)' == 'arm64' and '$(HostArch)' == 'x64'">/x64_arm64</_crossDir>
99
<_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">/x86_arm</_crossDir>
1010
<_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'linux'">/x64_arm</_crossDir>
1111
<CrossgenPath>$(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppPackageVersion)/tools$(_crossDir)/crossgen$(ExeExtension)</CrossgenPath>
12-
<LibCLRJitRid Condition="!$(Architecture.StartsWith('arm'))">$(SharedFrameworkRid)</LibCLRJitRid>
13-
<LibCLRJitRid Condition="'$(Architecture)' == 'arm64'">x64_arm64</LibCLRJitRid>
12+
<LibCLRJitRid Condition="'$(Architecture)' == 'arm64' and '$(HostArch)' == 'x64'">x64_arm64</LibCLRJitRid>
1413
<LibCLRJitRid Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">x86_arm</LibCLRJitRid>
1514
<LibCLRJitRid Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'linux'">x64_arm</LibCLRJitRid>
15+
<LibCLRJitRid Condition="'$(LibCLRJitRid)' == ''">$(SharedFrameworkRid)</LibCLRJitRid>
1616
<LibCLRJitPath>$(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppPackageVersion)/runtimes/$(LibCLRJitRid)/native/$(DynamicLibPrefix)clrjit$(DynamicLibExtension)</LibCLRJitPath>
1717
<SharedFrameworkNameVersionPath>$(RedistLayoutPath)shared/$(SharedFrameworkName)/$(MicrosoftNETCoreAppPackageVersion)</SharedFrameworkNameVersionPath>
1818
<DIASymReaderCrossgenFilter>*</DIASymReaderCrossgenFilter>

0 commit comments

Comments
 (0)