Build Windows arm64 version of SOS. (#754)
authorMike McLaughlin <mikem@microsoft.com>
Fri, 17 Jan 2020 00:02:10 +0000 (16:02 -0800)
committerGitHub <noreply@github.com>
Fri, 17 Jan 2020 00:02:10 +0000 (16:02 -0800)
Build Windows arm64 version of SOS.

Make sure that the "BuildArch" msbuild property is always passed to managed and native builds.

Add the arm64 SOS to the various packages and zip files.

The diasymreader package for Windows PDB support is currently disabled for arm64 waiting
for issue https://github.com/dotnet/diagnostics/issues/324 to be addressed.

.vsts-dotnet.yml
eng/Build-Native.cmd
eng/build.ps1
src/SOS/CMakeLists.txt
src/SOS/SOS.NETCore/CMakeLists.txt
src/SOS/SOS.NETCore/SOS.NETCore.csproj
src/SOS/SOS.Package/SOS.Package.csproj
src/SOS/SOS.Package/SOS.Symbol.Package.csproj
src/SOS/Strike/hostcoreclr.cpp
src/SOS/Strike/util.h
src/sos-packaging.props

index 87b5ae13dfaa6f3db0c95b8f75d643b7a8bba9fe..43ba18a7a53c5936c8164cd693eef043dc890581 100644 (file)
@@ -29,6 +29,11 @@ jobs:
           _BuildConfig: Release
           _BuildArch: arm
           _PublishArtifacts: bin/Windows_NT.arm.Release
+        Build_Release_arm64:
+          _BuildOnly: true
+          _BuildConfig: Release
+          _BuildArch: arm64
+          _PublishArtifacts: bin/Windows_NT.arm64.Release
 
 - template: /eng/build.yml
   parameters:
@@ -253,6 +258,15 @@ jobs:
         targetPath: '$(Build.SourcesDirectory)/artifacts/bin/Windows_NT.arm.Release'
       condition: succeeded()
 
+    # Windows arm64 download
+
+    - task: DownloadPipelineArtifact@2
+      displayName: Download Windows Arm64 Artifacts
+      inputs:
+        artifactName: Windows_arm64_Release
+        targetPath: '$(Build.SourcesDirectory)/artifacts/bin/Windows_NT.arm64.Release'
+      condition: succeeded()
+
     # Linux x64 download
 
     - task: DownloadPipelineArtifact@2
index e8f408238664fd2c58e75229f917d1a015ede0fb..bdd4b942a24c92916308c35640dc97de2330adcf 100644 (file)
@@ -123,6 +123,9 @@ if NOT "%__CrossArch%" == "" set __CrossComponentBinDir=%__CrossComponentBinDir%
 set "__CMakeBinDir=%__BinDir%"
 set "__CMakeBinDir=%__CMakeBinDir:\=/%"
 
+:: Common msbuild arguments
+set "__CommonBuildArgs=/v:!__Verbosity! /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% %__UnprocessedBuildArgs%"
+
 if not exist "%__BinDir%"           md "%__BinDir%"
 if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%"
 if not exist "%__LogDir%"           md "%__LogDir%"
@@ -174,13 +177,13 @@ if /i %__BuildCrossArch% EQU 1 (
 
     echo Generating Version Header
     set __GenerateVersionRestoreLog="%__LogDir%\GenerateVersionRestore.binlog"
-    "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionRestoreLog! /t:Restore /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs%
+    "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionRestoreLog! /t:Restore %__CommonBuildArgs%
     if not !errorlevel! == 0 (
         echo Generate Version Restore FAILED
         exit /b 1
     )
     set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog"
-    "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__CrossCompIntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs%
+    "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__CrossCompIntermediatesDir%\_version.h %__CommonBuildArgs%
     if not !errorlevel! == 0 (
         echo Generate Version Header FAILED
         exit /b 1
@@ -209,7 +212,7 @@ if /i %__BuildCrossArch% EQU 1 (
     set __BuildLog="%__LogDir%\Cross.Build.binlog"
 
     :: MSBuild.exe is the only one that has the C++ targets. "%__DotNetCli% msbuild" fails because VCTargetsPath isn't defined.
-    msbuild.exe %__CrossCompIntermediatesDir%\install.vcxproj /v:!__Verbosity! /bl:!__BuildLog! /p:Configuration=%__BuildType% /p:Platform=%__CrossArch% %__UnprocessedBuildArgs%
+    msbuild.exe %__CrossCompIntermediatesDir%\install.vcxproj /bl:!__BuildLog! %__CommonBuildArgs%
 
     if not !ERRORLEVEL! == 0 (
         echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details:
@@ -258,13 +261,13 @@ if %__Build% EQU 1 (
 
     echo Generating Version Header
     set __GenerateVersionRestoreLog="%__LogDir%\GenerateVersionRestore.binlog"
-    "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionRestoreLog! /t:Restore /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs%
+    "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionRestoreLog! /t:Restore %__CommonBuildArgs%
     if not !errorlevel! == 0 (
         echo Generate Version Restore FAILED
         exit /b 1
     )
     set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog"
-    "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs%
+    "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h %__CommonBuildArgs%
     if not !errorlevel! == 0 (
         echo Generate Version Header FAILED
         exit /b 1
@@ -292,7 +295,7 @@ if %__Build% EQU 1 (
     set __BuildLog="%__LogDir%\Native.Build.binlog"
 
     :: MSBuild.exe is the only one that has the C++ targets. "%__DotNetCli% msbuild" fails because VCTargetsPath isn't defined.
-    msbuild.exe %__IntermediatesDir%\install.vcxproj /v:!__Verbosity! /bl:!__BuildLog! /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs%
+    msbuild.exe %__IntermediatesDir%\install.vcxproj /bl:!__BuildLog! %__CommonBuildArgs%
 
     if not !ERRORLEVEL! == 0 (
         echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details:
index 7521165a17ac4de2ec3cd57948aff2f2cb93731f..8f32731eba9cb78aa0fbeb201f1f93312d772319 100644 (file)
@@ -52,7 +52,7 @@ if ($ci) {
 
 # Install sdk for building, restore and build managed components.
 if (-not $skipmanaged) {
-    Invoke-Expression "& `"$engroot\common\build.ps1`" -build -configuration $configuration -verbosity $verbosity /p:TestArchitectures=$architecture $remainingargs"
+    Invoke-Expression "& `"$engroot\common\build.ps1`" -build -binaryLog -configuration $configuration -verbosity $verbosity /p:BuildArch=$architecture /p:TestArchitectures=$architecture $remainingargs"
     if ($lastExitCode -ne 0) {
         exit $lastExitCode
     }
@@ -69,7 +69,7 @@ if (-not $skipnative) {
 # Run the xunit tests
 if ($test -or $dailytest) {
     if (-not $crossbuild) {
-        & "$engroot\common\build.ps1" -test -configuration $configuration -verbosity $verbosity -ci:$ci /bl:$logdir\Test.binlog /p:TestArchitectures=$architecture /p:BuildArch=$architecture /p:DailyTest=$dailyTest
+        & "$engroot\common\build.ps1" -test -configuration $configuration -verbosity $verbosity -ci:$ci /bl:$logdir\Test.binlog /p:BuildArch=$architecture /p:TestArchitectures=$architecture /p:DailyTest=$dailyTest
         if ($lastExitCode -ne 0) {
             exit $lastExitCode
         }
index 07cf24bd60b846bf213fbbe965a8b79cf20fb668..c6578d759531a29f6cb38825708484630e98cf0f 100644 (file)
@@ -11,7 +11,9 @@ if(WIN32)
   add_compile_options(/Zl) # omit default library name in .OBJ
 
   add_subdirectory(runcommand)
-  add_subdirectory(SOS.UnitTests/Debuggees/DesktopClrHost)
+  if(NOT CLR_CMAKE_TARGET_ARCH_ARM64)
+    add_subdirectory(SOS.UnitTests/Debuggees/DesktopClrHost)
+  endif()
 endif(WIN32)
 
 add_definitions(-D_SECURE_SCL=0)
index e92f5891f8abb60f9130f502e965156fd409fb63..bc8caa12d0b356d2c5635d942577e2dd77944918 100644 (file)
@@ -22,5 +22,8 @@ if(NOT ${NUGET_PACKAGES} STREQUAL "")
         set(DIASYMREADER_ARCH amd64)
     endif()
 
-    install(FILES ${NUGET_PACKAGES}/microsoft.diasymreader.native/1.7.0/runtimes/win/native/Microsoft.DiaSymReader.Native.${DIASYMREADER_ARCH}.dll DESTINATION . )
+    # Until issue https://github.com/dotnet/diagnostics/issues/324 is done there is no arm64 version of the diasymreader in this package
+    if(NOT CLR_CMAKE_TARGET_ARCH_ARM64)
+        install(FILES ${NUGET_PACKAGES}/microsoft.diasymreader.native/1.7.0/runtimes/win/native/Microsoft.DiaSymReader.Native.${DIASYMREADER_ARCH}.dll DESTINATION . )
+    endif()
 endif()
index 74decf10c1087e8fab9db132695e9710737ea9b9..d4487ca8a5582f5f87644f84a9db016961f78161 100644 (file)
@@ -12,6 +12,7 @@
   <ItemGroup>
     <PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
     <PackageReference Include="Microsoft.SymbolStore" Version="$(MicrosoftSymbolStoreVersion)" />
-    <PackageReference Include="Microsoft.DiaSymReader.Native" Version="$(MicrosoftDiaSymReaderNativePackageVersion)" Condition="'$(OS)' == 'Windows_NT'" />
+    <!-- Until issue https://github.com/dotnet/diagnostics/issues/324 is done there is no arm64 version of the diasymreader in this package -->
+    <PackageReference Include="Microsoft.DiaSymReader.Native" Version="$(MicrosoftDiaSymReaderNativePackageVersion)" Condition="'$(OS)' == 'Windows_NT' and '$(BuildArch)' != 'arm64'" />
   </ItemGroup>
 </Project>
index fa13882087d495713ae86ec79017252c0f6305c7..d429cbbbe728f027ae294116ddf18df758c05dc7 100644 (file)
@@ -41,6 +41,7 @@
                 <File Architecture="amd64" Module="win-x64\sos.dll" />
                 <File Architecture="x86"   Module="win-x86\sos.dll" />
                 <File Architecture="arm32" Module="win-arm\sos.dll" />
+                <File Architecture="arm64" Module="win-arm64\sos.dll" />
             </Files>
             <LoadTriggers>
                 <TriggerSet>
       <ZipSourceFiles Include="$(SOSNETCorePath)\*.dll">
          <TargetPath>$(GallerySubDir)\win-arm</TargetPath>
       </ZipSourceFiles>
+
+      <ZipSourceFiles Include="$(ArtifactsBinDir)Windows_NT.arm64.$(Configuration)\sos.dll">
+         <TargetPath>$(GallerySubDir)\win-arm64</TargetPath>
+      </ZipSourceFiles>
+      <!-- Commented out until issue https://github.com/dotnet/diagnostics/issues/324 is addressed
+      <ZipSourceFiles Include="$(ArtifactsBinDir)Windows_NT.arm64.$(Configuration)\Microsoft.DiaSymReader.Native.arm64.dll">
+         <TargetPath>$(GallerySubDir)\win-arm64</TargetPath>
+      </ZipSourceFiles>
+       -->
+      <ZipSourceFiles Include="$(SOSNETCorePath)\*.dll">
+         <TargetPath>$(GallerySubDir)\win-arm64</TargetPath>
+      </ZipSourceFiles>
     </ItemGroup>
 
     <Copy SourceFiles="@(ZipSourceFiles)" DestinationFolder="%(ZipSourceFiles.TargetPath)" />
       <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.arm.$(Configuration)\sos.pdb">
          <TargetPath>$(SymbolsDir)\win-arm</TargetPath>
       </ZipSymbolFiles>
+
+      <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.arm64.$(Configuration)\sos.pdb">
+         <TargetPath>$(SymbolsDir)\win-arm64</TargetPath>
+      </ZipSymbolFiles>
     </ItemGroup>
 
     <Copy SourceFiles="@(ZipSymbolFiles)" DestinationFolder="%(ZipSymbolFiles.TargetPath)" />
index c1f326b0d701271cd67100b01a4678a95ab48a95..cf0e5a0c8b3d09e108e3131be79a8fad519cd241 100644 (file)
@@ -27,6 +27,9 @@
     <None Include="$(ArtifactsBinDir)\Windows_NT.arm.$(Configuration)\sos.pdb" Pack="true" Visible="false">
       <PackagePath>$(SOSPackagePathPrefix)/win-arm</PackagePath>
     </None>
+    <None Include="$(ArtifactsBinDir)\Windows_NT.arm64.$(Configuration)\sos.pdb" Pack="true" Visible="false">
+      <PackagePath>$(SOSPackagePathPrefix)/win-arm64</PackagePath>
+    </None>
 
     <None Include="$(ArtifactsBinDir)\Linux.x64.$(Configuration)\libsosplugin.so.dbg" Pack="true" Visible="false">
       <PackagePath>$(SOSPackagePathPrefix)/linux-x64</PackagePath>
index 62e4dc194480103f947d451edcb9223478c5f5b2..ea44f8431a147f301453b58e2241ba1703a67f6f 100644 (file)
@@ -992,7 +992,7 @@ HRESULT SymbolReader::LoadSymbolsForWindowsPDB(___in IMetaDataImport* pMD, ___in
         size_t lastSlash = diasymreaderPath.rfind(DIRECTORY_SEPARATOR_CHAR_A);
         if (lastSlash == std::string::npos)
         {
-            ExtErr("Error: Failed to parse sos module name\n");
+            ExtErr("Error: Failed to parse SOS module name\n");
             return E_FAIL;
         }
         diasymreaderPath.erase(lastSlash + 1);
@@ -1001,7 +1001,7 @@ HRESULT SymbolReader::LoadSymbolsForWindowsPDB(___in IMetaDataImport* pMD, ___in
         // We now need a binder object that will take the module and return a 
         if (FAILED(Status = CreateInstanceFromPath(CLSID_CorSymBinder_SxS, IID_ISymUnmanagedBinder3, diasymreaderPath.c_str(), &g_hmoduleSymBinder, (void**)&g_pSymBinder)))
         {
-            ExtOut("SOS error: Unable to find the diasymreader module/interface %08x at %s\n", Status, diasymreaderPath.c_str());
+            ExtDbgOut("SOS error: Unable to find the diasymreader module/interface %08x at %s\n", Status, diasymreaderPath.c_str());
             return Status;
         }
         OnUnloadTask::Register(CleanupSymBinder);
index 28b6cccda185069e18b892329b98a21b2b4a6899..6c2fde13e07c7a1b136541d578415a59ec6969db 100644 (file)
@@ -97,9 +97,7 @@ DECLARE_HANDLE(OBJECTHANDLE);
 #elif defined(_ARM_)
 #define NATIVE_SYMBOL_READER_DLL "Microsoft.DiaSymReader.Native.arm.dll"
 #elif defined(_ARM64_)
-// Use diasymreader until the package has an arm64 version - issue #7360
-//#define NATIVE_SYMBOL_READER_DLL "Microsoft.DiaSymReader.Native.arm64.dll"
-#define NATIVE_SYMBOL_READER_DLL "diasymreader.dll"
+#define NATIVE_SYMBOL_READER_DLL "Microsoft.DiaSymReader.Native.arm64.dll"
 #endif
 
 // PREFIX macros - Begin
index ff43ddee83ffdccd557534fa6c6a0c42d6876e1b..de482365cb6344e44a16ba159fdde2c325acc488 100644 (file)
       <PackagePath>$(SOSPackagePathPrefix)/win-arm</PackagePath>
     </None>
 
+    <None Include="$(SOSNETCoreBinaries)" Pack="true" Visible="false">
+      <PackagePath>$(SOSPackagePathPrefix)/win-arm64</PackagePath>
+    </None>
+    <None Include="$(ArtifactsBinDir)\Windows_NT.arm64.$(Configuration)\sos.dll" Pack="true" Visible="false">
+      <PackagePath>$(SOSPackagePathPrefix)/win-arm64</PackagePath>
+    </None>
+    <!-- Commented out until issue https://github.com/dotnet/diagnostics/issues/324 is addressed
+    <None Include="$(ArtifactsBinDir)\Windows_NT.arm64.$(Configuration)\Microsoft.DiaSymReader.Native.arm64.dll" Pack="true" Visible="false">
+      <PackagePath>$(SOSPackagePathPrefix)/win-arm64</PackagePath>
+    </None>
+     -->
+
     <None Include="$(SOSNETCoreBinaries)" Pack="true" Visible="false">
       <PackagePath>$(SOSPackagePathPrefix)/linux-x64</PackagePath>
     </None>