Build cross OS DACs in default Windows builds (#32322)
authorSteve MacLean <Steve.MacLean@microsoft.com>
Mon, 24 Feb 2020 21:30:29 +0000 (16:30 -0500)
committerGitHub <noreply@github.com>
Mon, 24 Feb 2020 21:30:29 +0000 (16:30 -0500)
* Build the -linuxdac Cross OS DAC by default in Windows builds

* Fix warnings treated as errors

* Fix Cross OS Dac build break introduced by #32579

src/coreclr/build.cmd
src/coreclr/src/debug/daccess/enummem.cpp
src/coreclr/src/debug/dbgutil/elfreader.cpp
src/coreclr/src/debug/dbgutil/elfreader.h

index 4f23a96..dba7308 100644 (file)
@@ -277,6 +277,15 @@ REM Determine if this is a cross-arch build. Only do cross-arch build if we're a
 
 if %__SkipCrossArchNative% EQU 0 (
     if %__BuildNative% EQU 1 (
+        if %__BuildCrossArchNative% EQU 0 (
+            if /i not "%__BuildArch%"=="x86" (
+                REM Make recursive calls to build the cross OS DAC
+                call :BuildCrossOSDac -linuxdac
+                if not !errorlevel! == 0 (
+                    goto ExitWithError
+                )
+            )
+        )
         if /i "%__BuildArch%"=="arm64" (
             set __BuildCrossArchNative=1
         )
@@ -898,6 +907,20 @@ exit /b 1
 :ExitWithCode
 exit /b !__exitCode!
 
+:BuildCrossOSDac
+setlocal
+set __BuildDacOption=%1
+set __NextCmd=call %__ThisScriptFull% %__BuildDacOption% %__BuildArch% %__BuildType% %__PassThroughArgs%
+echo %__MsgPrefix%Invoking: %__NextCmd%
+%__NextCmd%
+if not !errorlevel! == 0 (
+    echo %__MsgPrefix%    %__BuildDacOption% %__BuildArch% %__BuildType% %__PassThroughArgs%
+    endlocal
+    goto ExitWithError
+)
+endlocal
+exit /b 0
+
 :Usage
 echo.
 echo Build the CoreCLR repo.
index ec7fd1b..30eeecc 100644 (file)
@@ -200,7 +200,7 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
         return hr;
     }
     // Add the dac table memory in coreclr
-    CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED ( ReportMem(dacTableAddress, sizeof(g_dacGlobals)); )
+    CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED ( ReportMem((TADDR)dacTableAddress, sizeof(g_dacGlobals)); )
 #endif
 
     // Cannot use CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED
index 86ac8e1..737a302 100644 (file)
 #define PRId PRId64
 #define PRIA "016"
 #define PRIxA PRIA PRIx
-#define TARGET_WORDSIZE 64
 #else
 #define PRIx PRIx32
 #define PRIu PRIu32
 #define PRId PRId32
 #define PRIA "08"
 #define PRIxA PRIA PRIx
-#define TARGET_WORDSIZE 32
 #endif
 
 #ifdef HOST_UNIX
@@ -281,7 +279,7 @@ uint32_t
 ElfReader::Hash(const std::string& symbolName)
 {
     uint32_t h = 5381;
-    for (int i = 0; i < symbolName.length(); i++)
+    for (unsigned int i = 0; i < symbolName.length(); i++)
     {
         h = (h << 5) + h + symbolName[i];
     }
index 642ae2b..8002b77 100644 (file)
@@ -9,6 +9,12 @@
 #include <string>
 #include <vector>
 
+#if TARGET_64BIT
+#define TARGET_WORDSIZE 64
+#else
+#define TARGET_WORDSIZE 32
+#endif
+
 #ifndef ElfW
 /* We use this macro to refer to ELF types independent of the native wordsize.
    `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'.  */