Revert "Merge main to stable branch for December release (#2759)" (#2761)
authorJuan Hoyos <juan.s.hoyos@outlook.com>
Tue, 23 Nov 2021 01:24:26 +0000 (17:24 -0800)
committerGitHub <noreply@github.com>
Tue, 23 Nov 2021 01:24:26 +0000 (17:24 -0800)
This reverts commit abb55daef06719f685895e927649b3bbb069ff2f.

128 files changed:
CMakeLists.txt
NuGet.config
README.md
compileoptions.cmake [new file with mode: 0644]
crossgen.cmake [new file with mode: 0644]
diagnostics.yml
documentation/dotnet-dump-instructions.md
documentation/installing-sos-instructions.md
documentation/installing-sos-windows-instructions.md
documentation/sos-debugging-extension-windows.md
documentation/sos-debugging-extension.md
documentation/tutorial/hung_app.md
eng/Build-Native.cmd
eng/CreateVersionFile.csproj
eng/Version.Details.xml
eng/Versions.props
eng/build.sh
eng/build.yml
eng/cibuild.sh
eng/clang-compiler-override-arm.txt [new file with mode: 0644]
eng/clang-compiler-override.txt [new file with mode: 0644]
eng/common/msbuild.ps1
eng/common/post-build/sourcelink-validation.ps1
eng/common/post-build/symbols-validation.ps1
eng/common/sdl/configure-sdl-tool.ps1
eng/common/templates/job/execute-sdl.yml
eng/common/templates/job/onelocbuild.yml
eng/common/templates/job/source-build.yml
eng/common/templates/job/source-index-stage1.yml
eng/common/templates/jobs/jobs.yml
eng/cross/toolchain.cmake [new file with mode: 0644]
eng/cross/tryrun.cmake [new file with mode: 0644]
eng/empty.csproj [deleted file]
eng/gen-buildsys-clang.sh [new file with mode: 0755]
eng/gen-buildsys-win.bat [new file with mode: 0644]
eng/generateexportedsymbols.awk [new file with mode: 0644]
eng/generateversionscript.awk [new file with mode: 0644]
eng/init-distro-rid.sh [new file with mode: 0755]
eng/native/build-commons.sh [deleted file]
eng/native/configurecompiler.cmake [deleted file]
eng/native/configureoptimization.cmake [deleted file]
eng/native/configurepaths.cmake [deleted file]
eng/native/configureplatform.cmake [deleted file]
eng/native/configuretools.cmake [deleted file]
eng/native/functions.cmake [deleted file]
eng/native/gen-buildsys.cmd [deleted file]
eng/native/gen-buildsys.sh [deleted file]
eng/native/generateexportedsymbols.sh [deleted file]
eng/native/generateversionscript.sh [deleted file]
eng/native/genmoduleindex.cmd [deleted file]
eng/native/genmoduleindex.sh [deleted file]
eng/native/init-distro-rid.sh [deleted file]
eng/native/init-os-and-arch.sh [deleted file]
eng/native/init-vs-env.cmd [deleted file]
eng/native/naming.props [deleted file]
eng/native/output-toolchain-info.cmake [deleted file]
eng/native/sanitizerblacklist.txt [deleted file]
eng/native/set-cmake-path.ps1 [deleted file]
eng/native/tryrun.cmake [deleted file]
eng/native/version/NativeVersion.rc [deleted file]
eng/native/version/_version.c [deleted file]
eng/native/version/_version.h [deleted file]
eng/native/version/copy_version_files.cmd [deleted file]
eng/native/version/copy_version_files.sh [deleted file]
eng/native/version/runtime_version.h [deleted file]
eng/release/tool-list.json
eng/setup-vs-tools.cmd [new file with mode: 0644]
eng/windows-compiler-override.txt [new file with mode: 0644]
functions.cmake [new file with mode: 0644]
global.json
src/CMakeLists.txt
src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs
src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs
src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleServiceFromDataReader.cs
src/Microsoft.Diagnostics.DebugServices.Implementation/TargetFromDataReader.cs
src/Microsoft.Diagnostics.DebugServices/MemoryServiceExtensions.cs
src/Microsoft.Diagnostics.ExtensionCommands/Host/ModulesCommand.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/AggregateSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/AspNetTriggerSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/EventPipeProviderSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/GCDumpSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/HttpRequestSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/LoggingSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/MetricSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/MonitoringSourceConfiguration.cs
src/Microsoft.Diagnostics.Monitoring.EventPipe/Configuration/SampleProfilerConfiguration.cs
src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClient.cs
src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/WriteDumpFlags.cs [deleted file]
src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsIpc/IpcCommands.cs
src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsIpc/IpcTransport.cs
src/SOS/CMakeLists.txt
src/SOS/SOS.Extensions/HostServices.cs
src/SOS/SOS.Extensions/ModuleServiceFromDebuggerServices.cs
src/SOS/SOS.Extensions/TargetFromFromDebuggerServices.cs
src/SOS/SOS.Hosting/RuntimeWrapper.cs
src/SOS/SOS.Hosting/SymbolServiceWrapper.cs
src/SOS/SOS.Package/SOS.Package.csproj
src/SOS/SOS.Package/SOS.Symbol.Package.csproj
src/SOS/SOS.UnitTests/SOS.cs
src/SOS/Strike/CMakeLists.txt
src/SOS/Strike/platform/runtimeimpl.cpp
src/SOS/Strike/platform/runtimeimpl.h
src/SOS/Strike/symbols.cpp
src/SOS/dbgutil/CMakeLists.txt
src/SOS/debugshim/CMakeLists.txt
src/SOS/extensions/CMakeLists.txt
src/SOS/lldbplugin/CMakeLists.txt
src/SOS/lldbplugin/services.cpp
src/SOS/lldbplugin/services.h
src/SOS/runcommand/CMakeLists.txt
src/Tools/Directory.Build.props
src/Tools/dotnet-counters/CounterMonitor.cs
src/Tools/dotnet-counters/Exporters/JSONExporter.cs
src/Tools/dotnet-counters/Program.cs
src/Tools/dotnet-dsrouter/Program.cs
src/Tools/dotnet-dsrouter/dotnet-dsrouter.csproj
src/Tools/dotnet-dump/Dumper.cs
src/Tools/dotnet-dump/Program.cs
src/Tools/dotnet-trace/Extensions.cs
src/inc/CMakeLists.txt
src/pal/inc/pal.h
src/pal/src/CMakeLists.txt
src/pal/src/configure.cmake
src/pal/src/cruntime/misc.cpp
src/palrt/CMakeLists.txt
src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/DebugServicesTests.cs
src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/TestDataReader.cs
src/tests/dotnet-trace/ProviderParsing.cs

index 93edd88858b226281acd527523debce49332bf72..0cf3b6b94aa11b0a3137b250609ce2eb7f2bc3b6 100644 (file)
@@ -2,7 +2,7 @@
 # Licensed under the MIT license. See LICENSE file in the project root for full license information.
 
 # Verify minimum required version
-cmake_minimum_required(VERSION 3.6.2)
+cmake_minimum_required(VERSION 2.8.12)
 
 if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
   cmake_policy(SET CMP0042 NEW)
@@ -11,26 +11,8 @@ endif()
 # Set the project name
 project(diagnostics)
 
-# include shared compiler configs
-include(eng/native/configurepaths.cmake)
-include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)
-
-# override some global configs
-if (MSVC)
-  add_compile_options(/wd4960 /wd4961 /wd4603 /wd4627 /wd4838 /wd4456 /wd4457 /wd4458 /wd4459 /wd4091 /we4640)
-  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/EHsc>)
-  add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/MT>)
-  add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:/MTd>)
-else (MSVC)
-  add_compile_options(-Wno-unused-parameter)
-  add_compile_options(-Wno-unused-variable)
-  add_compile_options(-Wno-implicit-fallthrough)
-  add_compile_options(-fvisibility=default)
-endif (MSVC)
-
-# Register the default component
-set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME diagnostics)
-add_component(diagnostics)
+# Include cmake functions
+include(functions.cmake)
 
 if (WIN32)
   message(STATUS "VS_PLATFORM_TOOLSET is ${CMAKE_VS_PLATFORM_TOOLSET}")
@@ -39,18 +21,12 @@ endif (WIN32)
 
 set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 
-if (NOT WIN32)
-  # Drop the static scope for SOS, so it's available outside the
-  # compilation unit for external linkage; see extern declaration
-  # in SOS sources.
-  file(READ "${VERSION_FILE_PATH}" VERSION_FILE_CONTENTS)
-  string(REPLACE "static char" "char" VERSION_LINE_WITHOUT_STATIC "${VERSION_FILE_CONTENTS}")
-  file(WRITE "${VERSION_FILE_PATH}" "${VERSION_LINE_WITHOUT_STATIC}")
-endif (NOT WIN32)
+# Where the version source file for xplat is generated
+set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.cpp")
 
 # Where _version.h for Windows is generated
 if (WIN32)
-include_directories(${CLR_ARTIFACTS_OBJ_DIR})
+include_directories("${CMAKE_BINARY_DIR}")
 endif (WIN32)
 
 set(CORECLR_SET_RPATH ON)
@@ -62,26 +38,464 @@ endif(CORECLR_SET_RPATH)
 OPTION(CLR_CMAKE_ENABLE_CODE_COVERAGE "Enable code coverage" OFF)
 OPTION(CLR_CMAKE_WARNINGS_ARE_ERRORS "Warnings are errors" ON)
 
+# Ensure other tools are present
+if (WIN32)
+    if(CLR_CMAKE_HOST_ARCH STREQUAL arm)
+
+      # Confirm that Windows SDK is present
+      if(NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION OR CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION STREQUAL "" )
+          message(FATAL_ERROR "Windows SDK is required for the Arm32 build.")
+      else()
+          message("Using Windows SDK version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
+      endif()
+
+      # Explicitly specify the assembler to be used for Arm32 compile
+      if($ENV{__VSVersion} STREQUAL "vs2015")
+        file(TO_CMAKE_PATH "$ENV{VCINSTALLDIR}\\bin\\x86_arm\\armasm.exe" CMAKE_ASM_COMPILER)
+      else()
+        file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm\\armasm.exe" CMAKE_ASM_COMPILER)
+      endif()
+
+      set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER})
+      message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}")
+
+      # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly
+      # use ml[64].exe as the assembler.
+      enable_language(ASM)
+    else()
+      enable_language(ASM_MASM)
+    endif()
+
+    # Ensure that MC is present
+    find_program(MC mc)
+    if (MC STREQUAL "MC-NOTFOUND")
+        message(FATAL_ERROR "MC not found")
+    endif()
+
+    if (CLR_CMAKE_HOST_ARCH STREQUAL arm64)
+      # CMAKE_CXX_COMPILER will default to the compiler installed with
+      # Visual studio. Overwrite it to the compiler on the path.
+      # TODO, remove when cmake generator supports Arm64 as a target.
+      find_program(PATH_CXX_COMPILER cl)
+      set(CMAKE_CXX_COMPILER ${PATH_CXX_COMPILER})
+      message("Overwriting the CMAKE_CXX_COMPILER.")
+      message(CMAKE_CXX_COMPILER found:${CMAKE_CXX_COMPILER})
+    endif()
+
+else (WIN32)
+    enable_language(ASM)
+
+    # Ensure that awk is present
+    find_program(AWK awk)
+    if (AWK STREQUAL "AWK-NOTFOUND")
+        message(FATAL_ERROR "AWK not found")
+    endif()
+
+    # Try to locate the paxctl tool. Failure to find it is not fatal,
+    # but the generated executables won't work on a system where PAX is set
+    # to prevent applications to create executable memory mappings.
+    find_program(PAXCTL paxctl)
+
+    if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+      # Ensure that dsymutil and strip are present
+      find_program(DSYMUTIL dsymutil)
+      if (DSYMUTIL STREQUAL "DSYMUTIL-NOTFOUND")
+          message(FATAL_ERROR "dsymutil not found")
+      endif()
+
+      find_program(STRIP strip)
+      if (STRIP STREQUAL "STRIP-NOTFOUND")
+          message(FATAL_ERROR "strip not found")
+      endif()
+
+    else (CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+      # Ensure that objcopy is present
+      if (CLR_UNIX_CROSS_BUILD AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
+        if (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL mips64)
+          find_program(OBJCOPY ${TOOLCHAIN}-objcopy)
+        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
+          find_program(OBJCOPY objcopy)
+        else()
+          clr_unknown_arch()
+        endif()
+      else()
+        find_program(OBJCOPY objcopy)
+      endif()
+
+      if (OBJCOPY STREQUAL "OBJCOPY-NOTFOUND")
+          message(FATAL_ERROR "objcopy not found")
+      endif()
+
+    endif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
+endif(WIN32)
+
+#----------------------------------------
+# Detect and set platform variable names
+#     - for non-windows build platform & architecture is detected using inbuilt CMAKE variables and cross target component configure
+#     - for windows we use the passed in parameter to CMAKE to determine build arch
+#----------------------------------------
+if(CMAKE_SYSTEM_NAME STREQUAL Linux)
+    set(CLR_CMAKE_PLATFORM_UNIX 1)
+    if(CLR_CROSS_COMPONENTS_BUILD)
+        # CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host.
+        if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
+            if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm")
+                set(CLR_CMAKE_PLATFORM_UNIX_X86 1)
+            else()
+                set(CLR_CMAKE_PLATFORM_UNIX_AMD64 1)
+            endif()
+        elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL i686)
+            set(CLR_CMAKE_PLATFORM_UNIX_X86 1)
+        else()
+            clr_unknown_arch()
+        endif()
+    else()
+        # CMAKE_SYSTEM_PROCESSOR returns the value of `uname -p` on target.
+        # For the AMD/Intel 64bit architecture two different strings are common.
+        # Linux and Darwin identify it as "x86_64" while FreeBSD and netbsd uses the
+        # "amd64" string. Accept either of the two here.
+        if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
+            set(CLR_CMAKE_PLATFORM_UNIX_AMD64 1)
+        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
+            set(CLR_CMAKE_PLATFORM_UNIX_ARM 1)
+        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
+            set(CLR_CMAKE_PLATFORM_UNIX_ARM 1)
+        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
+            set(CLR_CMAKE_PLATFORM_UNIX_ARM64 1)
+        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL mips64)
+            set(CLR_CMAKE_PLATFORM_UNIX_MIPS64 1)
+        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
+            set(CLR_CMAKE_PLATFORM_UNIX_X86 1)
+        else()
+            clr_unknown_arch()
+        endif()
+    endif()
+    set(CLR_CMAKE_PLATFORM_LINUX 1)
+
+    # Detect Linux ID
+    if(DEFINED CLR_CMAKE_LINUX_ID)
+        if(CLR_CMAKE_LINUX_ID STREQUAL ubuntu)
+            set(CLR_CMAKE_TARGET_UBUNTU_LINUX 1)
+        elseif(CLR_CMAKE_LINUX_ID STREQUAL tizen)
+            set(CLR_CMAKE_TARGET_TIZEN_LINUX 1)
+        elseif(CLR_CMAKE_LINUX_ID STREQUAL alpine)
+            set(CLR_CMAKE_PLATFORM_ALPINE_LINUX 1)
+        endif()
+        if(CLR_CMAKE_LINUX_ID STREQUAL ubuntu)
+            set(CLR_CMAKE_PLATFORM_UBUNTU_LINUX 1)
+        endif()
+    endif(DEFINED CLR_CMAKE_LINUX_ID)
+endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
+
+if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+  set(CLR_CMAKE_PLATFORM_UNIX 1)
+  if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
+      set(CLR_CMAKE_PLATFORM_UNIX_AMD64 1)
+  elseif(CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
+      set(CLR_CMAKE_PLATFORM_UNIX_ARM64 1)
+  else()
+      message(FATAL_ERROR "CMAKE_OSX_ARCHITECTURES:'${CMAKE_OSX_ARCHITECTURES}'")
+      clr_unknown_arch()
+  endif()
+  set(CLR_CMAKE_PLATFORM_DARWIN 1)
+  if(CMAKE_VERSION VERSION_LESS "3.4.0")
+    set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} <FLAGS> <DEFINES> -o <OBJECT> -c <SOURCE>")
+  else()
+    set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} <FLAGS> <DEFINES> <INCLUDES> -o <OBJECT> -c <SOURCE>")
+  endif(CMAKE_VERSION VERSION_LESS "3.4.0")
+endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+  set(CLR_CMAKE_PLATFORM_UNIX 1)
+  set(CLR_CMAKE_PLATFORM_UNIX_AMD64 1)
+  set(CLR_CMAKE_PLATFORM_FREEBSD 1)
+endif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+
+if(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
+  set(CLR_CMAKE_PLATFORM_UNIX 1)
+  set(CLR_CMAKE_PLATFORM_UNIX_AMD64 1)
+  set(CLR_CMAKE_PLATFORM_OPENBSD 1)
+endif(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
+
+if(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
+  set(CLR_CMAKE_PLATFORM_UNIX 1)
+  set(CLR_CMAKE_PLATFORM_UNIX_AMD64 1)
+  set(CLR_CMAKE_PLATFORM_NETBSD 1)
+endif(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
+
+if(CMAKE_SYSTEM_NAME STREQUAL SunOS)
+  set(CLR_CMAKE_PLATFORM_UNIX 1)
+  EXECUTE_PROCESS(
+    COMMAND isainfo -n
+    OUTPUT_VARIABLE SUNOS_NATIVE_INSTRUCTION_SET
+    )
+  if(SUNOS_NATIVE_INSTRUCTION_SET MATCHES "amd64")
+    set(CLR_CMAKE_PLATFORM_UNIX_AMD64 1)
+    set(CMAKE_SYSTEM_PROCESSOR "amd64")
+  else()
+    clr_unknown_arch()
+  endif()
+  set(CLR_CMAKE_PLATFORM_SUNOS 1)
+endif(CMAKE_SYSTEM_NAME STREQUAL SunOS)
+
+#--------------------------------------------
+# This repo builds two set of binaries
+# 1. binaries which execute on target arch machine
+#        - for such binaries host architecture & target architecture are same
+#        - eg. coreclr.dll
+# 2. binaries which execute on host machine but target another architecture
+#        - host architecture is different from target architecture
+#        - eg. crossgen.exe - runs on x64 machine and generates nis targeting arm64
+#        - for complete list of such binaries refer to file crosscomponents.cmake
+#-------------------------------------------------------------
+# Set HOST architecture variables
+if(CLR_CMAKE_PLATFORM_UNIX_ARM)
+    set(CLR_CMAKE_PLATFORM_ARCH_ARM 1)
+    set(CLR_CMAKE_HOST_ARCH "arm")
+elseif(CLR_CMAKE_PLATFORM_UNIX_ARM64)
+    set(CLR_CMAKE_PLATFORM_ARCH_ARM64 1)
+    set(CLR_CMAKE_HOST_ARCH "arm64")
+elseif(CLR_CMAKE_PLATFORM_UNIX_AMD64)
+    set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
+    set(CLR_CMAKE_HOST_ARCH "x64")
+elseif(CLR_CMAKE_PLATFORM_UNIX_X86)
+    set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
+    set(CLR_CMAKE_HOST_ARCH "x86")
+elseif(CLR_CMAKE_PLATFORM_UNIX_MIPS64)
+    set(CLR_CMAKE_PLATFORM_ARCH_MIPS64 1)
+    set(CLR_CMAKE_HOST_ARCH "mips64")
+elseif(WIN32)
+    # CLR_CMAKE_HOST_ARCH is passed in as param to cmake
+    if (CLR_CMAKE_HOST_ARCH STREQUAL x64)
+        set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
+    elseif(CLR_CMAKE_HOST_ARCH STREQUAL x86)
+        set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
+    elseif(CLR_CMAKE_HOST_ARCH STREQUAL arm)
+        set(CLR_CMAKE_PLATFORM_ARCH_ARM 1)
+    elseif(CLR_CMAKE_HOST_ARCH STREQUAL arm64)
+        set(CLR_CMAKE_PLATFORM_ARCH_ARM64 1)
+    else()
+        clr_unknown_arch()
+    endif()
+endif()
+
+# Set TARGET architecture variables
+# Target arch will be a cmake param (optional) for both windows as well as non-windows build
+# if target arch is not specified then host & target are same
+if(NOT DEFINED CLR_CMAKE_TARGET_ARCH OR CLR_CMAKE_TARGET_ARCH STREQUAL "" )
+  set(CLR_CMAKE_TARGET_ARCH ${CLR_CMAKE_HOST_ARCH})
+endif()
+
+# Set target architecture variables
+if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
+    set(CLR_CMAKE_TARGET_ARCH_AMD64 1)
+  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
+    set(CLR_CMAKE_TARGET_ARCH_I386 1)
+  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
+    set(CLR_CMAKE_TARGET_ARCH_ARM64 1)
+  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm)
+    set(CLR_CMAKE_TARGET_ARCH_ARM 1)
+  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL mips64)
+    set(CLR_CMAKE_TARGET_ARCH_MIPS64 1)
+  else()
+    clr_unknown_arch()
+endif()
+
+# check if host & target arch combination are valid
+if(NOT(CLR_CMAKE_TARGET_ARCH STREQUAL CLR_CMAKE_HOST_ARCH))
+    if(NOT((CLR_CMAKE_PLATFORM_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_PLATFORM_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM)))
+        message(FATAL_ERROR "Invalid host and target arch combination")
+    endif()
+endif()
+
+#-----------------------------------------------------
+# Initialize Cmake compiler flags and other variables
+#-----------------------------------------------------
+
+if (CMAKE_CONFIGURATION_TYPES) # multi-configuration generator?
+    set(CMAKE_CONFIGURATION_TYPES "Debug;Checked;Release;RelWithDebInfo" CACHE STRING "" FORCE)
+endif (CMAKE_CONFIGURATION_TYPES)
+
+set(CMAKE_C_FLAGS_CHECKED ${CLR_C_FLAGS_CHECKED_INIT} CACHE STRING "Flags used by the compiler during checked builds.")
+set(CMAKE_CXX_FLAGS_CHECKED ${CLR_CXX_FLAGS_CHECKED_INIT} CACHE STRING "Flags used by the compiler during checked builds.")
+set(CMAKE_EXE_LINKER_FLAGS_CHECKED "")
+set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "")
+
+set(CMAKE_CXX_STANDARD_LIBRARIES "") # do not link against standard win32 libs i.e. kernel32, uuid, user32, etc.
+
+if (WIN32)
+  # For multi-configuration toolset (as Visual Studio)
+  # set the different configuration defines.
+  foreach (Config DEBUG CHECKED RELEASE RELWITHDEBINFO)
+    foreach (Definition IN LISTS CLR_DEFINES_${Config}_INIT)
+      set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:${Config}>:${Definition}>)
+    endforeach (Definition)
+  endforeach (Config)
+
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /GUARD:CF")
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /GUARD:CF")
+
+  # Linker flags
+  #
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO") #Do not create Side-by-Side Assembly Manifest
+
+  if (CLR_CMAKE_PLATFORM_ARCH_ARM)
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.02") #windows subsystem - arm minimum is 6.02
+  elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.03") #windows subsystem - arm64 minimum is 6.03
+  else ()
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.01") #windows subsystem
+  endif ()
+
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE") # can handle addresses larger than 2 gigabytes
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NXCOMPAT") #Compatible with Data Execution Prevention
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE") #Use address space layout randomization
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /PDBCOMPRESS") #shrink pdb size
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG")
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4197,4013,4254,4070,4221")
+
+  set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221")
+
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /PDBCOMPRESS")
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1572864")
+
+  # Temporarily disable incremental link due to incremental linking CFG bug crashing crossgen. 
+  # See https://github.com/dotnet/coreclr/issues/12592
+  # This has been fixed in VS 2017 Update 5 but we're keeping this around until everyone is off
+  # the versions that have the bug. The bug manifests itself as a bad crash.
+  set(NO_INCREMENTAL_LINKER_FLAGS "/INCREMENTAL:NO")  
+
+  # Debug build specific flags
+  set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/NOVCFEATURE ${NO_INCREMENTAL_LINKER_FLAGS}")
+  set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${NO_INCREMENTAL_LINKER_FLAGS}")
+
+  # Checked build specific flags
+  set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "${CMAKE_SHARED_LINKER_FLAGS_CHECKED} /OPT:REF /OPT:NOICF /NOVCFEATURE ${NO_INCREMENTAL_LINKER_FLAGS}")
+  set(CMAKE_STATIC_LINKER_FLAGS_CHECKED "${CMAKE_STATIC_LINKER_FLAGS_CHECKED}")
+  set(CMAKE_EXE_LINKER_FLAGS_CHECKED "${CMAKE_EXE_LINKER_FLAGS_CHECKED} /OPT:REF /OPT:NOICF ${NO_INCREMENTAL_LINKER_FLAGS}")
+
+  # Release build specific flags
+  set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}")
+  set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG")
+  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}")
+
+  # ReleaseWithDebugInfo build specific flags
+  set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}")
+  set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /LTCG")
+  set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}")
+
+  # Temporary until cmake has VS generators for arm64
+  if(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /machine:arm64")
+    set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /machine:arm64")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /machine:arm64")
+  endif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
+
+  # Force uCRT to be dynamically linked for Release build
+  set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
+  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
+  set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
+  set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
+
+elseif (CLR_CMAKE_PLATFORM_UNIX)
+  # Set the values to display when interactively configuring CMAKE_BUILD_TYPE
+  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG;CHECKED;RELEASE;RELWITHDEBINFO")
+
+  # Use uppercase CMAKE_BUILD_TYPE for the string comparisons below
+  string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE)
+
+  # For single-configuration toolset
+  # set the different configuration defines.
+  if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
+    # First DEBUG
+    set_property(DIRECTORY  PROPERTY COMPILE_DEFINITIONS ${CLR_DEFINES_DEBUG_INIT})
+  elseif (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
+    # Then CHECKED
+    set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS ${CLR_DEFINES_CHECKED_INIT})
+  elseif (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
+    # Then RELEASE
+    set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS ${CLR_DEFINES_RELEASE_INIT})
+  elseif (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELWITHDEBINFO)
+    # And then RELWITHDEBINFO
+    set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${CLR_DEFINES_RELWITHDEBINFO_INIT})
+  else ()
+    message(FATAL_ERROR "Unknown build type! Set CMAKE_BUILD_TYPE to DEBUG, CHECKED, RELEASE, or RELWITHDEBINFO!")
+  endif ()
+
+  # set the CLANG sanitizer flags for debug build
+  if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
+    # obtain settings from running enablesanitizers.sh
+    string(FIND "$ENV{DEBUG_SANITIZERS}" "asan" __ASAN_POS)
+    string(FIND "$ENV{DEBUG_SANITIZERS}" "ubsan" __UBSAN_POS)
+    if ((${__ASAN_POS} GREATER -1) OR (${__UBSAN_POS} GREATER -1))
+      set(CLR_SANITIZE_CXX_FLAGS "${CLR_SANITIZE_CXX_FLAGS} -fsanitize-blacklist=${CMAKE_CURRENT_SOURCE_DIR}/sanitizerblacklist.txt -fsanitize=")
+      set(CLR_SANITIZE_LINK_FLAGS "${CLR_SANITIZE_LINK_FLAGS} -fsanitize=")
+      if (${__ASAN_POS} GREATER -1)
+        set(CLR_SANITIZE_CXX_FLAGS "${CLR_SANITIZE_CXX_FLAGS}address,")
+        set(CLR_SANITIZE_LINK_FLAGS "${CLR_SANITIZE_LINK_FLAGS}address,")
+        add_definitions(-DHAS_ASAN)
+        message("Address Sanitizer (asan) enabled")
+      endif ()
+      if (${__UBSAN_POS} GREATER -1)
+        # all sanitizier flags are enabled except alignment (due to heavy use of __unaligned modifier)
+        set(CLR_SANITIZE_CXX_FLAGS "${CLR_SANITIZE_CXX_FLAGS}bool,bounds,enum,float-cast-overflow,float-divide-by-zero,function,integer,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift,unreachable,vla-bound,vptr")
+        set(CLR_SANITIZE_LINK_FLAGS "${CLR_SANITIZE_LINK_FLAGS}undefined")
+        message("Undefined Behavior Sanitizer (ubsan) enabled")
+      endif ()
+
+      # -fdata-sections -ffunction-sections: each function has own section instead of one per .o file (needed for --gc-sections)
+      # -fPIC: enable Position Independent Code normally just for shared libraries but required when linking with address sanitizer
+      # -O1: optimization level used instead of -O0 to avoid compile error "invalid operand for inline asm constraint"
+      set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CLR_SANITIZE_CXX_FLAGS} -fdata-sections -ffunction-sections -fPIC -O1")
+      set(CMAKE_CXX_FLAGS_CHECKED "${CMAKE_CXX_FLAGS_CHECKED} ${CLR_SANITIZE_CXX_FLAGS} -fdata-sections -ffunction-sections -fPIC -O1")
+
+      set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${CLR_SANITIZE_LINK_FLAGS}")
+      set(CMAKE_EXE_LINKER_FLAGS_CHECKED "${CMAKE_EXE_LINKER_FLAGS_CHECKED} ${CLR_SANITIZE_LINK_FLAGS}")
+
+      # -Wl and --gc-sections: drop unused sections\functions (similar to Windows /Gy function-level-linking)
+      set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${CLR_SANITIZE_LINK_FLAGS} -Wl,--gc-sections")
+      set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "${CMAKE_SHARED_LINKER_FLAGS_CHECKED} ${CLR_SANITIZE_LINK_FLAGS} -Wl,--gc-sections")
+    endif ()
+  endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
+endif(WIN32)
+
+# CLR_ADDITIONAL_LINKER_FLAGS - used for passing additional arguments to linker
+# CLR_ADDITIONAL_COMPILER_OPTIONS - used for passing additional arguments to compiler
+
+if(CLR_CMAKE_PLATFORM_UNIX)
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CLR_ADDITIONAL_LINKER_FLAGS}")
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CLR_ADDITIONAL_LINKER_FLAGS}" )
+  add_compile_options(${CLR_ADDITIONAL_COMPILER_OPTIONS})
+endif(CLR_CMAKE_PLATFORM_UNIX)
+
+if(CLR_CMAKE_PLATFORM_LINUX)
+  set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack")
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--build-id=sha1")
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id=sha1")
+endif(CLR_CMAKE_PLATFORM_LINUX)
+
 #------------------------------------
 # Definitions (for platform)
 #-----------------------------------
 
-if (CLR_CMAKE_HOST_ARCH_AMD64)
+if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
   add_definitions(-D_AMD64_)
   add_definitions(-D_WIN64)
   add_definitions(-DAMD64)
   add_definitions(-DBIT64=1)
-elseif (CLR_CMAKE_HOST_ARCH_I386)
+elseif (CLR_CMAKE_PLATFORM_ARCH_I386)
   add_definitions(-D_X86_)
-elseif (CLR_CMAKE_HOST_ARCH_ARM)
+elseif (CLR_CMAKE_PLATFORM_ARCH_ARM)
   add_definitions(-D_ARM_)
   add_definitions(-DARM)
-elseif (CLR_CMAKE_HOST_ARCH_ARM64)
+elseif (CLR_CMAKE_PLATFORM_ARCH_ARM64)
   add_definitions(-D_ARM64_)
   add_definitions(-DARM64)
   add_definitions(-D_WIN64)
   add_definitions(-DBIT64=1)
-elseif (CLR_CMAKE_HOST_ARCH_MIPS64)
+elseif (CLR_CMAKE_PLATFORM_ARCH_MIPS64)
   add_definitions(-D_MIPS64_)
   add_definitions(-DMIPS64)
   add_definitions(-D_WIN64)
@@ -90,8 +504,69 @@ else ()
   clr_unknown_arch()
 endif ()
 
+if (CLR_CMAKE_PLATFORM_UNIX)
+  if(CLR_CMAKE_PLATFORM_LINUX)
+    if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
+      message("Detected Linux x86_64")
+      add_definitions(-DLINUX64)
+    elseif(CLR_CMAKE_PLATFORM_UNIX_ARM)
+      message("Detected Linux ARM")
+      add_definitions(-DLINUX32)
+    elseif(CLR_CMAKE_PLATFORM_UNIX_ARM64)
+      message("Detected Linux ARM64")
+      add_definitions(-DLINUX64)
+    elseif(CLR_CMAKE_PLATFORM_UNIX_X86)
+      message("Detected Linux i686")
+      add_definitions(-DLINUX32)
+    elseif(CLR_CMAKE_PLATFORM_UNIX_MIPS64)
+      message("Detected Linux MIPS64")
+      add_definitions(-DLINUX64)
+    else()
+      clr_unknown_arch()
+    endif()
+  endif(CLR_CMAKE_PLATFORM_LINUX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
+
+if (CLR_CMAKE_PLATFORM_UNIX)
+  add_definitions(-DPLATFORM_UNIX=1)
+
+  if(CLR_CMAKE_PLATFORM_DARWIN)
+    message("Detected OSX x86_64")
+  endif(CLR_CMAKE_PLATFORM_DARWIN)
+
+  if(CLR_CMAKE_PLATFORM_FREEBSD)
+    message("Detected FreeBSD amd64")
+  endif(CLR_CMAKE_PLATFORM_FREEBSD)
+
+  if(CLR_CMAKE_PLATFORM_NETBSD)
+    message("Detected NetBSD amd64")
+  endif(CLR_CMAKE_PLATFORM_NETBSD)
+endif(CLR_CMAKE_PLATFORM_UNIX)
+
+if (WIN32)
+  # Define the CRT lib references that link into Desktop imports
+  set(STATIC_MT_CRT_LIB  "libcmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
+  set(STATIC_MT_VCRT_LIB  "libvcruntime$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
+  set(STATIC_MT_CPP_LIB  "libcpmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
+endif(WIN32)
+
+# Architecture specific files folder name
+if (CLR_CMAKE_TARGET_ARCH_AMD64)
+    set(ARCH_SOURCES_DIR amd64)
+elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
+    set(ARCH_SOURCES_DIR arm64)
+elseif (CLR_CMAKE_TARGET_ARCH_ARM)
+    set(ARCH_SOURCES_DIR arm)
+elseif (CLR_CMAKE_TARGET_ARCH_I386)
+    set(ARCH_SOURCES_DIR i386)
+elseif (CLR_CMAKE_TARGET_ARCH_MIPS64)
+    set(ARCH_SOURCES_DIR mips64)
+else ()
+    clr_unknown_arch()
+endif ()
+
 if (CLR_CMAKE_TARGET_ARCH_AMD64)
-  if (CLR_CMAKE_HOST_UNIX)
+  if (CLR_CMAKE_PLATFORM_UNIX)
     add_definitions(-DDBG_TARGET_AMD64_UNIX)
   endif()
   add_definitions(-D_TARGET_64BIT_=1)
@@ -100,7 +575,7 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64)
   add_definitions(-DDBG_TARGET_AMD64=1)
   add_definitions(-DDBG_TARGET_WIN64=1)
 elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
-  if (CLR_CMAKE_HOST_UNIX)
+  if (CLR_CMAKE_PLATFORM_UNIX)
     add_definitions(-DDBG_TARGET_ARM64_UNIX)
   endif()
   add_definitions(-D_TARGET_ARM64_=1)
@@ -110,28 +585,26 @@ elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
   add_definitions(-DDBG_TARGET_WIN64=1)
   add_definitions(-DFEATURE_MULTIREG_RETURN)
 elseif (CLR_CMAKE_TARGET_ARCH_ARM)
-  if (CLR_CMAKE_HOST_UNIX)
+  if (CLR_CMAKE_PLATFORM_UNIX)
     add_definitions(-DDBG_TARGET_ARM_UNIX)
   elseif (WIN32 AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
     # Set this to ensure we can use Arm SDK for Desktop binary linkage when doing native (Arm32) build
     add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1)
     add_definitions(-D_ARM_WORKAROUND_)
-  endif (CLR_CMAKE_HOST_UNIX)
+  endif (CLR_CMAKE_PLATFORM_UNIX)
   add_definitions(-D_TARGET_ARM_=1)
   add_definitions(-DDBG_TARGET_32BIT=1)
-  add_definitions(-DDBG_TARGET_32BIT=1)
   add_definitions(-DDBG_TARGET_ARM=1)
 elseif (CLR_CMAKE_TARGET_ARCH_I386)
   add_definitions(-D_TARGET_X86_=1)
   add_definitions(-DDBG_TARGET_32BIT=1)
-  add_definitions(-DDBG_TARGET_32BIT=1)
   add_definitions(-DDBG_TARGET_X86=1)
 elseif (CLR_CMAKE_TARGET_ARCH_MIPS64)
   add_definitions(-DDBG_TARGET_MIPS64_UNIX)
   add_definitions(-D_TARGET_MIPS64_=1)
   add_definitions(-D_TARGET_64BIT_=1)
-  add_definitions(-DDBG_TARGET_MIPS64=1)
   add_definitions(-DDBG_TARGET_64BIT=1)
+  add_definitions(-DDBG_TARGET_MIPS64=1)
   add_definitions(-DDBG_TARGET_WIN64=1)
   add_definitions(-DFEATURE_MULTIREG_RETURN)
 else ()
@@ -153,11 +626,10 @@ endif(WIN32)
 
 add_definitions(-DFEATURE_CORESYSTEM)
 
-if(CLR_CMAKE_HOST_UNIX)
-    add_definitions(-DPLATFORM_UNIX=1)
+if(CLR_CMAKE_PLATFORM_UNIX)
     add_definitions(-DFEATURE_PAL)
     add_definitions(-DFEATURE_PAL_ANSI)
-endif(CLR_CMAKE_HOST_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
 
 if(WIN32)
     add_definitions(-DFEATURE_COMINTEROP)
@@ -172,13 +644,18 @@ if(FEATURE_EVENT_TRACE)
     add_definitions(-DFEATURE_PERFTRACING=1)
 endif(FEATURE_EVENT_TRACE)
 
-if(CLR_CMAKE_HOST_UNIX_AMD64)
+if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
     add_definitions(-DFEATURE_MULTIREG_RETURN)
-endif (CLR_CMAKE_HOST_UNIX_AMD64)
+endif (CLR_CMAKE_PLATFORM_UNIX_AMD64)
 
-if(CLR_CMAKE_HOST_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
+if(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
     add_definitions(-DUNIX_AMD64_ABI)
-endif(CLR_CMAKE_HOST_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
+endif(CLR_CMAKE_PLATFORM_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64)
+
+#--------------------------------------
+# Compile Options
+#--------------------------------------
+include(compileoptions.cmake)
 
 #-----------------------------------------
 # Native Projects
index 6ede2dec5945aef7b86a4163625d517d925aae03..f256d81e16b3c5225a87378ba860f08e33348e85 100644 (file)
@@ -5,13 +5,6 @@
   </solution>
   <packageSources>
     <clear />
-    <!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
-    <!--  Begin: Package sources from dotnet-aspnetcore -->
-    <!--  End: Package sources from dotnet-aspnetcore -->
-    <!--  Begin: Package sources from dotnet-runtime -->
-    <add key="darc-pub-dotnet-runtime-fd61aef" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-fd61aefc/nuget/v3/index.json" />
-    <!--  End: Package sources from dotnet-runtime -->
-    <!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
     <!-- Feeds used in Maestro/Arcade publishing -->
     <add key="dotnet6" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet6/nuget/v3/index.json" />
     <add key="dotnet6-transport" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet6-transport/nuget/v3/index.json" />
index 28b4412e512e165084bf8fa7bb53b2b3d51d078e..5926f10b513ac877f10fd1b24424b439cc4b84ef 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 .NET Core Diagnostics Repo
 ==========================
 
-This repository contains the source code for various .NET Core runtime diagnostic tools. It currently contains SOS, the managed portion of SOS, the lldb SOS plugin and various global diagnostic tools. The goals of this repo is to build SOS and the lldb SOS plugin for the portable (glibc based) Linux platform (Centos 7) and the platforms not supported by the portable (musl based) build (Centos 6, Alpine, and macOS) and to test across various indexes in a very large matrix: OSs/distros (Centos 6/7, Ubuntu, Alpine, Fedora, Debian, RHEL 7.2), architectures (x64, x86, arm, arm64), lldb versions (3.9 to 9.0) and .NET Core (all in-development and supported major versions).
+This repository contains the source code for various .NET Core runtime diagnostic tools. It currently contains SOS, the managed portion of SOS, the lldb SOS plugin and various global diagnostic tools. The goals of this repo is to build SOS and the lldb SOS plugin for the portable (glibc based) Linux platform (Centos 7) and the platforms not supported by the portable (musl based) build (Centos 6, Alpine, and macOS) and to test across various indexes in a very large matrix: OSs/distros (Centos 6/7, Ubuntu, Alpine, Fedora, Debian, RHEL 7.2), architectures (x64, x86, arm, arm64), lldb versions (3.9 to 9.0) and .NET Core versions (2.1, 3.1, 5.0.x).
 
 Another goal to make it easier to obtain a version of lldb (currently 3.9) with scripts and documentation for platforms/distros like Centos, Alpine, Fedora, etc. that by default provide really old versions.
 
diff --git a/compileoptions.cmake b/compileoptions.cmake
new file mode 100644 (file)
index 0000000..b31f265
--- /dev/null
@@ -0,0 +1,161 @@
+# Copyright (c) .NET Foundation and contributors. All rights reserved.
+# Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+if (CLR_CMAKE_PLATFORM_UNIX)
+  # Disable frame pointer optimizations so profilers can get better call stacks
+  add_compile_options(-fno-omit-frame-pointer)
+
+  # The -fms-extensions enable the stuff like __if_exists, __declspec(uuid()), etc.
+  add_compile_options(-fms-extensions )
+  #-fms-compatibility      Enable full Microsoft Visual C++ compatibility
+  #-fms-extensions         Accept some non-standard constructs supported by the Microsoft compiler
+
+  # Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
+  # using twos-complement representation (this is normally undefined according to the C++ spec).
+  add_compile_options(-fwrapv)
+
+  if(CLR_CMAKE_PLATFORM_DARWIN)
+    # We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2)
+    add_compile_options(-fstack-protector)
+    if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
+      add_compile_options(-arch x86_64)
+    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
+      add_compile_options(-arch arm64)
+    else()
+      clr_unknown_arch()
+    endif()
+  else()
+    add_compile_options(-fstack-protector-strong)
+  endif(CLR_CMAKE_PLATFORM_DARWIN)
+
+  add_definitions(-DDISABLE_CONTRACTS)
+  # The -ferror-limit is helpful during the porting, it makes sure the compiler doesn't stop
+  # after hitting just about 20 errors.
+  add_compile_options(-ferror-limit=4096)
+
+  if (CLR_CMAKE_WARNINGS_ARE_ERRORS)
+    # All warnings that are not explicitly disabled are reported as errors
+    add_compile_options(-Werror)
+  endif(CLR_CMAKE_WARNINGS_ARE_ERRORS)
+
+  # Disabled warnings
+  add_compile_options(-Wno-unused-private-field)
+  add_compile_options(-Wno-unused-variable)
+  # Explicit constructor calls are not supported by clang (this->ClassName::ClassName())
+  add_compile_options(-Wno-microsoft)
+  # This warning is caused by comparing 'this' to NULL
+  add_compile_options(-Wno-tautological-compare)
+  # There are constants of type BOOL used in a condition. But BOOL is defined as int
+  # and so the compiler thinks that there is a mistake.
+  add_compile_options(-Wno-constant-logical-operand)
+  # We use pshpack1/2/4/8.h and poppack.h headers to set and restore packing. However
+  # clang 6.0 complains when the packing change lifetime is not contained within 
+  # a header file.
+  add_compile_options(-Wno-pragma-pack)
+
+  add_compile_options(-Wno-unknown-warning-option)
+
+  #These seem to indicate real issues
+  add_compile_options(-Wno-invalid-offsetof)
+  # The following warning indicates that an attribute __attribute__((__ms_struct__)) was applied
+  # to a struct or a class that has virtual members or a base class. In that case, clang
+  # may not generate the same object layout as MSVC.
+  add_compile_options(-Wno-incompatible-ms-struct)
+
+  # Some architectures (e.g., ARM) assume char type is unsigned while CoreCLR assumes char is signed
+  # as x64 does. It has been causing issues in ARM (https://github.com/dotnet/coreclr/issues/4746)
+  add_compile_options(-fsigned-char)
+endif(CLR_CMAKE_PLATFORM_UNIX)
+
+if(CLR_CMAKE_PLATFORM_UNIX_ARM)
+   # Because we don't use CMAKE_C_COMPILER/CMAKE_CXX_COMPILER to use clang
+   # we have to set the triple by adding a compiler argument
+   add_compile_options(-mthumb)
+   add_compile_options(-mfpu=vfpv3)
+   add_compile_options(-march=armv7-a)
+   if(ARM_SOFTFP)
+     add_definitions(-DARM_SOFTFP)
+     add_compile_options(-mfloat-abi=softfp)
+   endif(ARM_SOFTFP)
+endif(CLR_CMAKE_PLATFORM_UNIX_ARM)
+
+if(CLR_CMAKE_PLATFORM_FREEBSD)
+  add_compile_options(-Wno-macro-redefined)
+  add_compile_options(-Wno-pointer-to-int-cast)
+endif(CLR_CMAKE_PLATFORM_FREEBSD)
+
+if (WIN32)
+  # Compile options for targeting windows
+
+  # The following options are set by the razzle build
+  add_compile_options(/TP) # compile all files as C++
+  add_compile_options(/d2Zi+) # make optimized builds debugging easier
+  add_compile_options(/nologo) # Suppress Startup Banner
+  add_compile_options(/W3) # set warning level to 3
+  add_compile_options(/WX) # treat warnings as errors
+  add_compile_options(/Oi) # enable intrinsics
+  add_compile_options(/Oy-) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls
+  add_compile_options(/U_MT) # undefine the predefined _MT macro
+  add_compile_options(/GF) # enable read-only string pooling
+  add_compile_options(/Gm-) # disable minimal rebuild
+  add_compile_options(/EHa) # enable C++ EH (w/ SEH exceptions)
+  add_compile_options(/Zp8) # pack structs on 8-byte boundary
+  add_compile_options(/Gy) # separate functions for linker
+  add_compile_options(/Zc:wchar_t-) # C++ language conformance: wchar_t is NOT the native type, but a typedef
+  add_compile_options(/Zc:forScope) # C++ language conformance: enforce Standard C++ for scoping rules
+  add_compile_options(/GR-) # disable C++ RTTI
+  add_compile_options(/FC) # use full pathnames in diagnostics
+  add_compile_options(/MP) # Build with Multiple Processes (number of processes equal to the number of processors)
+  add_compile_options(/GS) # Buffer Security Check
+  add_compile_options(/Zm200) # Specify Precompiled Header Memory Allocation Limit of 150MB
+  add_compile_options(/wd4960 /wd4961 /wd4603 /wd4627 /wd4838 /wd4456 /wd4457 /wd4458 /wd4459 /wd4091 /we4640)
+  add_compile_options(/Zi) # enable debugging information
+  add_compile_options(/ZH:SHA_256) # use SHA256 for generating hashes of compiler processed source files.
+  add_compile_options(/source-charset:utf-8) # Force MSVC to compile source as UTF-8.
+
+  if (CLR_CMAKE_PLATFORM_ARCH_I386)
+    add_compile_options(/Gz)
+  endif (CLR_CMAKE_PLATFORM_ARCH_I386)
+
+  add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/GL>)
+  add_compile_options($<$<OR:$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>,$<CONFIG:Checked>>:/O1>)
+
+  if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
+  # The generator expression in the following command means that the /homeparams option is added only for debug builds
+  add_compile_options($<$<CONFIG:Debug>:/homeparams>) # Force parameters passed in registers to be written to the stack
+  endif (CLR_CMAKE_PLATFORM_ARCH_AMD64)
+
+  # enable control-flow-guard support for native components for non-Arm64 builds
+  add_compile_options(/guard:cf) 
+
+  # Statically linked CRT (libcmt[d].lib, libvcruntime[d].lib and libucrt[d].lib) by default. This is done to avoid  
+  # linking in VCRUNTIME140.DLL for a simplified xcopy experience by reducing the dependency on VC REDIST.  
+  #  
+  # For Release builds, we shall dynamically link into uCRT [ucrtbase.dll] (which is pushed down as a Windows Update on downlevel OS) but  
+  # wont do the same for debug/checked builds since ucrtbased.dll is not redistributable and Debug/Checked builds are not  
+  # production-time scenarios.  
+  add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/MT>)  
+  add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:/MTd>)  
+
+  set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /ZH:SHA_256")
+  
+endif (WIN32)
+
+if(CLR_CMAKE_ENABLE_CODE_COVERAGE)
+
+  if(CLR_CMAKE_PLATFORM_UNIX)
+    string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE)
+    if(NOT UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
+      message( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" )
+    endif(NOT UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
+
+    add_compile_options(-fprofile-arcs)
+    add_compile_options(-ftest-coverage)
+    set(CLANG_COVERAGE_LINK_FLAGS  "--coverage")
+    set(CMAKE_SHARED_LINKER_FLAGS  "${CMAKE_SHARED_LINKER_FLAGS} ${CLANG_COVERAGE_LINK_FLAGS}")
+    set(CMAKE_EXE_LINKER_FLAGS     "${CMAKE_EXE_LINKER_FLAGS} ${CLANG_COVERAGE_LINK_FLAGS}")
+  else()
+    message(FATAL_ERROR "Code coverage builds not supported on current platform")
+  endif(CLR_CMAKE_PLATFORM_UNIX)
+
+endif(CLR_CMAKE_ENABLE_CODE_COVERAGE)
diff --git a/crossgen.cmake b/crossgen.cmake
new file mode 100644 (file)
index 0000000..75739df
--- /dev/null
@@ -0,0 +1,27 @@
+# Contains the crossgen build specific definitions. Included by the leaf crossgen cmake files.
+
+add_definitions(
+    -DCROSSGEN_COMPILE
+    -DCROSS_COMPILE
+    -DFEATURE_NATIVE_IMAGE_GENERATION
+    -DSELF_NO_HOST)
+
+remove_definitions(
+    -DFEATURE_CODE_VERSIONING
+    -DEnC_SUPPORTED
+    -DFEATURE_EVENT_TRACE=1
+    -DFEATURE_LOADER_OPTIMIZATION
+    -DFEATURE_MULTICOREJIT
+    -DFEATURE_PERFMAP
+    -DFEATURE_REJIT
+    -DFEATURE_TIERED_COMPILATION
+    -DFEATURE_VERSIONING_LOG
+)
+
+if(FEATURE_READYTORUN)
+    add_definitions(-DFEATURE_READYTORUN_COMPILER)
+endif(FEATURE_READYTORUN)
+
+if(CLR_CMAKE_PLATFORM_LINUX)
+    add_definitions(-DFEATURE_PERFMAP)
+endif(CLR_CMAKE_PLATFORM_LINUX)
index 7ea816cc83094c31ec7f5d8b1e5b7e6cfdec1230..87a79a84efada5dcb9af6a097856f28a27fdfc81 100644 (file)
@@ -142,7 +142,7 @@ stages:
       parameters:
         name: Alpine3_13
         osGroup: Linux
-        dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.13-WithNode-20210910135845-c401c85
+        dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.13-WithNode-20210728123842-ddfc481
         artifactsTargetPath: bin/Linux-musl.x64.Release
         requiresCapPtraceContainer: true
         strategy:
@@ -175,7 +175,6 @@ stages:
       parameters:
         name: MacOS_cross
         osGroup: MacOS_cross
-        crossbuild: true
         buildAndSkipTest: true
         strategy:
           matrix:
@@ -193,7 +192,7 @@ stages:
         parameters:
           name: Linux_cross
           osGroup: Linux
-          dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-20210719121212-8a8d3be
+          dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-14.04-cross-1735d26-20190521133857
           crossrootfsDir: '/crossrootfs/arm'
           buildAndSkipTest: true
           strategy:
@@ -207,7 +206,7 @@ stages:
         parameters:
           name: Linux_cross64
           osGroup: Linux
-          dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-20210719121212-8a8d3be
+          dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-a3ae44b-20180315221921
           crossrootfsDir: '/crossrootfs/arm64'
           buildAndSkipTest: true
           strategy:
@@ -221,7 +220,7 @@ stages:
         parameters:
           name: Alpine_cross64
           osGroup: Linux
-          dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-alpine-20210923140502-78f7860
+          dockerImage: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-alpine-20210719121212-b2c2436
           crossrootfsDir: '/crossrootfs/arm64'
           artifactsTargetPath: bin/Linux-musl.arm64.Release
           buildAndSkipTest: true
index c75ac8a606bd5bdc82affcb020b925397b579584..5043e8e3539c54aee1ec945d56dfff428e846df0 100644 (file)
@@ -21,7 +21,7 @@ Here's a table showing how dotnet-dump fits into your dump debugging options:
 
 ## Installing dotnet-dump
 
-The first step is to install the dotnet-dump CLI global tool. This requires at least the 3.1 or greater .NET Core SDK to be installed. If you see the error message `Tool 'dotnet-dump' is already installed`, you will need to uninstall the global tool (see below). 
+The first step is to install the dotnet-dump CLI global tool. This requires at least the 2.1 or greater .NET Core SDK to be installed. If you see the error message `Tool 'dotnet-dump' is already installed`, you will need to uninstall the global tool (see below). 
 
     $ dotnet tool install -g dotnet-dump
     You can invoke the tool using the following command: dotnet-dump
index 4db1420e3268b62ac8c4f33e31b230895605bad4..bb6a1660ee6190c50922ae805d971df208c0289c 100644 (file)
@@ -1,7 +1,7 @@
 Installing SOS on Linux and MacOS
 =================================
 
-The first step is to install the dotnet-sos CLI global tool. This requires at least the 3.1 or greater .NET Core SDK to be installed. If you see the error message `Tool 'dotnet-sos' is already installed`, you will need to uninstall the global tool (see below). 
+The first step is to install the dotnet-sos CLI global tool. This requires at least the 2.1 or greater .NET Core SDK to be installed. If you see the error message `Tool 'dotnet-sos' is already installed`, you will need to uninstall the global tool (see below). 
 
     $ dotnet tool install -g dotnet-sos
     You can invoke the tool using the following command: dotnet-sos
@@ -10,7 +10,7 @@ The first step is to install the dotnet-sos CLI global tool. This requires at le
 The next step is use this global tool to install SOS. 
 
     $ dotnet-sos install
-    Installing SOS to /home/mikem/.dotnet/sos from /home/mikem/.dotnet/tools/.store/dotnet-sos/5.0.251802/dotnet-sos/5.0.251802/tools/netcoreapp3.1/any/linux-x64
+    Installing SOS to /home/mikem/.dotnet/sos from /home/mikem/.dotnet/tools/.store/dotnet-sos/3.0.47001/dotnet-sos/3.0.47001/tools/netcoreapp2.1/any/linux-x64
     Creating installation directory...
     Copying files...
     Updating existing /home/mikem/.lldbinit file - LLDB will load SOS automatically at startup
@@ -72,7 +72,7 @@ Now any time you run lldb, SOS will automatically be loaded and the symbol downl
 The installer needs to be run again:
 
     $ dotnet-sos install
-    Installing SOS to /home/mikem/.dotnet/sos from /home/mikem/.dotnet/tools/.store/dotnet-sos/5.0.251802/dotnet-sos/5.0.251802/tools/netcoreapp3.1/any/linux-x64
+    Installing SOS to /home/mikem/.dotnet/sos from /home/mikem/.dotnet/tools/.store/dotnet-sos/3.0.47001/dotnet-sos/3.0.47001/tools/netcoreapp2.1/any/linux-x64
     Installing over existing installation...
     Creating installation directory...
     Copying files...
index cbde73e79e3f17fbac6e5e668ae5a20b9b7861b1..13511dfcfc2327c3f8e8dfb37b4302c84cf5cc96 100644 (file)
@@ -18,7 +18,7 @@ To install the latest released SOS manually, use the dotnet-sos CLI global tool.
 Run the installer:
 
     C:\Users\mikem>dotnet-sos install
-    Installing SOS to C:\Users\mikem\.dotnet\sos from C:\Users\mikem\.dotnet\tools\.store\dotnet-sos\5.0.251802\dotnet-sos\5.0.251802\tools\netcoreapp3.1\any\win-x64
+    Installing SOS to C:\Users\mikem\.dotnet\sos from C:\Users\mikem\.dotnet\tools\.store\dotnet-sos\5.0.160202\dotnet-sos\5.0.160202\tools\netcoreapp2.1\any\win-x64
     Installing over existing installation...
     Creating installation directory...
     Copying files...
@@ -70,9 +70,9 @@ The latest released version of SOS will automatically be loaded from the interna
 
     0:000> sxe ld coreclr
     0:000> g
-    ModLoad: 00007ffe`e9100000 00007ffe`e9165000   C:\Program Files\dotnet\host\fxr\3.0.3\hostfxr.dll
-    ModLoad: 00007ffe`e7ba0000 00007ffe`e7c32000   C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.20\hostpolicy.dll
-    ModLoad: 00007ffe`abb60000 00007ffe`ac125000   C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.20\coreclr.dll
+    ModLoad: 00007ffe`e9100000 00007ffe`e9165000   C:\Program Files\dotnet\host\fxr\2.2.2\hostfxr.dll
+    ModLoad: 00007ffe`e7ba0000 00007ffe`e7c32000   C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.6\hostpolicy.dll
+    ModLoad: 00007ffe`abb60000 00007ffe`ac125000   C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.6\coreclr.dll
     ntdll!ZwMapViewOfSection+0x14:
     00007fff`16e2fb74 c3              ret
     0:000> .chain
index 6fc8785afd94d187eb98efc907d279015d337cbf..9ff741b7d6fc7d82fd3115eafb15031b97a4670b 100644 (file)
@@ -123,7 +123,7 @@ Type `!help <functionname>` for detailed info on that function.
 |**SaveModule** \<*Base address*> \<*Filename*>|Writes an image, which is loaded in memory at the specified address, to the specified file.|
 |**SOSFlush**|Flushes an internal SOS cache.|
 |**SOSStatus** [**-netfx**] [**-netcore**] [**-reset**]|Display internal SOS status, reset the internal cached state, or change between the desktop .NET framework or .NET Core runtimes when both are loaded in the process or dump.<br/><br/>-netfx   - switch to the desktop .NET Framework runtime if loaded.<br/>-netcore - switch to the .NET Core runtime if loaded.<br/>-reset   - reset all the cached internal SOS state.<br/><br/>|
-|**SetHostRuntime** [**-netcore**] [**-netfx**] [\<runtime-directory\>]|This command controls the runtime that is used to host the maanged code that runs as part of SOS in the debugger (cdb/windbg). The default is the desktop .NET Framework. The "-netcore" option allows the installed .NET Core runtime be used. The "-netfx" option allows switches back to the .NET Framework runtime.<br/><br/>Normally, SOS attempts to find an installed .NET Core runtime to run its managed code automatically but this command is available if it fails. The default is to use the same runtime (libcoreclr) being debugged. Use this command if the default runtime being debugged isn't working enough to run the SOS code or if the version is less than 3.1.<br/><br/>If you received the following error message when running a SOS command, use this command to set the path to 3.1 or greater .NET Core runtime. <br/><br/>`(lldb) clrstack`<br/>`Error: Fail to initialize CoreCLR 80004005 ClrStack failed`<br/><br/>`(lldb) sethostruntime /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.20`<br/><br/>You can use the "dotnet --info" in a command shell to find the path of an installed .NET Core runtime.|
+|**SetHostRuntime** [**-netcore**] [**-netfx**] [\<runtime-directory\>]|This command controls the runtime that is used to host the maanged code that runs as part of SOS in the debugger (cdb/windbg). The default is the desktop .NET Framework. The "-netcore" option allows the installed .NET Core runtime be used. The "-netfx" option allows switches back to the .NET Framework runtime.<br/><br/>Normally, SOS attempts to find an installed .NET Core runtime to run its managed code automatically but this command is available if it fails. The default is to use the same runtime (libcoreclr) being debugged. Use this command if the default runtime being debugged isn't working enough to run the SOS code or if the version is less than 2.1.0.<br/><br/>If you received the following error message when running a SOS command, use this command to set the path to 2.1.0 or greater .NET Core runtime. <br/><br/>`(lldb) clrstack`<br/>`Error: Fail to initialize CoreCLR 80004005 ClrStack failed`<br/><br/>`(lldb) sethostruntime /usr/share/dotnet/shared/Microsoft.NETCore.App/2.1.6`<br/><br/>You can use the "dotnet --info" in a command shell to find the path of an installed .NET Core runtime.|
 |**StopOnException** [**-derived**] [**-create** &#124; **-create2**] \<*Exception*> \<*Pseudo-register number*>|Causes the debugger to stop when the specified exception is thrown, but to continue running when other exceptions are thrown.<br /><br /> The **-derived** option catches the specified exception and every exception that derives from the specified exception.|
 |**SyncBlk** [**-all** &#124; \<*syncblk number*>]|Displays the specified `SyncBlock` structure or all `SyncBlock` structures.  If you do not pass any arguments, the **SyncBlk** command displays the `SyncBlock` structure corresponding to objects that are owned by a thread.<br /><br /> A `SyncBlock` structure is a container for extra information that does not need to be created for every object. It can hold COM interop data, hash codes, and locking information for thread-safe operations.|
 |**ThreadPool**|Displays information about the managed thread pool, including the number of work requests in the queue, the number of completion port threads, and the number of timers.|
index cda591f82c348479f165191c528f9900211148ac..f11d512d5cac309f5623ee1e715dc80e258ff820 100644 (file)
@@ -108,12 +108,12 @@ importance. Shortcut names for popular functions are listed in parenthesis. Type
 |**HistObjFind**  *<obj_address>*|Displays all the log entries that reference an object at the specified address.|
 |**HistRoot** *\<root>*|Displays information related to both promotions and relocations of the specified root.<br /><br /> The root value can be used to track the movement of an object through the garbage collections.|
 |**IP2MD** (**ip2md**) \<*Code address*>|Displays the `MethodDesc` structure at the specified address in code that has been JIT-compiled.|
-|**Name2EE** (**name2ee**) \<*module name*> \<*type or method name*><br /><br /> -or-<br /><br /> **Name2EE** \<*module name*>**!**\<*type or method name*>|Displays the `MethodTable` structure and `EEClass` structure for the specified type or method in the specified module.<br /><br /> The specified module must be loaded in the process.<br /><br /> To get the proper type name you can browse the module by using the an IL reflection tool like Ildasm or ILSpy. You can also pass `*` as the module name parameter to search all loaded managed modules. The *module name* parameter can also be the debugger's name for a module, such as `mscorlib` or `image00400000`.<br /><br /> This command supports the Windows debugger syntax of <`module`>`!`<`type`>. The type must be fully qualified.|
+|**Name2EE** (**name2ee**) \<*module name*> \<*type or method name*><br /><br /> -or-<br /><br /> **Name2EE** \<*module name*>**!**\<*type or method name*>|Displays the `MethodTable` structure and `EEClass` structure for the specified type or method in the specified module.<br /><br /> The specified module must be loaded in the process.<br /><br /> To get the proper type name, browse the module by using the [Ildasm.exe (IL Disassembler)](../../../docs/framework/tools/ildasm-exe-il-disassembler.md). You can also pass `*` as the module name parameter to search all loaded managed modules. The *module name* parameter can also be the debugger's name for a module, such as `mscorlib` or `image00400000`.<br /><br /> This command supports the Windows debugger syntax of <`module`>`!`<`type`>. The type must be fully qualified.|
 |**PrintException** [**-nested**] [**-lines**] [\<*Exception object address*>]<br /><br /> -or-<br /><br /> **PE** [**-nested**] [\<*Exception object address*>]|Displays and formats fields of any object derived from the <xref:System.Exception> class at the specified address. If you do not specify an address, the **PrintException** command displays the last exception thrown on the current thread.<br /><br /> The **-nested** option displays details about nested exception objects.<br /><br /> The **-lines** option displays source information, if available.<br /><br /> You can use this command to format and view the `_stackTrace` field, which is a binary array.|
 |**SyncBlk** [**-all** &#124; \<*syncblk number*>]|Displays the specified `SyncBlock` structure or all `SyncBlock` structures.  If you do not pass any arguments, the **SyncBlk** command displays the `SyncBlock` structure corresponding to objects that are owned by a thread.<br /><br /> A `SyncBlock` structure is a container for extra information that does not need to be created for every object. It can hold COM interop data, hash codes, and locking information for thread-safe operations.|
 |**SOSFlush**|Flushes an internal SOS cache.|
 |**SOSStatus** [**-reset**]|Displays internal SOS status or reset the internal cached state.|
-|**SetHostRuntime** [\<runtime-directory\>]|This command sets the path to the .NET Core runtime to use to host the managed code that runs as part of SOS in the debugger (lldb). The runtime needs to be at least version 3.1 or greater. If there are spaces in directory, it needs to be single-quoted (').<br/><br/>Normally, SOS attempts to find an installed .NET Core runtime to run its managed code automatically but this command is available if it fails. The default is to use the same runtime (libcoreclr) being debugged. Use this command if the default runtime being debugged isn't working enough to run the SOS code or if the version is less than 3.1.<br/><br/>If you received the following error message when running a SOS command, use this command to set the path to 3.1 or greater .NET Core runtime. <br/><br/>`(lldb) clrstack`<br/>`Error: Fail to initialize CoreCLR 80004005 ClrStack failed`<br/><br/>`(lldb) sethostruntime /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.20`<br/><br/>You can use the "dotnet --info" in a command shell to find the path of an installed .NET Core runtime.|
+|**SetHostRuntime** [\<runtime-directory\>]|This command sets the path to the .NET Core runtime to use to host the managed code that runs as part of SOS in the debugger (lldb). The runtime needs to be at least version 2.1.0 or greater. If there are spaces in directory, it needs to be single-quoted (').<br/><br/>Normally, SOS attempts to find an installed .NET Core runtime to run its managed code automatically but this command is available if it fails. The default is to use the same runtime (libcoreclr) being debugged. Use this command if the default runtime being debugged isn't working enough to run the SOS code or if the version is less than 2.1.0.<br/><br/>If you received the following error message when running a SOS command, use this command to set the path to 2.1.0 or greater .NET Core runtime. <br/><br/>`(lldb) clrstack`<br/>`Error: Fail to initialize CoreCLR 80004005 ClrStack failed`<br/><br/>`(lldb) sethostruntime /usr/share/dotnet/shared/Microsoft.NETCore.App/2.1.6`<br/><br/>You can use the "dotnet --info" in a command shell to find the path of an installed .NET Core runtime.|
 |**SetSymbolServer** [**-ms**] [**-disable**] [**-log**] [**-loadsymbols**] [**-cache** \<cache-path>] [**-directory** \<search-directory>] [**-sympath** \<windows-symbol-path>] [\<symbol-server-URL>]|Enables the symbol server downloading support.<br/><br/>The **-ms** option enables downloading from the public Microsoft symbol server.<br/><br/>The **-disable** option turns on the symbol download support.<br/><br/>The **-cache** \<cache-path> option specifies a symbol cache directory. The default is $HOME/.dotnet/symbolcache if not specified.<br/><br/>The **-directory** option add a path to search for symbols. Can be more than one.<br/><br/>The **-sympath** option adds server, cache and directory paths in the Windows symbol path format.<br/><br/>The **-log** option enables symbol download logging.<br/><br/>The **-loadsymbols** option attempts to download the native .NET Core symbols for the runtime.|
 |**Token2EE** \<*module name*> \<*token*>|Turns the specified metadata token in the specified module into a `MethodTable` structure or `MethodDesc` structure.<br /><br /> You can pass `*` for the module name parameter to find what that token maps to in every loaded managed module. You can also pass the debugger's name for a module, such as `mscorlib` or `image00400000`.|
 |**Threads** (**clrthreads**) [**-live**] [**-special**]|Displays all managed threads in the process.<br /><br /> The **Threads** command displays the debugger shorthand ID, the CLR thread ID, and the operating system thread ID.  Additionally, the **Threads** command displays a Domain column that indicates the application domain in which a thread is executing, an APT column that displays the COM apartment mode, and an Exception column that displays the last exception thrown in the thread.<br /><br /> The **-live** option displays threads associated with a live thread.<br /><br /> The **-special** option displays all special threads created by the CLR. Special threads include garbage collection threads (in concurrent and server garbage collection), debugger helper threads, finalizer threads, <xref:System.AppDomain> unload threads, and thread pool timer threads.|
index a4fa89f39068cdb440ef58f1794f86b63913bce0..52a8928ed419a82fb6c3a7aecc627cb783be810c 100644 (file)
@@ -330,7 +330,7 @@ Lastly, the code prints out the dictionary allowing us to see the duplicate call
 Build the dotnet-dump tool (dotnet build) and run it from the following location on the same dump that we generated earlier:
 
 ```bash
-~/diagnostics/artifacts/bin/dotnet-dump/Debug/netcoreapp3.1/publish/dotnet dotnet-dump.dll analyze ~/.dotnet/tools/core_20190513_143916
+~/diagnostics/artifacts/bin/dotnet-dump/Debug/netcoreapp2.1/publish/dotnet dotnet-dump.dll analyze ~/.dotnet/tools/core_20190513_143916
 ```
 
 You can now use the 'uniquestacks' command and see the following output (partial):
index d9d5b46f79e1dc65aedff6de291257af94ac1380..0263b30630187ebdbad7a0f8e97811b189eb07b8 100644 (file)
@@ -9,7 +9,7 @@ echo %__MsgPrefix%Starting Build at %TIME%
 set __ThisScriptFull="%~f0"
 set __ThisScriptDir="%~dp0"
 
-call "%__ThisScriptDir%"\native\init-vs-env.cmd
+call "%__ThisScriptDir%"\setup-vs-tools.cmd
 if NOT '%ERRORLEVEL%' == '0' goto ExitWithError
 
 if defined VS160COMNTOOLS (
@@ -112,8 +112,7 @@ echo %NUGET_PACKAGES%
 set "__RootBinDir=%__ProjectDir%\artifacts"
 set "__BinDir=%__RootBinDir%\bin\%__BuildOS%.%__BuildArch%.%__BuildType%"
 set "__LogDir=%__RootBinDir%\log\%__BuildOS%.%__BuildArch%.%__BuildType%"
-set "__ArtifactsIntermediatesDir=%__RootBinDir%\obj"
-set "__IntermediatesDir=%__ArtifactsIntermediatesDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
+set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
 set "__PackagesBinDir=%__RootBinDir%\packages\%__BuildType%\Shipping"
 
 set "__CrossComponentBinDir=%__BinDir%"
@@ -178,7 +177,7 @@ if /i %__BuildCrossArch% EQU 1 (
 
     echo Generating Version Header
     set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog"
-    powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__ArtifactsIntermediatesDir%\_version.h %__CommonBuildArgs%
+    powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__CrossCompIntermediatesDir%\_version.h %__CommonBuildArgs%
     if not !errorlevel! == 0 (
         echo Generate Version Header FAILED
         goto ExitWithError
@@ -193,7 +192,7 @@ if /i %__BuildCrossArch% EQU 1 (
     set __ExtraCmakeArgs="-DCLR_MANAGED_BINARY_DIR=!__ManagedBinaryDir!" "-DCLR_BUILD_TYPE=%__BuildType%" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DNUGET_PACKAGES=%NUGET_PACKAGES:\=/%"
 
     pushd "%__CrossCompIntermediatesDir%"
-    call "%__ProjectDir%\eng\native\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossCompIntermediatesDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs!
+    call "%__ProjectDir%\eng\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs!
     @if defined _echo @echo on
     popd
 
@@ -236,9 +235,13 @@ if %__Build% EQU 1 (
     if /i "%__BuildArch%" == "x86" ( set __VCBuildArch=x86 )
     if /i "%__BuildArch%" == "arm" (
         set __VCBuildArch=x86_arm
+        :: Make CMake pick the highest installed version in the 10.0.* range
+        set ___SDKVersion="-DCMAKE_SYSTEM_VERSION=10.0"
     )
     if /i "%__BuildArch%" == "arm64" (
         set __VCBuildArch=x86_arm64
+        :: Make CMake pick the highest installed version in the 10.0.* range
+        set ___SDKVersion="-DCMAKE_SYSTEM_VERSION=10.0"
     )
 
     echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" !__VCBuildArch!
@@ -252,7 +255,7 @@ if %__Build% EQU 1 (
 
     echo Generating Version Header
     set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog"
-    powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__ArtifactsIntermediatesDir%\_version.h %__CommonBuildArgs%
+    powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h %__CommonBuildArgs%
     if not !errorlevel! == 0 (
         echo Generate Version Header FAILED
         goto ExitWithError
@@ -263,10 +266,10 @@ if %__Build% EQU 1 (
 
     set "__ManagedBinaryDir=%__RootBinDir%\bin"
     set "__ManagedBinaryDir=!__ManagedBinaryDir:\=/!"
-    set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_MANAGED_BINARY_DIR=!__ManagedBinaryDir!" "-DCLR_BUILD_TYPE=%__BuildType%" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DNUGET_PACKAGES=%NUGET_PACKAGES:\=/%"
+    set __ExtraCmakeArgs=!___SDKVersion! "-DCLR_MANAGED_BINARY_DIR=!__ManagedBinaryDir!" "-DCLR_BUILD_TYPE=%__BuildType%" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DNUGET_PACKAGES=%NUGET_PACKAGES:\=/%"
 
     pushd "%__IntermediatesDir%"
-    call "%__ProjectDir%\eng\native\gen-buildsys.cmd" "%__ProjectDir%" "%__IntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
+    call "%__ProjectDir%\eng\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
     @if defined _echo @echo on
     popd
 
index f3d5d149122c275be17353789ba13a6a40edc8fd..e2cfe25269288a152e664acb68920082c1262ef8 100644 (file)
       </NativeVersionLines>
     </PropertyGroup>
 
-    <WriteLinesToFile File="$(NativeVersionHeaderFile)"
-                      Lines="$(NativeVersionLines.Replace(';', '%3B'))"
-                      Overwrite="true"
-                      WriteOnlyWhenDifferent="true" />
+    <WriteLinesToFile File="$(NativeVersionHeaderFile)" Lines="$(NativeVersionLines.Replace(';', '%3B'))" Overwrite="true" />
 
     <ItemGroup>
       <FileWrites Include="$(NativeVersionHeaderFile)" />
@@ -84,10 +81,7 @@ char sccsid[] __attribute__((used)) = "@(#)Version $(InformationalVersion)$(Buil
       </NativeVersionLines>
     </PropertyGroup>
 
-    <WriteLinesToFile File="$(NativeVersionSourceFile)"
-                      Lines="$(NativeVersionLines.Replace(';', '%3B'))"
-                      Overwrite="true"
-                      WriteOnlyWhenDifferent="true" />
+    <WriteLinesToFile File="$(NativeVersionSourceFile)" Lines="$(NativeVersionLines.Replace(';', '%3B'))" Overwrite="true" />
 
     <ItemGroup>
       <FileWrites Include="$(NativeVersionSourceFile)" />
index 990a4183b1840e2ea5702dda5b471e6b5da8298d..a60fc20ab24099560c4caf067ea1169d1a7f24f4 100644 (file)
@@ -1,16 +1,16 @@
 <Dependencies>
   <ProductDependencies>
-    <Dependency Name="Microsoft.SymbolStore" Version="1.0.256501">
+    <Dependency Name="Microsoft.SymbolStore" Version="1.0.250401">
       <Uri>https://github.com/dotnet/symstore</Uri>
-      <Sha>28f890492dbe55374670e0b5b4606873eb6f0a1d</Sha>
+      <Sha>cb24099215a83975c360792edf35102ff0d10702</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.Diagnostics.Runtime" Version="2.0.256601">
+    <Dependency Name="Microsoft.Diagnostics.Runtime" Version="2.0.251201">
       <Uri>https://github.com/microsoft/clrmd</Uri>
-      <Sha>9e6dbb14ad2d9db38554486b84c28f999073c99e</Sha>
+      <Sha>58ede2ab2a191fb1aefc840ccb99b8e43f7bb316</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.Diagnostics.Runtime.Utilities" Version="2.0.256601">
+    <Dependency Name="Microsoft.Diagnostics.Runtime.Utilities" Version="2.0.251201">
       <Uri>https://github.com/microsoft/clrmd</Uri>
-      <Sha>9e6dbb14ad2d9db38554486b84c28f999073c99e</Sha>
+      <Sha>58ede2ab2a191fb1aefc840ccb99b8e43f7bb316</Sha>
     </Dependency>
     <Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="5.0.0-alpha.1.20473.1">
       <Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
     </Dependency>
   </ProductDependencies>
   <ToolsetDependencies>
-    <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.21559.3">
+    <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.21518.1">
       <Uri>https://github.com/dotnet/arcade</Uri>
-      <Sha>fecf65bedcee9036b8ba9d8d7feef5413f294914</Sha>
+      <Sha>c5a300999a6ab2792108190118280da36fb1991e</Sha>
       <SourceBuild RepoName="arcade" ManagedOnly="true" />
     </Dependency>
-    <Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="7.0.0-beta.21559.3">
+    <Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="7.0.0-beta.21518.1">
       <Uri>https://github.com/dotnet/arcade</Uri>
-      <Sha>fecf65bedcee9036b8ba9d8d7feef5413f294914</Sha>
+      <Sha>c5a300999a6ab2792108190118280da36fb1991e</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.101-servicing.21562.12">
+    <Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="6.0.100-rtm.21518.6">
       <Uri>https://github.com/dotnet/installer</Uri>
-      <Sha>457210a04c1900ee630e2a7b852f680a952eb71d</Sha>
+      <Sha>4cba5995022e769f2f9688ce44d8fc204559e4d9</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.AspNetCore.App.Ref.Internal" Version="6.0.0-rtm.21526.8">
+    <Dependency Name="Microsoft.AspNetCore.App.Ref.Internal" Version="6.0.0-rtm.21518.3">
       <Uri>https://github.com/dotnet/aspnetcore</Uri>
-      <Sha>ae1a6cbe225b99c0bf38b7e31bf60cb653b73a52</Sha>
+      <Sha>afb4990d708390efcdec701e33e5d66c37603d9a</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.AspNetCore.App.Ref" Version="6.0.0">
+    <Dependency Name="Microsoft.AspNetCore.App.Ref" Version="6.0.0-rtm.21518.3">
       <Uri>https://github.com/dotnet/aspnetcore</Uri>
-      <Sha>ae1a6cbe225b99c0bf38b7e31bf60cb653b73a52</Sha>
+      <Sha>afb4990d708390efcdec701e33e5d66c37603d9a</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="6.0.1">
+    <Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="6.0.0-rtm.21517.2">
       <Uri>https://github.com/dotnet/runtime</Uri>
-      <Sha>fd61aefcf12382a9ddd24295f660b95606201d57</Sha>
+      <Sha>92ff02435693486da161626246f016b4f1e7b8e8</Sha>
     </Dependency>
-    <Dependency Name="VS.Redist.Common.NetCore.SharedFramework.x64.6.0" Version="6.0.1-servicing.21566.4">
+    <Dependency Name="VS.Redist.Common.NetCore.SharedFramework.x64.6.0" Version="6.0.0-rtm.21517.2">
       <Uri>https://github.com/dotnet/runtime</Uri>
-      <Sha>fd61aefcf12382a9ddd24295f660b95606201d57</Sha>
+      <Sha>92ff02435693486da161626246f016b4f1e7b8e8</Sha>
     </Dependency>
   </ToolsetDependencies>
 </Dependencies>
index 089b31975453c6cc3d7a1f5d9db4893b14fdb2af..3df481b90ce40f8d83ce131a1b6c6a9821921e44 100644 (file)
@@ -2,34 +2,26 @@
   <PropertyGroup>
     <RepositoryUrl>https://github.com/dotnet/diagnostics</RepositoryUrl>
     <PreReleaseVersionLabel></PreReleaseVersionLabel>
-    <VersionPrefix>6.0.0</VersionPrefix>
+    <VersionPrefix>5.0.0</VersionPrefix>
     <DotNetUseShippingVersions>true</DotNetUseShippingVersions>
     <AutoGenerateAssemblyVersion>true</AutoGenerateAssemblyVersion>
-    <!--
-      Our nightly tools are stable versioned but go to a non-stable feed.
-      Arcade usually disallows this, but we use such a versioning scheme by design.
-      The nightly bits are versioned in a stable manner to allow `dotnet tool` to perform
-      easy updates. If we have issues, we just respin builds as we are a leaf build node
-      and we don't participate in prodcon.
-    -->
-    <SkipPackagePublishingVersionChecks>true</SkipPackagePublishingVersionChecks>
   </PropertyGroup>
   <PropertyGroup>
     <!-- Latest symstore version updated by darc -->
-    <MicrosoftSymbolStoreVersion>1.0.256501</MicrosoftSymbolStoreVersion>
+    <MicrosoftSymbolStoreVersion>1.0.250401</MicrosoftSymbolStoreVersion>
     <!-- Runtime versions to test -->
     <MicrosoftNETCoreApp31Version>3.1.18</MicrosoftNETCoreApp31Version>
     <MicrosoftAspNetCoreApp31Version>$(MicrosoftNETCoreApp31Version)</MicrosoftAspNetCoreApp31Version>
     <MicrosoftNETCoreApp50Version>5.0.9</MicrosoftNETCoreApp50Version>
     <MicrosoftAspNetCoreApp50Version>$(MicrosoftNETCoreApp50Version)</MicrosoftAspNetCoreApp50Version>
     <!-- Latest shared runtime version updated by darc -->
-    <VSRedistCommonNetCoreSharedFrameworkx6460Version>6.0.1-servicing.21566.4</VSRedistCommonNetCoreSharedFrameworkx6460Version>
-    <MicrosoftNETCoreAppRuntimewinx64Version>6.0.1</MicrosoftNETCoreAppRuntimewinx64Version>
+    <VSRedistCommonNetCoreSharedFrameworkx6460Version>6.0.0-rtm.21517.2</VSRedistCommonNetCoreSharedFrameworkx6460Version>
+    <MicrosoftNETCoreAppRuntimewinx64Version>6.0.0-rtm.21517.2</MicrosoftNETCoreAppRuntimewinx64Version>
     <!-- Latest shared aspnetcore version updated by darc -->
-    <MicrosoftAspNetCoreAppRefInternalVersion>6.0.0-rtm.21526.8</MicrosoftAspNetCoreAppRefInternalVersion>
-    <MicrosoftAspNetCoreAppRefVersion>6.0.0</MicrosoftAspNetCoreAppRefVersion>
+    <MicrosoftAspNetCoreAppRefInternalVersion>6.0.0-rtm.21518.3</MicrosoftAspNetCoreAppRefInternalVersion>
+    <MicrosoftAspNetCoreAppRefVersion>6.0.0-rtm.21518.3</MicrosoftAspNetCoreAppRefVersion>
     <!-- dotnet/installer: Testing version of the SDK. Needed for the signed & entitled host. -->
-    <MicrosoftDotnetSdkInternalVersion>6.0.101-servicing.21562.12</MicrosoftDotnetSdkInternalVersion>
+    <MicrosoftDotnetSdkInternalVersion>6.0.100-rtm.21518.6</MicrosoftDotnetSdkInternalVersion>
   </PropertyGroup>
   <PropertyGroup>
     <!-- Opt-in/out repo features -->
@@ -42,8 +34,8 @@
     <MicrosoftWin32PrimitivesVersion>4.3.0</MicrosoftWin32PrimitivesVersion>
     <!-- Other libs -->
     <MicrosoftBclAsyncInterfacesVersion>1.1.0</MicrosoftBclAsyncInterfacesVersion>
-    <MicrosoftDiagnosticsRuntimeVersion>2.0.256601</MicrosoftDiagnosticsRuntimeVersion>
-    <MicrosoftDiagnosticsRuntimeUtilitiesVersion>2.0.256601</MicrosoftDiagnosticsRuntimeUtilitiesVersion>
+    <MicrosoftDiagnosticsRuntimeVersion>2.0.251201</MicrosoftDiagnosticsRuntimeVersion>
+    <MicrosoftDiagnosticsRuntimeUtilitiesVersion>2.0.251201</MicrosoftDiagnosticsRuntimeUtilitiesVersion>
     <MicrosoftDiaSymReaderNativePackageVersion>16.9.0-beta1.21055.5</MicrosoftDiaSymReaderNativePackageVersion>
     <MicrosoftDiagnosticsTracingTraceEventVersion>2.0.64</MicrosoftDiagnosticsTracingTraceEventVersion>
     <MicrosoftExtensionsLoggingVersion>2.1.1</MicrosoftExtensionsLoggingVersion>
@@ -56,7 +48,7 @@
     <SystemTextEncodingsWebVersion>4.7.2</SystemTextEncodingsWebVersion>
     <SystemTextJsonVersion>4.7.1</SystemTextJsonVersion>
     <XUnitAbstractionsVersion>2.0.3</XUnitAbstractionsVersion>
-    <MicrosoftDotNetRemoteExecutorVersion>7.0.0-beta.21559.3</MicrosoftDotNetRemoteExecutorVersion>
+    <MicrosoftDotNetRemoteExecutorVersion>7.0.0-beta.21518.1</MicrosoftDotNetRemoteExecutorVersion>
     <cdbsosversion>10.0.18362</cdbsosversion>
     <NewtonSoftJsonVersion>12.0.2</NewtonSoftJsonVersion>
   </PropertyGroup>
index 61824484c1741141a7fb903dbe39d6a387013204..31f16ee3c5fe427ca9e62c67e5e3e59a4d93ab92 100755 (executable)
 # Licensed under the MIT license. See LICENSE file in the project root for full license information.
 
 # Obtain the location of the bash script to figure out where the root of the repo is.
-__RepoRootDir="$(cd "$(dirname "$0")"/..; pwd -P)"
-
+source="${BASH_SOURCE[0]}"
+
+# Resolve $source until the file is no longer a symlink
+while [[ -h "$source" ]]; do
+  scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+  source="$(readlink "$source")"
+  # if $source was a relative symlink, we need to resolve it relative to the path where the
+  # symlink file was located
+  [[ $source != /* ]] && source="$scriptroot/$source"
+done
+__ProjectRoot="$( cd -P "$( dirname "$source" )/.." && pwd )"
+
+__BuildOS=Linux
+__HostOS=Linux
 __BuildArch=x64
-__BuildType=Debug
-__CMakeArgs=
-__CommonMSBuildArgs=
-__Compiler=clang
-__CompilerMajorVersion=
-__CompilerMinorVersion=
-__CrossBuild=0
-__DotnetRuntimeDownloadVersion="default"
-__DotnetRuntimeVersion="default"
-__ExtraCmakeArgs=
 __HostArch=x64
-__HostOS=Linux
-__IsMSBuildOnNETCoreSupported=0
-__ManagedBuild=1
-__ManagedBuildArgs=
-__NativeBuild=1
-__NumProc=1
+__BuildType=Debug
 __PortableBuild=1
-__PrivateBuildPath=
-__RootBinDir="$__RepoRootDir"/artifacts
-__RuntimeSourceFeed=
-__RuntimeSourceFeedKey=
-__SkipConfigure=0
-__SkipGenerateVersion=0
-__TargetOS=Linux
-__Test=0
+__ExtraCmakeArgs=""
+__ClangMajorVersion=0
+__ClangMinorVersion=0
+__NumProc=1
+__ManagedBuild=true
+__NativeBuild=true
+__CrossBuild=false
+__Test=false
+__PrivateBuildPath=""
+__CI=false
+__Verbosity=minimal
+__ManagedBuildArgs=
+__TestArgs=
 __UnprocessedBuildArgs=
+__DotnetRuntimeVersion='default'
+__DotnetRuntimeDownloadVersion='default'
+__RuntimeSourceFeed=''
+__RuntimeSourceFeedKey=''
+
+usage()
+{
+    echo "Usage: $0 [options]"
+    echo "--skipmanaged- Skip building managed components"
+    echo "--skipnative - Skip building native components"
+    echo "--test - run xunit tests"
+    echo "--privatebuildpath - path to local private runtime build to test"
+    echo "--architecture <x64|x86|arm|armel|arm64>"
+    echo "--configuration <debug|release>"
+    echo "--rootfs <ROOTFS_DIR>"
+    echo "--stripsymbols - strip symbols into .dbg files"
+    echo "--clangx.y - optional argument to build using clang version x.y"
+    echo "--ci - CI lab build"
+    echo "--verbosity <q[uiet]|m[inimal]|n[ormal]|d[etailed]|diag[nostic]>"
+    echo "--help - this help message"
+    exit 1
+}
 
-usage_list+=("-skipmanaged: do not build managed components.")
-usage_list+=("-skipnative: do not build native components.")
-usage_list+=("-privatebuildpath: path to local private runtime build to test.")
-usage_list+=("-test: run xunit tests")
+to_lowercase() {
+    #eval $invocation
 
-handle_arguments() {
+    echo "$1" | tr '[:upper:]' '[:lower:]'
+    return 0
+}
 
-    lowerI="$(echo "$1" | tr "[:upper:]" "[:lower:]")"
-    case "$lowerI" in
-        architecture|-architecture|-a)
-            __BuildArch="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
-            __ShiftArgs=1
+# Argument types supported by this script:
+#
+# Build architecture - valid values are: x64, x86, arm, armel, arm64
+# Build Type         - valid values are: debug, release
+#
+# Set the default arguments for build
+
+OSName=$(uname -s)
+if [ "$OSName" = "Darwin" ]; then
+    # On OSX universal binaries make uname -m unreliable.  The uname -m response changes
+    # based on what hardware is being emulated.
+    # Use sysctl instead
+    if [ "$(sysctl -q -n hw.optional.arm64)" = "1" ]; then
+        CPUName=arm64
+    elif [ "$(sysctl -q -n hw.optional.x86_64)" = "1" ]; then
+        CPUName=x86_64
+    else
+        CPUName=$(uname -m)
+    fi
+else
+    # Use uname to determine what the CPU is.
+    CPUName=$(uname -p)
+    # Some Linux platforms report unknown for platform, but the arch for machine.
+    if [ "$CPUName" == "unknown" ]; then
+        CPUName=$(uname -m)
+    fi
+fi
+
+case $CPUName in
+    i686|i386)
+        echo "Unsupported CPU $CPUName detected, build might not succeed!"
+        __BuildArch=x86
+        __HostArch=x86
+        ;;
+
+    x86_64|amd64)
+        __BuildArch=x64
+        __HostArch=x64
+        ;;
+
+    armv7l)
+        echo "Unsupported CPU $CPUName detected, build might not succeed!"
+        __BuildArch=arm
+        __HostArch=arm
+        ;;
+
+    aarch64|arm64)
+        __BuildArch=arm64
+        __HostArch=arm64
+        ;;
+
+    *)
+        echo "Unknown CPU $CPUName detected, configuring as if for x64"
+        __BuildArch=x64
+        __HostArch=x64
+        ;;
+esac
+
+# Use uname to determine what the OS is.
+OSName=$(uname -s)
+case $OSName in
+    Linux)
+        __BuildOS=Linux
+        __HostOS=Linux
+        ;;
+
+    Darwin)
+        __BuildOS=OSX
+        __HostOS=OSX
+        ;;
+
+    FreeBSD)
+        __BuildOS=FreeBSD
+        __HostOS=FreeBSD
+        ;;
+
+    OpenBSD)
+        __BuildOS=OpenBSD
+        __HostOS=OpenBSD
+        ;;
+
+    NetBSD)
+        __BuildOS=NetBSD
+        __HostOS=NetBSD
+        ;;
+
+    SunOS)
+        __BuildOS=SunOS
+        __HostOS=SunOS
+        ;;
+
+    *)
+        echo "Unsupported OS $OSName detected, configuring as if for Linux"
+        __BuildOS=Linux
+        __HostOS=Linux
+        ;;
+esac
+
+while :; do
+    if [ $# -le 0 ]; then
+        break
+    fi
+    # support both "--" and "-" options
+    opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
+    case $opt in
+        -\?|-h|-help)
+            usage
+            exit 1
             ;;
 
-        -binarylog|-bl|-clean|-integrationtest|-pack|-performancetest|-pipelineslog|-pl|-preparemachine|-publish|-r|-rebuild|-restore|-sign)
-            __ManagedBuildArgs="$__ManagedBuildArgs $1"
+        -skipmanaged)
+            __ManagedBuild=false
             ;;
 
-        configuration|-configuration|-c)
-            _type="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
-            if [[ "$_type" == "release" ]]; then
-                __BuildType=Release
-            elif [[ "$_type" = "checked" ]]; then
-                __BuildType=Checked
-            fi
+        -skipnative)
+            __NativeBuild=false
+            ;;
 
-            __ShiftArgs=1
+        -build|-b)
+            __ManagedBuild=true
             ;;
 
-        -clean|-binarylog|-bl|-pipelineslog|-pl|-restore|-r|-rebuild|-pack|-integrationtest|-performancetest|-sign|-publish|-preparemachine)
-            __ManagedBuildArgs="$__ManagedBuildArgs $1"
+        -test|-t)
+            __Test=true
+            ;;
+
+        -privatebuildpath)
+            __PrivateBuildPath="$2"
+            shift
             ;;
 
         -dotnetruntimeversion)
             __DotnetRuntimeVersion="$2"
-            __ShiftArgs=1
+            shift
             ;;
 
         -dotnetruntimedownloadversion)
             __DotnetRuntimeDownloadVersion="$2"
-            __ShiftArgs=1
-            ;;
-
-        privatebuildpath|-privatebuildpath)
-            __PrivateBuildPath="$1"
+            shift
             ;;
 
         -runtimesourcefeed)
             __RuntimeSourceFeed="$2"
-            __ShiftArgs=1
+            shift
             ;;
 
         -runtimesourcefeedkey)
             __RuntimeSourceFeedKey="$2"
-            __ShiftArgs=1
-             ;;
+            shift
+            ;;
+
+        -ci)
+            __CI=true
+            __ManagedBuildArgs="$__ManagedBuildArgs $1"
+            __TestArgs="$__TestArgs $1"
+            ;;
+
+        -projects)
+            __ManagedBuildArgs="$__ManagedBuildArgs $1 $2"
+            __TestArgs="$__TestArgs $1 $2"
+            shift
+            ;;
 
-        skipmanaged|-skipmanaged)
-            __ManagedBuild=0
+        -verbosity)
+            __Verbosity=$2
+            shift
             ;;
 
-        skipnative|-skipnative)
-            __NativeBuild=0
+        -configuration|-c)
+            __BuildType="$(to_lowercase "$2")"
+            shift
             ;;
 
-        test|-test)
-            __Test=1
+        -architecture|-a|-platform)
+            __BuildArch="$(to_lowercase "$2")"
+            shift
+            ;;
+
+        -rootfs)
+            export ROOTFS_DIR="$2"
+            shift
+            ;;
+
+        -portablebuild=false)
+            __PortableBuild=0
+            ;;
+
+        -stripsymbols)
+            __ExtraCmakeArgs="$__ExtraCmakeArgs -DSTRIP_SYMBOLS=true"
+            ;;
+
+        -clang*)
+            __Compiler=clang
+            # clangx.y or clang-x.y
+            version="$(echo "$1" | tr -d '[:alpha:]-=')"
+            parts=(${version//./ })
+            __ClangMajorVersion="${parts[0]}"
+            __ClangMinorVersion="${parts[1]}"
+            if [[ -z "$__ClangMinorVersion" && "$__ClangMajorVersion" -le 6 ]]; then
+                __ClangMinorVersion=0;
+            fi
+            ;;
+
+        -clean|-binarylog|-bl|-pipelineslog|-pl|-restore|-r|-rebuild|-pack|-integrationtest|-performancetest|-sign|-publish|-preparemachine)
+            __ManagedBuildArgs="$__ManagedBuildArgs $1"
             ;;
 
         -warnaserror|-nodereuse)
             __ManagedBuildArgs="$__ManagedBuildArgs $1 $2"
-            __ShiftArgs=1
             ;;
 
         *)
             __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
             ;;
     esac
-}
 
-source "$__RepoRootDir"/eng/native/build-commons.sh
+    shift
+done
 
-__LogsDir="$__RootBinDir/log/$__BuildType"
-__ConfigTriplet="$__TargetOS.$__BuildArch.$__BuildType"
-__BinDir="$__RootBinDir/bin/$__ConfigTriplet"
-__ArtifactsIntermediatesDir="$__RootBinDir/obj"
-__IntermediatesDir="$__ArtifactsIntermediatesDir/$__ConfigTriplet"
+if [ "$__BuildType" == "release" ]; then
+    __BuildType=Release
+fi
+if [ "$__BuildType" == "debug" ]; then
+    __BuildType=Debug
+fi
 
-# Specify path to be set for CMAKE_INSTALL_PREFIX.
-# This is where all built libraries will copied to.
-__CMakeBinDir="$__BinDir"
-export __CMakeBinDir
+# Needs to be set for generate version source file/msbuild
+if [[ -z $NUGET_PACKAGES ]]; then
+    if [[ $__CI == true ]]; then
+        export NUGET_PACKAGES="$__ProjectRoot/.packages"
+    else
+        export NUGET_PACKAGES="$HOME/.nuget/packages"
+    fi
+fi
 
-mkdir -p "$__IntermediatesDir"
-mkdir -p "$__LogsDir"
-mkdir -p "$__CMakeBinDir"
+echo $NUGET_PACKAGES
 
+__RootBinDir=$__ProjectRoot/artifacts
+__BinDir=$__RootBinDir/bin/$__BuildOS.$__BuildArch.$__BuildType
+__LogDir=$__RootBinDir/log/$__BuildOS.$__BuildArch.$__BuildType
+__IntermediatesDir=$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType
 __ExtraCmakeArgs="$__ExtraCmakeArgs -DCLR_MANAGED_BINARY_DIR=$__RootBinDir/bin -DCLR_BUILD_TYPE=$__BuildType"
+__DotNetCli=$__ProjectRoot/.dotnet/dotnet
 
 # Specify path to be set for CMAKE_INSTALL_PREFIX.
 # This is where all built native libraries will copied to.
@@ -143,14 +319,83 @@ if [[ "$__BuildArch" == "armel" ]]; then
     __PortableBuild=0
 fi
 
+# Configure environment if we are doing a cross compile.
+if [ "${__BuildArch}" != "${__HostArch}" ]; then
+    __CrossBuild=true
+    export CROSSCOMPILE=1
+    if [ "${__BuildOS}" != "OSX" ]; then
+        if ! [[ -n "$ROOTFS_DIR" ]]; then
+            echo "ERROR: ROOTFS_DIR not set for cross build"
+            exit 1
+        fi
+        echo "ROOTFS_DIR: $ROOTFS_DIR"
+    fi
+fi
+
+mkdir -p "$__IntermediatesDir"
+mkdir -p "$__LogDir"
+mkdir -p "$__CMakeBinDir"
+
+build_native()
+{
+    platformArch="$1"
+    intermediatesForBuild="$2"
+    extraCmakeArguments="$3"
+
+    # All set to commence the build
+    echo "Commencing $__DistroRid build for $__BuildOS.$__BuildArch.$__BuildType in $intermediatesForBuild"
+
+    generator=""
+    buildFile="Makefile"
+    buildTool="make"
+    scriptDir="$__ProjectRoot/eng"
+
+    pushd "$intermediatesForBuild"
+    echo "Invoking \"$scriptDir/gen-buildsys-clang.sh\" \"$__ProjectRoot\" $__ClangMajorVersion \"$__ClangMinorVersion\" $platformArch "$scriptDir" $__BuildType $generator $extraCmakeArguments"
+    "$scriptDir/gen-buildsys-clang.sh" "$__ProjectRoot" $__ClangMajorVersion "$__ClangMinorVersion" $platformArch "$scriptDir" $__BuildType $generator "$extraCmakeArguments"
+    popd
+
+    if [ ! -f "$intermediatesForBuild/$buildFile" ]; then
+        echo "Failed to generate build project!"
+        exit 1
+    fi
+
+    # Check that the makefiles were created.
+    pushd "$intermediatesForBuild"
+
+    echo "Executing $buildTool install -j $__NumProc"
+
+    $buildTool install -j $__NumProc | tee $__LogDir/make.log
+    if [ $? != 0 ]; then
+        echo "Failed to build."
+        exit 1
+    fi
+
+    popd
+}
+
+initTargetDistroRid()
+{
+    source "$__ProjectRoot/eng/init-distro-rid.sh"
+
+    local passedRootfsDir=""
+
+    # Only pass ROOTFS_DIR if cross is specified and the current platform is not OSX that doesn't use rootfs
+    if [ $__CrossBuild == true  -a "$__HostOS" != "OSX" ]; then
+        passedRootfsDir=${ROOTFS_DIR}
+    fi
+
+    initDistroRidGlobal ${__BuildOS} ${__BuildArch} ${__PortableBuild} ${passedRootfsDir}
+}
+
 #
 # Managed build
 #
 
-if [[ "$__ManagedBuild" == 1 ]]; then
+if [ $__ManagedBuild == true ]; then
     echo "Commencing managed build for $__BuildType in $__RootBinDir/bin"
-    "$__RepoRootDir/eng/common/build.sh" --build --configuration "$__BuildType" $__CommonMSBuildArgs $__ManagedBuildArgs $__UnprocessedBuildArgs
-    if [ "$?" != 0 ]; then
+    "$__ProjectRoot/eng/common/build.sh" --build --configuration "$__BuildType" --verbosity "$__Verbosity" $__ManagedBuildArgs $__UnprocessedBuildArgs
+    if [ $? != 0 ]; then
         exit 1
     fi
 fi
@@ -163,12 +408,26 @@ initTargetDistroRid
 
 echo "RID: $__DistroRid"
 
+# Set default clang version
+if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then
+   if [[ "$__BuildArch" == "arm" || "$__BuildArch" == "armel" ]]; then
+       __ClangMajorVersion=5
+       __ClangMinorVersion=0
+   elif [[ "$__BuildArch" == "arm64" && "$__DistroRid" == "linux-musl-arm64" ]]; then
+       __ClangMajorVersion=9
+       __ClangMinorVersion=
+   else
+       __ClangMajorVersion=3
+       __ClangMinorVersion=9
+   fi
+fi
+
 #
 # Setup LLDB paths for native build
 #
 
 if [ "$__HostOS" == "OSX" ]; then
-    export LLDB_H="$__RepoRootDir"/src/SOS/lldbplugin/swift-4.0
+    export LLDB_H=$__ProjectRoot/src/SOS/lldbplugin/swift-4.0
     export LLDB_LIB=$(xcode-select -p)/../SharedFrameworks/LLDB.framework/LLDB
     export LLDB_PATH=$(xcode-select -p)/usr/bin/lldb
 
@@ -197,17 +456,24 @@ fi
 #
 # Build native components
 #
-if [[ "$__NativeBuild" == 1 ]]; then
+
+if [ ! -e $__DotNetCli ]; then
+   echo "dotnet cli not installed $__DotNetCli"
+   exit 1
+fi
+
+if [ $__NativeBuild == true ]; then
     echo "Generating Version Source File"
-    __GenerateVersionLog="$__LogsDir/GenerateVersion.binlog"
+    __GenerateVersionLog="$__LogDir/GenerateVersion.binlog"
 
-    "$__RepoRootDir/eng/common/msbuild.sh" \
-        $__RepoRootDir/eng/CreateVersionFile.csproj \
+    "$__ProjectRoot/eng/common/msbuild.sh" \
+        $__ProjectRoot/eng/CreateVersionFile.csproj \
+        /v:$__Verbosity \
         /bl:$__GenerateVersionLog \
         /t:GenerateVersionFiles \
         /restore \
         /p:GenerateVersionSourceFile=true \
-        /p:NativeVersionSourceFile="$__ArtifactsIntermediatesDir/_version.c" \
+        /p:NativeVersionSourceFile="$__IntermediatesDir/version.cpp" \
         /p:Configuration="$__BuildType" \
         /p:Platform="$__BuildArch" \
         $__UnprocessedBuildArgs
@@ -217,14 +483,14 @@ if [[ "$__NativeBuild" == 1 ]]; then
         exit 1
     fi
 
-    build_native "$__TargetOS" "$__BuildArch" "$__RepoRootDir" "$__IntermediatesDir" "install" "$__ExtraCmakeArgs" "diagnostic component" | tee "$__LogsDir"/make.log
+    build_native "$__BuildArch" "$__IntermediatesDir" "$__ExtraCmakeArgs"
 fi
 
 #
 # Copy the native SOS binaries to where these tools expect for testing
 #
 
-if [[ "$__NativeBuild" == 1 || "$__Test" == 1 ]]; then
+if [[ $__NativeBuild == true || $__Test == true ]]; then
     __dotnet_sos=$__RootBinDir/bin/dotnet-sos/$__BuildType/netcoreapp3.1/publish/$__DistroRid
     __dotnet_dump=$__RootBinDir/bin/dotnet-dump/$__BuildType/netcoreapp3.1/publish/$__DistroRid
 
@@ -242,17 +508,17 @@ fi
 # Run xunit tests
 #
 
-if [[ "$__Test" == 1 ]]; then
-   if [[ "$__CrossBuild" == 0 ]]; then
-      if [[ -z "$LLDB_PATH" ]]; then
+if [ $__Test == true ]; then
+   if [ $__CrossBuild != true ]; then
+      if [ "$LLDB_PATH" == "" ]; then
           export LLDB_PATH="$(which lldb-3.9.1 2> /dev/null)"
-          if [[ -z "$LLDB_PATH" ]]; then
+          if [ "$LLDB_PATH" == "" ]; then
               export LLDB_PATH="$(which lldb-3.9 2> /dev/null)"
-              if [[ -z "$LLDB_PATH" ]]; then
+              if [ "$LLDB_PATH" == "" ]; then
                   export LLDB_PATH="$(which lldb-4.0 2> /dev/null)"
-                  if [[ -z "$LLDB_PATH" ]]; then
+                  if [ "$LLDB_PATH" == "" ]; then
                       export LLDB_PATH="$(which lldb-5.0 2> /dev/null)"
-                      if [[ -z "$LLDB_PATH" ]]; then
+                      if [ "$LLDB_PATH" == "" ]; then
                           export LLDB_PATH="$(which lldb 2> /dev/null)"
                       fi
                   fi
@@ -260,23 +526,24 @@ if [[ "$__Test" == 1 ]]; then
           fi
       fi
 
-      if [[ -z "$GDB_PATH" ]]; then
+      if [ "$GDB_PATH" == "" ]; then
           export GDB_PATH="$(which gdb 2> /dev/null)"
       fi
 
       echo "lldb: '$LLDB_PATH' gdb: '$GDB_PATH'"
 
-      "$__RepoRootDir/eng/common/build.sh" \
+      "$__ProjectRoot/eng/common/build.sh" \
         --test \
         --configuration "$__BuildType" \
-        /bl:"$__LogsDir"/Test.binlog \
+        --verbosity "$__Verbosity" \
+        /bl:$__LogDir/Test.binlog \
         /p:BuildArch="$__BuildArch" \
         /p:PrivateBuildPath="$__PrivateBuildPath" \
         /p:DotnetRuntimeVersion="$__DotnetRuntimeVersion" \
         /p:DotnetRuntimeDownloadVersion="$__DotnetRuntimeDownloadVersion" \
         /p:RuntimeSourceFeed="$__RuntimeSourceFeed" \
         /p:RuntimeSourceFeedKey="$__RuntimeSourceFeedKey" \
-        $__CommonMSBuildArgs
+        $__TestArgs
 
       if [ $? != 0 ]; then
           exit 1
index 19e60fcdcee0bf61058e21dac2d8715dbaca2f0e..850e8cc9116184f1032cfc42b96d07965e133c6b 100644 (file)
@@ -13,7 +13,6 @@ parameters:
   dockerImage: ''
   # Optional: ROOTFS_DIR to use
   crossrootfsDir: ''
-  crossbuild: false
   # Optional: test only job if true
   testOnly: false
   buildAndSkipTest: false
@@ -115,10 +114,10 @@ jobs:
       - _HelixSource: pr/dotnet/arcade/$(Build.SourceBranch)
 
     # This is only required for cross builds.
-    - ${{ if and(eq(parameters.crossbuild, false), eq(parameters.crossrootfsDir, '')) }}:
-      - _Cross: ''
-    - ${{ if or(eq(parameters.crossbuild, true), ne(parameters.crossrootfsDir, '')) }}:
-      - _Cross: -cross
+    - ${{ if eq(parameters.crossrootfsDir, '') }}:
+      - _RootFs: ''
+    - ${{ if ne(parameters.crossrootfsDir, '') }}:
+      - _RootFs: --rootfs ${{ parameters.crossrootfsDir }}
 
     steps:
     - ${{ if eq(parameters.osGroup, 'Linux') }}:
@@ -143,14 +142,12 @@ jobs:
     - script: $(_dockerEnv) $(_buildScript)
         -configuration $(_BuildConfig) 
         -architecture $(_BuildArch)
-        $(_Cross)
         $(_TestArgs)
+        $(_RootFs)
         /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
         $(_InternalInstallArgs)
       displayName: Build / Test
       condition: succeeded()
-      env:
-        ROOTFS_DIR: ${{ parameters.crossrootfsDir }}
 
     - ${{ if ne(variables['System.TeamProject'], 'public') }}:
       - task: CopyFiles@2
index ffc534ba0a6d992f64ec43083f79676a61829005..c4a1f2b4994d814366513ae4e3b636a391aaaaab 100755 (executable)
@@ -35,38 +35,9 @@ if [ "$__osname" == "Linux" ]; then
             source scl_source enable python27 devtoolset-2
         fi
     fi
-
-    # We are using old (2019) centos image in the CI with old cmake (2.8).
-    # Upgrading to 2021 centos image was failing SOS tests which rely on
-    # lldb REPL and ptrace etc. e.g. from test attachment logs:
-    #
-    #             00:00.136: error: process launch failed: 'A' packet returned an error: 8
-    #             00:00.136:
-    #             00:00.136: <END_COMMAND_ERROR>
-    #System.Exception: 'process launch -s' FAILED
-    #
-    # so we will keep using old image for now and install newer cmake as a workaround instead..
-    # FIXME: delete this comment and the next `if` block once centos image is upgraded.
-    if [ "$ID" = "centos" ]; then
-        # upgrade cmake
-        requiredversion=3.6.2
-        cmakeversion="$(cmake --version | head -1)"
-        currentversion="${cmakeversion##* }"
-        if ! printf '%s\n' "$requiredversion" "$currentversion" | sort --version-sort --check 2>/dev/null; then
-            echo "Old cmake version found: $currentversion, minimal requirement is $requiredversion. Upgrading to 3.15.5 .."
-            curl -sSL -o /tmp/cmake-install.sh https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-Linux-$(uname -m).sh
-            mkdir "$HOME/.cmake"
-            bash /tmp/cmake-install.sh --skip-license --exclude-subdir --prefix="$HOME/.cmake"
-            PATH="$HOME/.cmake/bin:$PATH"
-            export PATH
-            cmakeversion="$(cmake --version | head -1)"
-            newversion="${cmakeversion##* }"
-            echo "New cmake version is: $newversion"
-       fi
-    fi
 fi
 
-"$scriptroot/build.sh" -restore -prepareMachine -ci $@
+"$scriptroot/build.sh" --restore --prepareMachine --ci --stripsymbols $@
 if [[ $? != 0 ]]; then
     exit 1
 fi
diff --git a/eng/clang-compiler-override-arm.txt b/eng/clang-compiler-override-arm.txt
new file mode 100644 (file)
index 0000000..f02ced2
--- /dev/null
@@ -0,0 +1,20 @@
+SET (CMAKE_C_FLAGS_INIT                "-Wall -std=c11")
+SET (CMAKE_C_FLAGS_DEBUG_INIT          "-g -O0")
+SET (CLR_C_FLAGS_CHECKED_INIT          "-g -O1")
+# Refer to the below instruction to support __thread with -O2/-O3 on Linux/ARM
+# https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/linux-instructions.md
+SET (CMAKE_C_FLAGS_RELEASE_INIT        "-g -O1")
+SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -O1")
+
+SET (CMAKE_CXX_FLAGS_INIT                "-Wall -Wno-null-conversion -std=c++11")
+SET (CMAKE_CXX_FLAGS_DEBUG_INIT          "-g -O0")
+SET (CLR_CXX_FLAGS_CHECKED_INIT          "-g -O1")
+SET (CMAKE_CXX_FLAGS_RELEASE_INIT        "-g -O1")
+SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g -O1")
+
+SET (CLR_DEFINES_DEBUG_INIT              DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1)
+SET (CLR_DEFINES_CHECKED_INIT            DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1)
+SET (CLR_DEFINES_RELEASE_INIT            NDEBUG URTBLDENV_FRIENDLY=Retail)
+SET (CLR_DEFINES_RELWITHDEBINFO_INIT     NDEBUG URTBLDENV_FRIENDLY=Retail)
+
+SET (CMAKE_INSTALL_PREFIX                $ENV{__CMakeBinDir})
diff --git a/eng/clang-compiler-override.txt b/eng/clang-compiler-override.txt
new file mode 100644 (file)
index 0000000..2741303
--- /dev/null
@@ -0,0 +1,20 @@
+SET (CMAKE_C_FLAGS_INIT                "-Wall -std=c11")
+SET (CMAKE_C_FLAGS_DEBUG_INIT          "-g -O0")
+SET (CLR_C_FLAGS_CHECKED_INIT          "-g -O2")
+# Refer to the below instruction to support __thread with -O2/-O3 on Linux/ARM
+# https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/linux-instructions.md
+SET (CMAKE_C_FLAGS_RELEASE_INIT        "-g -O3")
+SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g -O2")
+
+SET (CMAKE_CXX_FLAGS_INIT                "-Wall -Wno-null-conversion -std=c++11")
+SET (CMAKE_CXX_FLAGS_DEBUG_INIT          "-g -O0")
+SET (CLR_CXX_FLAGS_CHECKED_INIT          "-g -O2")
+SET (CMAKE_CXX_FLAGS_RELEASE_INIT        "-g -O3")
+SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g -O2")
+
+SET (CLR_DEFINES_DEBUG_INIT              DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1)
+SET (CLR_DEFINES_CHECKED_INIT            DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1)
+SET (CLR_DEFINES_RELEASE_INIT            NDEBUG URTBLDENV_FRIENDLY=Retail)
+SET (CLR_DEFINES_RELWITHDEBINFO_INIT     NDEBUG URTBLDENV_FRIENDLY=Retail)
+
+SET (CMAKE_INSTALL_PREFIX                $ENV{__CMakeBinDir})
index f041e5ddd95892b0e39e8c3a6ff35f8605a73877..eea19cd8452fd5078faf23a31d12f6ea10c449ec 100644 (file)
@@ -6,7 +6,6 @@ Param(
   [switch] $ci,
   [switch] $prepareMachine,
   [switch] $excludePrereleaseVS,
-  [string] $msbuildEngine = $null,
   [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs
 )
 
index 4011d324e7391c90d1fd812670b08fcde34737bb..e8ab29afeb33309ec1f4704ccbccf42b4b0a3c86 100644 (file)
@@ -22,11 +22,6 @@ $RetryWaitTimeInSeconds = 30
 # Wait time between check for system load
 $SecondsBetweenLoadChecks = 10
 
-if (!$InputPath -or !(Test-Path $InputPath)){
-  Write-Host "No files to validate."
-  ExitWithExitCode 0
-}
-
 $ValidatePackage = {
   param( 
     [string] $PackagePath                                 # Full path to a Symbols.NuGet package
index cd2181bafa057d9e32e4c3c973e2f04c44f2b4da..a5af041ba775c87b79e825034537b39ebdff9c83 100644 (file)
@@ -4,11 +4,9 @@ param(
   [Parameter(Mandatory = $true)][string] $DotnetSymbolVersion, # Version of dotnet symbol to use
   [Parameter(Mandatory = $false)][switch] $CheckForWindowsPdbs, # If we should check for the existence of windows pdbs in addition to portable PDBs
   [Parameter(Mandatory = $false)][switch] $ContinueOnError, # If we should keep checking symbols after an error
-  [Parameter(Mandatory = $false)][switch] $Clean,           # Clean extracted symbols directory after checking symbols
-  [Parameter(Mandatory = $false)][string] $SymbolExclusionFile  # Exclude the symbols in the file from publishing to symbol server
+  [Parameter(Mandatory = $false)][switch] $Clean                  # Clean extracted symbols directory after checking symbols
 )
 
-. $PSScriptRoot\..\tools.ps1
 # Maximum number of jobs to run in parallel
 $MaxParallelJobs = 16
 
@@ -27,28 +25,14 @@ if ($CheckForWindowsPdbs) {
   $WindowsPdbVerificationParam = "--windows-pdbs"
 }
 
-$ExclusionSet = New-Object System.Collections.Generic.HashSet[string];
-
-if (!$InputPath -or !(Test-Path $InputPath)){
-  Write-Host "No symbols to validate."
-  ExitWithExitCode 0
-}
-
-#Check if the path exists
-if ($SymbolExclusionFile -and (Test-Path $SymbolExclusionFile)){
-  [string[]]$Exclusions = Get-Content "$SymbolExclusionFile"
-  $Exclusions | foreach { if($_ -and $_.Trim()){$ExclusionSet.Add($_)} }
-}
-else{
-  Write-Host "Symbol Exclusion file does not exists. No symbols to exclude."
-}
-
 $CountMissingSymbols = {
   param( 
     [string] $PackagePath, # Path to a NuGet package
     [string] $WindowsPdbVerificationParam # If we should check for the existence of windows pdbs in addition to portable PDBs
   )
 
+  . $using:PSScriptRoot\..\tools.ps1
+
   Add-Type -AssemblyName System.IO.Compression.FileSystem
 
   Write-Host "Validating $PackagePath "
@@ -134,17 +118,17 @@ $CountMissingSymbols = {
         # Save the output and get diagnostic output
         $output = & $dotnetSymbolExe --symbols --modules $WindowsPdbVerificationParam $TargetServerParam $FullPath -o $SymbolsPath --diagnostics | Out-String
 
-        if ((Test-Path $PdbPath) -and (Test-path $SymbolPath)) {
-          return 'Module and PDB for Module'
+        if (Test-Path $PdbPath) {
+          return 'PDB'
         }
-        elseif ((Test-Path $NGenPdb) -and (Test-Path $PdbPath) -and (Test-Path $SymbolPath)) {
-          return 'Dll, PDB and NGen PDB'
+        elseif (Test-Path $NGenPdb) {
+          return 'NGen PDB'
         }
-        elseif ((Test-Path $SODbg) -and (Test-Path $SymbolPath)) {
-          return 'So and DBG for SO'
+        elseif (Test-Path $SODbg) {
+          return 'DBG for SO'
         }  
-        elseif ((Test-Path $DylibDwarf) -and (Test-Path $SymbolPath)) {
-          return 'Dylib and Dwarf for Dylib'
+        elseif (Test-Path $DylibDwarf) {
+          return 'Dwarf for Dylib'
         }  
         elseif (Test-Path $SymbolPath) {
           return 'Module'
@@ -158,44 +142,37 @@ $CountMissingSymbols = {
       return $null
     }
 
-    $FileRelativePath = $FileName.Replace("$ExtractPath\", "")
-    if (($($using:ExclusionSet) -ne $null) -and ($($using:ExclusionSet).Contains($FileRelativePath) -or ($($using:ExclusionSet).Contains($FileRelativePath.Replace("\", "/"))))){
-      Write-Host "Skipping $FileName from symbol validation"
+    $FileGuid = New-Guid
+    $ExpandedSymbolsPath = Join-Path -Path $SymbolsPath -ChildPath $FileGuid
+
+    $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault `
+        -FullPath $FileName `
+        -TargetServerParam '--microsoft-symbol-server' `
+        -SymbolsPath "$ExpandedSymbolsPath-msdl" `
+        -WindowsPdbVerificationParam $WindowsPdbVerificationParam
+    $SymbolsOnSymWeb = & $FirstMatchingSymbolDescriptionOrDefault `
+        -FullPath $FileName `
+        -TargetServerParam '--internal-server' `
+        -SymbolsPath "$ExpandedSymbolsPath-symweb" `
+        -WindowsPdbVerificationParam $WindowsPdbVerificationParam
+
+    Write-Host -NoNewLine "`t Checking file " $FileName "... "
+  
+    if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) {
+      Write-Host "Symbols found on MSDL ($SymbolsOnMSDL) and SymWeb ($SymbolsOnSymWeb)"
     }
-
     else {
-      $FileGuid = New-Guid
-      $ExpandedSymbolsPath = Join-Path -Path $SymbolsPath -ChildPath $FileGuid
-
-      $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault `
-          -FullPath $FileName `
-          -TargetServerParam '--microsoft-symbol-server' `
-          -SymbolsPath "$ExpandedSymbolsPath-msdl" `
-          -WindowsPdbVerificationParam $WindowsPdbVerificationParam
-      $SymbolsOnSymWeb = & $FirstMatchingSymbolDescriptionOrDefault `
-          -FullPath $FileName `
-          -TargetServerParam '--internal-server' `
-          -SymbolsPath "$ExpandedSymbolsPath-symweb" `
-          -WindowsPdbVerificationParam $WindowsPdbVerificationParam
-
-      Write-Host -NoNewLine "`t Checking file " $FileName "... "
-  
-      if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) {
-        Write-Host "Symbols found on MSDL ($SymbolsOnMSDL) and SymWeb ($SymbolsOnSymWeb)"
+      $MissingSymbols++
+
+      if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) {
+        Write-Host 'No symbols found on MSDL or SymWeb!'
       }
       else {
-        $MissingSymbols++
-
-        if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) {
-          Write-Host 'No symbols found on MSDL or SymWeb!'
+        if ($SymbolsOnMSDL -eq $null) {
+          Write-Host 'No symbols found on MSDL!'
         }
         else {
-          if ($SymbolsOnMSDL -eq $null) {
-            Write-Host 'No symbols found on MSDL!'
-          }
-          else {
-            Write-Host 'No symbols found on SymWeb!'
-          }
+          Write-Host 'No symbols found on SymWeb!'
         }
       }
     }
index 8a68fc24b11b0de851015c35c1bb19bd0f5c46a8..4999c307088a03f2a2b9d0686e4fd6ba7ec7ee88 100644 (file)
@@ -69,13 +69,13 @@ try {
     # For some tools, add default and automatic args.
     if ($tool.Name -eq 'credscan') {
       if ($targetDirectory) {
-        $tool.Args += "`"TargetDirectory < $TargetDirectory`""
+        $tool.Args += "TargetDirectory < $TargetDirectory"
       }
-      $tool.Args += "`"OutputType < pre`""
+      $tool.Args += "OutputType < pre"
       $tool.Args += $CrScanAdditionalRunConfigParams
     } elseif ($tool.Name -eq 'policheck') {
       if ($targetDirectory) {
-        $tool.Args += "`"Target < $TargetDirectory`""
+        $tool.Args += "Target < $TargetDirectory"
       }
       $tool.Args += $PoliCheckAdditionalRunConfigParams
     }
index 3aafc82e4171a7262f7471374091393bb45878e9..69eb67849d741db33a0e737cbfd667317c3d9313 100644 (file)
@@ -60,7 +60,11 @@ jobs:
     - name: GuardianPackagesConfigFile
       value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
   pool:
-    vmImage: windows-2019
+    # To extract archives (.tar.gz, .zip), we need access to "tar", added in Windows 10/2019.
+    ${{ if eq(parameters.extractArchiveArtifacts, 'false') }}:
+      name: Hosted VS2017
+    ${{ if ne(parameters.extractArchiveArtifacts, 'false') }}:
+      vmImage: windows-2019
   steps:
   - checkout: self
     clean: true
index c4fc18b3ee77aa316c409fbb9a82c056a1795751..e8bc77d2ebbe39e3e16bae0a6c6d66d68fa3c907 100644 (file)
@@ -4,7 +4,7 @@ parameters:
 
   # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool
   pool:
-    vmImage: 'windows-2019'
+    vmImage: vs2017-win2016
 
   CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex
   GithubPat: $(BotAccount-dotnet-bot-repo-PAT)
@@ -12,7 +12,6 @@ parameters:
   SourcesDirectory: $(Build.SourcesDirectory)
   CreatePr: true
   AutoCompletePr: false
-  ReusePr: true
   UseLfLineEndings: true
   UseCheckedInLocProjectJson: false
   LanguageSet: VS_Main_Languages
@@ -65,8 +64,6 @@ jobs:
         ${{ if eq(parameters.CreatePr, true) }}:
           isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }}
           isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }}
-          ${{ if eq(parameters.RepoType, 'gitHub') }}:
-            isShouldReusePrSelected: ${{ parameters.ReusePr }}
         packageSourceAuth: patAuth
         patVariable: ${{ parameters.CeapexPat }}
         ${{ if eq(parameters.RepoType, 'gitHub') }}:
index 5cd5325d7b4e6bfd6abf9d07dcb5c958f01664ef..5023d36dcb3c5bc7e639d4d26681ea44409ea3b8 100644 (file)
@@ -31,6 +31,11 @@ parameters:
   #   container and pool.
   platform: {}
 
+  # The default VM host AzDO pool. This should be capable of running Docker containers: almost all
+  # source-build builds run in Docker, including the default managed platform.
+  defaultContainerHostPool:
+    vmImage: ubuntu-20.04
+
 jobs:
 - job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }}
   displayName: Source-Build (${{ parameters.platform.name }})
@@ -42,15 +47,7 @@ jobs:
     container: ${{ parameters.platform.container }}
 
   ${{ if eq(parameters.platform.pool, '') }}:
-    # The default VM host AzDO pool. This should be capable of running Docker containers: almost all
-    # source-build builds run in Docker, including the default managed platform.
-    pool:
-      ${{ if eq(variables['System.TeamProject'], 'public') }}:
-        name: NetCore1ESPool-Public
-        demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open
-      ${{ if eq(variables['System.TeamProject'], 'internal') }}:
-        name: NetCore1ESPool-Internal
-        demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
+    pool: ${{ parameters.defaultContainerHostPool }}
   ${{ if ne(parameters.platform.pool, '') }}:
     pool: ${{ parameters.platform.pool }}
 
index 4af724eb1a9ec9691b824796619f67822fbae2b2..1cc0c29e4fdabcd1a50bc223892c908c4474a193 100644 (file)
@@ -5,6 +5,8 @@ parameters:
   sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci"
   preSteps: []
   binlogPath: artifacts/log/Debug/Build.binlog
+  pool:
+    vmImage: vs2017-win2016
   condition: ''
   dependsOn: ''
 
@@ -22,13 +24,7 @@ jobs:
   - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
     - group: source-dot-net stage1 variables
 
-  pool:
-    ${{ if eq(variables['System.TeamProject'], 'public') }}:
-      name: NetCore1ESPool-Public
-      demands: ImageOverride -equals Build.Server.Amd64.VS2019.Open
-    ${{ if eq(variables['System.TeamProject'], 'internal') }}:
-      name: NetCore1ESPool-Internal
-      demands: ImageOverride -equals Build.Server.Amd64.VS2019
+  pool: ${{ parameters.pool }}
   steps:
   - ${{ each preStep in parameters.preSteps }}:
     - ${{ preStep }}
index 8dd1fdbd144a06e265057c2a0d2e7dc8c9b9031d..a1f8fce96ca81d2ab91411c1c9c77f57f125930e 100644 (file)
@@ -83,7 +83,7 @@ jobs:
         - ${{ if eq(parameters.enableSourceBuild, true) }}:
           - Source_Build_Complete
         pool:
-          vmImage: 'windows-2019'
+          vmImage: vs2017-win2016
         runAsPublic: ${{ parameters.runAsPublic }}
         publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }}
         enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }}
@@ -96,4 +96,4 @@ jobs:
         dependsOn:
           - Asset_Registry_Publish
         pool:
-          vmImage: 'windows-2019'
+          vmImage: vs2017-win2016
diff --git a/eng/cross/toolchain.cmake b/eng/cross/toolchain.cmake
new file mode 100644 (file)
index 0000000..cb7770e
--- /dev/null
@@ -0,0 +1,157 @@
+set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
+
+set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH})
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_VERSION 1)
+
+if(TARGET_ARCH_NAME STREQUAL "armel")
+  set(CMAKE_SYSTEM_PROCESSOR armv7l)
+  set(TOOLCHAIN "arm-linux-gnueabi")
+  if("$ENV{__DistroRid}" MATCHES "tizen.*")
+    set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi/6.2.1")
+  endif()
+elseif(TARGET_ARCH_NAME STREQUAL "arm")
+  set(CMAKE_SYSTEM_PROCESSOR armv7l)
+  if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf)
+    set(TOOLCHAIN "armv6-alpine-linux-musleabihf")
+  else()
+    set(TOOLCHAIN "arm-linux-gnueabihf")
+  endif()
+elseif(TARGET_ARCH_NAME STREQUAL "arm64")
+  set(CMAKE_SYSTEM_PROCESSOR aarch64)
+  if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl)
+    set(TOOLCHAIN "aarch64-alpine-linux-musl")
+  else()
+    set(TOOLCHAIN "aarch64-linux-gnu")
+  endif()
+elseif(TARGET_ARCH_NAME STREQUAL "x86")
+  set(CMAKE_SYSTEM_PROCESSOR i686)
+  set(TOOLCHAIN "i686-linux-gnu")
+elseif(TARGET_ARCH_NAME STREQUAL "mips64")
+  set(CMAKE_SYSTEM_PROCESSOR mips64)
+  set(TOOLCHAIN "mips64el-linux-gnuabi64")
+else()
+  message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, mips64 and x86 are supported!")
+endif()
+
+if(DEFINED ENV{TOOLCHAIN})
+  set(TOOLCHAIN $ENV{TOOLCHAIN})
+endif()
+
+# This gets called with CLR_CMAKE_COMPILER set on the first invocation
+# but the cmake variable is not getting populated into other calls.
+# Use environment variable to keep CLR_CMAKE_COMPILER around.
+if (NOT DEFINED CLR_CMAKE_COMPILER)
+  set(CLR_CMAKE_COMPILER $ENV{CLR_CMAKE_COMPILER})
+else()
+  set(ENV{CLR_CMAKE_COMPILER} ${CLR_CMAKE_COMPILER})
+endif()
+
+# Specify include paths
+if(TARGET_ARCH_NAME STREQUAL "armel")
+  if(DEFINED TIZEN_TOOLCHAIN)
+    include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/)
+    include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi)
+  endif()
+endif()
+
+# add_compile_param - adds only new options without duplicates.
+# arg0 - list with result options, arg1 - list with new options.
+# arg2 - optional argument, quick summary string for optional using CACHE FORCE mode.
+macro(add_compile_param)
+  if(NOT ${ARGC} MATCHES "^(2|3)$")
+    message(FATAL_ERROR "Wrong using add_compile_param! Two or three parameters must be given! See add_compile_param description.")
+  endif()
+  foreach(OPTION ${ARGV1})
+    if(NOT ${ARGV0} MATCHES "${OPTION}($| )")
+      set(${ARGV0} "${${ARGV0}} ${OPTION}")
+      if(${ARGC} EQUAL "3") # CACHE FORCE mode
+        set(${ARGV0} "${${ARGV0}}" CACHE STRING "${ARGV2}" FORCE)
+      endif()
+    endif()
+  endforeach()
+endmacro()
+
+# Specify link flags
+add_compile_param(CROSS_LINK_FLAGS "--sysroot=${CROSS_ROOTFS}")
+if (CLR_CMAKE_COMPILER STREQUAL "Clang")
+  add_compile_param(CROSS_LINK_FLAGS "--gcc-toolchain=${CROSS_ROOTFS}/usr")
+  add_compile_param(CROSS_LINK_FLAGS "--target=${TOOLCHAIN}")
+endif()
+
+if(TARGET_ARCH_NAME STREQUAL "armel")
+  if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only
+    add_compile_param(CROSS_LINK_FLAGS "-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
+    add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/lib")
+    add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib")
+    add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
+  endif()
+elseif(TARGET_ARCH_NAME STREQUAL "x86")
+  add_compile_param(CROSS_LINK_FLAGS "-m32")
+endif()
+
+add_compile_param(CMAKE_EXE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS")
+add_compile_param(CMAKE_SHARED_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS")
+add_compile_param(CMAKE_MODULE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS")
+
+# Specify compile options
+add_compile_options("--sysroot=${CROSS_ROOTFS}")
+if (CLR_CMAKE_COMPILER STREQUAL "Clang")
+  add_compile_options("--target=${TOOLCHAIN}")
+  add_compile_options("--gcc-toolchain=${CROSS_ROOTFS}/usr")
+endif()
+
+if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$")
+  set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN})
+  set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN})
+  set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN})
+endif()
+
+if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
+  add_compile_options(-mthumb)
+  add_compile_options(-mfpu=vfpv3)
+  if(TARGET_ARCH_NAME STREQUAL "armel")
+    add_compile_options(-mfloat-abi=softfp)
+    if(DEFINED TIZEN_TOOLCHAIN)
+      add_compile_options(-Wno-deprecated-declarations) # compile-time option
+      add_compile_options(-D__extern_always_inline=inline) # compile-time option
+    endif()
+  endif()
+elseif(TARGET_ARCH_NAME STREQUAL "x86")
+  add_compile_options(-m32)
+  add_compile_options(-Wno-error=unused-command-line-argument)
+endif()
+
+# Set LLDB include and library paths
+if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$")
+  if(TARGET_ARCH_NAME STREQUAL "x86")
+    set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}")
+  else() # arm/armel case
+    set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}")
+  endif()
+  if(LLVM_CROSS_DIR)
+    set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "")
+    set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "")
+    set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "")
+    set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "")
+  else()
+    if(TARGET_ARCH_NAME STREQUAL "x86")
+      set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "")
+      set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include")
+      if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}")
+        set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}")
+      else()
+        set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include")
+      endif()
+    else() # arm/armel case
+      set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "")
+      set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "")
+    endif()
+  endif()
+endif()
+
+set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}")
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
diff --git a/eng/cross/tryrun.cmake b/eng/cross/tryrun.cmake
new file mode 100644 (file)
index 0000000..b6e17dd
--- /dev/null
@@ -0,0 +1,111 @@
+set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
+set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH})
+
+macro(set_cache_value)
+  set(${ARGV0} ${ARGV1} CACHE STRING "Result from TRY_RUN" FORCE)
+  set(${ARGV0}__TRYRUN_OUTPUT "dummy output" CACHE STRING "Output from TRY_RUN" FORCE)
+endmacro()
+
+if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv7-alpine-linux-musleabihf OR
+   EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf OR
+   EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl)
+  
+   SET(ALPINE_LINUX 1)
+elseif(EXISTS /System/Library/CoreServices)
+  set(DARWIN 1)
+endif()
+
+if(DARWIN)
+  if(TARGET_ARCH_NAME MATCHES "^(arm64|x64)$")
+    set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1)
+    set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 1)
+    set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 1)
+    set_cache_value(HAVE_BROKEN_FIFO_KEVENT_EXITCODE 1)
+    set_cache_value(HAVE_BROKEN_FIFO_SELECT_EXITCODE 1)
+    set_cache_value(HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE 1)
+    set_cache_value(HAVE_CLOCK_MONOTONIC_EXITCODE 0)
+    set_cache_value(HAVE_CLOCK_THREAD_CPUTIME_EXITCODE 0)
+    set_cache_value(HAVE_CLOCK_GETTIME_NSEC_NP_EXITCODE 0)
+    set_cache_value(HAVE_COMPATIBLE_ACOS_EXITCODE 0)
+    set_cache_value(HAVE_COMPATIBLE_ASIN_EXITCODE 0)
+    set_cache_value(HAVE_COMPATIBLE_ATAN2_EXITCODE 0)
+    set_cache_value(HAVE_COMPATIBLE_EXP_EXITCODE 1)
+    set_cache_value(HAVE_COMPATIBLE_ILOGB0_EXITCODE 0)
+    set_cache_value(HAVE_COMPATIBLE_ILOGBNAN_EXITCODE 1)
+    set_cache_value(HAVE_COMPATIBLE_LOG10_EXITCODE 0)
+    set_cache_value(HAVE_COMPATIBLE_LOG_EXITCODE 0)
+    set_cache_value(HAVE_COMPATIBLE_POW_EXITCODE 0)
+    set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 1)
+    set_cache_value(HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE 0)
+    set_cache_value(HAVE_MMAP_DEV_ZERO_EXITCODE 1)
+    set_cache_value(HAVE_PROCFS_CTL_EXITCODE 1)
+    set_cache_value(HAVE_PROCFS_MAPS_EXITCODE 1)
+    set_cache_value(HAVE_PROCFS_STATUS_EXITCODE 1)
+    set_cache_value(HAVE_PROCFS_STAT_EXITCODE 1)
+    set_cache_value(HAVE_SCHED_GETCPU_EXITCODE 1)
+    set_cache_value(HAVE_SCHED_GET_PRIORITY_EXITCODE 0)
+    set_cache_value(HAVE_VALID_NEGATIVE_INF_POW_EXITCODE 0)
+    set_cache_value(HAVE_VALID_POSITIVE_INF_POW_EXITCODE 0)
+    set_cache_value(HAVE_WORKING_CLOCK_GETTIME_EXITCODE 0)
+    set_cache_value(HAVE_WORKING_GETTIMEOFDAY_EXITCODE 0)
+    set_cache_value(MMAP_ANON_IGNORES_PROTECTION_EXITCODE 1)
+    set_cache_value(ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS_EXITCODE 1)
+    set_cache_value(PTHREAD_CREATE_MODIFIES_ERRNO_EXITCODE 1)
+    set_cache_value(REALPATH_SUPPORTS_NONEXISTENT_FILES_EXITCODE 1)
+    set_cache_value(SEM_INIT_MODIFIES_ERRNO_EXITCODE 1)
+    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)
+  else()
+    message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!")
+  endif()
+elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|mips64|x86)$")
+  set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1)
+  set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 0)
+  set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 0)
+  set_cache_value(HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE 0)
+  set_cache_value(HAVE_CLOCK_MONOTONIC_EXITCODE 0)
+  set_cache_value(HAVE_CLOCK_THREAD_CPUTIME_EXITCODE 0)
+  set_cache_value(HAVE_COMPATIBLE_ACOS_EXITCODE 0)
+  set_cache_value(HAVE_COMPATIBLE_ASIN_EXITCODE 0)
+  set_cache_value(HAVE_COMPATIBLE_ATAN2_EXITCODE 0)
+  set_cache_value(HAVE_COMPATIBLE_ILOGB0_EXITCODE 1)
+  set_cache_value(HAVE_COMPATIBLE_ILOGBNAN_EXITCODE 1)
+  set_cache_value(HAVE_COMPATIBLE_LOG10_EXITCODE 0)
+  set_cache_value(HAVE_COMPATIBLE_LOG_EXITCODE 0)
+  set_cache_value(HAVE_COMPATIBLE_POW_EXITCODE 0)
+  set_cache_value(HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE 0)
+  set_cache_value(HAVE_MMAP_DEV_ZERO_EXITCODE 0)
+  set_cache_value(HAVE_PROCFS_CTL_EXITCODE 1)
+  set_cache_value(HAVE_PROCFS_MAPS_EXITCODE 0)
+  set_cache_value(HAVE_PROCFS_STATUS_EXITCODE 0)
+  set_cache_value(HAVE_PROCFS_STAT_EXITCODE 0)
+  set_cache_value(HAVE_SCHED_GETCPU_EXITCODE 0)
+  set_cache_value(HAVE_SCHED_GET_PRIORITY_EXITCODE 0)
+  set_cache_value(HAVE_VALID_NEGATIVE_INF_POW_EXITCODE 0)
+  set_cache_value(HAVE_VALID_POSITIVE_INF_POW_EXITCODE 0)
+  set_cache_value(HAVE_WORKING_CLOCK_GETTIME_EXITCODE 0)
+  set_cache_value(HAVE_WORKING_GETTIMEOFDAY_EXITCODE 0)
+  set_cache_value(ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS_EXITCODE 1)
+  set_cache_value(PTHREAD_CREATE_MODIFIES_ERRNO_EXITCODE 1)
+  set_cache_value(REALPATH_SUPPORTS_NONEXISTENT_FILES_EXITCODE 1)
+  set_cache_value(SEM_INIT_MODIFIES_ERRNO_EXITCODE 1)
+
+
+  if(ALPINE_LINUX)
+    set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 0)
+    set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 1)
+    set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 1)
+  else()
+    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 0)
+  endif()
+
+else()
+  message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, mips64 and x86 are supported!")
+endif()
+
+if(TARGET_ARCH_NAME STREQUAL "x86")
+  set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
+endif()
diff --git a/eng/empty.csproj b/eng/empty.csproj
deleted file mode 100644 (file)
index 23ebe5a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <!-- This project exists purely to work around Arcade
-       behavior. Arcade knows how to restore tasks needed for
-       publishing to blob feeds, but it requires a project file that
-       imports nuget restore targets to be specified for this to
-       work. See details in
-       https://github.com/dotnet/arcade/commit/f657be5cb7cd4920334dd9162173b131211a1e17#r31728598.
-  -->
-
-  <PropertyGroup>
-    <TargetFramework>net6.0</TargetFramework>
-  </PropertyGroup>
-
-  <Import Project="versioning.targets" />
-
-</Project>
diff --git a/eng/gen-buildsys-clang.sh b/eng/gen-buildsys-clang.sh
new file mode 100755 (executable)
index 0000000..a805d1e
--- /dev/null
@@ -0,0 +1,197 @@
+#!/usr/bin/env bash
+#
+# This file invokes cmake and generates the build system for Clang.
+#
+
+if [ $# -lt 5 ]
+then
+  echo "Usage..."
+  echo "gen-buildsys-clang.sh <path to top level CMakeLists.txt> <ClangMajorVersion> <ClangMinorVersion> <Architecture> <ScriptDirectory> [build flavor] [coverage] [ninja] [scan-build] [cmakeargs]"
+  echo "Specify the path to the top level CMake file - <ProjectK>/src/NDP"
+  echo "Specify the clang version to use, split into major and minor version"
+  echo "Specify the target architecture."
+  echo "Specify the script directory."
+  echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG." 
+  echo "Optionally specify 'coverage' to enable code coverage build."
+  echo "Optionally specify 'scan-build' to enable build with clang static analyzer."
+  echo "Target ninja instead of make. ninja must be on the PATH."
+  echo "Pass additional arguments to CMake call."
+  exit 1
+fi
+
+# Set up the environment to be used for building with clang.
+if command -v "clang-$2.$3" > /dev/null
+    then
+        desired_llvm_version="-$2.$3"
+elif command -v "clang$2$3" > /dev/null
+    then
+        desired_llvm_version="$2$3"
+elif command -v "clang-$2$3" > /dev/null
+    then
+        desired_llvm_version="-$2$3"
+elif command -v "clang-$2" > /dev/null
+    then
+        desired_llvm_version="-$2"
+elif command -v "clang$2" > /dev/null
+    then
+        desired_llvm_version="$2"
+elif command -v clang > /dev/null
+    then
+        desired_llvm_version=
+else
+    echo "Unable to find Clang Compiler"
+    exit 1
+fi
+
+export CC="$(command -v clang$desired_llvm_version)"
+export CXX="$(command -v clang++$desired_llvm_version)"
+
+build_arch="$4"
+script_dir="$5"
+buildtype=DEBUG
+code_coverage=OFF
+build_tests=OFF
+scan_build=OFF
+generator="Unix Makefiles"
+__UnprocessedCMakeArgs=""
+
+for i in "${@:6}"; do
+    upperI="$(echo $i | awk '{print toupper($0)}')"
+    case $upperI in
+      # Possible build types are DEBUG, CHECKED, RELEASE, RELWITHDEBINFO, MINSIZEREL.
+      DEBUG | CHECKED | RELEASE | RELWITHDEBINFO | MINSIZEREL)
+      buildtype=$upperI
+      ;;
+      COVERAGE)
+      echo "Code coverage is turned on for this build."
+      code_coverage=ON
+      ;;
+      NINJA)
+      generator=Ninja
+      ;;
+      SCAN-BUILD)
+      echo "Static analysis is turned on for this build."
+      scan_build=ON
+      ;;
+      *)
+      __UnprocessedCMakeArgs="${__UnprocessedCMakeArgs}${__UnprocessedCMakeArgs:+ }$i"
+    esac
+done
+
+OS=`uname`
+
+# Locate llvm
+# This can be a little complicated, because the common use-case of Ubuntu with
+# llvm-3.5 installed uses a rather unusual llvm installation with the version
+# number postfixed (i.e. llvm-ar-3.5), so we check for that first.
+# On FreeBSD the version number is appended without point and dash (i.e.
+# llvm-ar35).
+# Additionally, OSX doesn't use the llvm- prefix.
+if [ $OS = "Linux" -o $OS = "FreeBSD" -o $OS = "OpenBSD" -o $OS = "NetBSD" -o $OS = "SunOS" ]; then
+  llvm_prefix="llvm-"
+elif [ $OS = "Darwin" ]; then
+  llvm_prefix=""
+else
+  echo "Unable to determine build platform"
+  exit 1
+fi
+
+locate_llvm_exec() {
+  if command -v "$llvm_prefix$1$desired_llvm_version" > /dev/null 2>&1
+  then
+    echo "$(command -v $llvm_prefix$1$desired_llvm_version)"
+  elif command -v "$llvm_prefix$1" > /dev/null 2>&1
+  then
+    echo "$(command -v $llvm_prefix$1)"
+  else
+    exit 1
+  fi
+}
+
+llvm_ar="$(locate_llvm_exec ar)"
+[[ $? -eq 0 ]] || { echo "Unable to locate llvm-ar"; exit 1; }
+llvm_link="$(locate_llvm_exec link)"
+[[ $? -eq 0 ]] || { echo "Unable to locate llvm-link"; exit 1; }
+llvm_nm="$(locate_llvm_exec nm)"
+[[ $? -eq 0 ]] || { echo "Unable to locate llvm-nm"; exit 1; }
+if [ $OS = "Linux" -o $OS = "FreeBSD" -o $OS = "OpenBSD" -o $OS = "NetBSD" -o $OS = "SunOS" ]; then
+  llvm_objdump="$(locate_llvm_exec objdump)"
+  [[ $? -eq 0 ]] || { echo "Unable to locate llvm-objdump"; exit 1; }
+fi
+
+cmake_extra_defines=
+if [[ -n "$LLDB_LIB_DIR" ]]; then
+    cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_LIBS=$LLDB_LIB_DIR"
+fi
+if [[ -n "$LLDB_INCLUDE_DIR" ]]; then
+    cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_INCLUDES=$LLDB_INCLUDE_DIR"
+fi
+if [ "$CROSSCOMPILE" == "1" ]; then
+    platform="$(uname)"
+    # OSX doesn't use rootfs
+    if ! [[ -n "$ROOTFS_DIR" || "$platform" == "Darwin" ]]; then
+        echo "ROOTFS_DIR not set for crosscompile"
+        exit 1
+    fi
+    if [[ -z $CONFIG_DIR ]]; then
+        CONFIG_DIR="$1/eng/cross"
+    fi
+    export TARGET_BUILD_ARCH=$build_arch
+    cmake_extra_defines="$cmake_extra_defines -C $CONFIG_DIR/tryrun.cmake"
+    cmake_extra_defines="$cmake_extra_defines -DCLR_UNIX_CROSS_BUILD=1"
+
+    if [[ "$platform" == "Darwin" ]]; then
+        cmake_extra_defines="$cmake_extra_defines -DCMAKE_SYSTEM_NAME=Darwin"
+    else
+        cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$CONFIG_DIR/toolchain.cmake"
+    fi
+fi
+if [ $OS == "Linux" ]; then
+    linux_id_file="/etc/os-release"
+    if [[ -n "$CROSSCOMPILE" ]]; then
+        linux_id_file="$ROOTFS_DIR/$linux_id_file"
+    fi
+    if [[ -e $linux_id_file ]]; then
+        source $linux_id_file
+        cmake_extra_defines="$cmake_extra_defines -DCLR_CMAKE_LINUX_ID=$ID"
+    fi
+fi
+if [ "$build_arch" == "armel" ]; then
+    cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
+fi
+
+clang_version=$( $CC --version | head -1 | sed 's/[^0-9]*\([0-9]*\.[0-9]*\).*/\1/' )
+# Use O1 option when the clang version is smaller than 3.9
+# Otherwise use O3 option in release build
+if [[ ( ${clang_version%.*} -eq 3  &&  ${clang_version#*.} -lt 9 ) &&
+      (  "$build_arch" == "arm" || "$build_arch" == "armel" ) ]]; then
+    overridefile=clang-compiler-override-arm.txt
+else
+    overridefile=clang-compiler-override.txt
+fi
+
+__currentScriptDir="$script_dir"
+
+cmake_command=cmake
+
+if [[ "$scan_build" == "ON" ]]; then
+    export CCC_CC=$CC
+    export CCC_CXX=$CXX
+    export SCAN_BUILD_COMMAND=$(command -v scan-build$desired_llvm_version)
+    cmake_command="$SCAN_BUILD_COMMAND $cmake_command"
+fi
+
+$cmake_command \
+  -G "$generator" \
+  "-DCMAKE_USER_MAKE_RULES_OVERRIDE=${__currentScriptDir}/$overridefile" \
+  "-DCMAKE_AR=$llvm_ar" \
+  "-DCMAKE_LINKER=$llvm_link" \
+  "-DCMAKE_NM=$llvm_nm" \
+  "-DCMAKE_OBJDUMP=$llvm_objdump" \
+  "-DCMAKE_BUILD_TYPE=$buildtype" \
+  "-DCMAKE_EXPORT_COMPILE_COMMANDS=1 " \
+  "-DCLR_CMAKE_ENABLE_CODE_COVERAGE=$code_coverage" \
+  "-DCLR_CMAKE_COMPILER=Clang" \
+  $cmake_extra_defines \
+  $__UnprocessedCMakeArgs \
+  "$1"
diff --git a/eng/gen-buildsys-win.bat b/eng/gen-buildsys-win.bat
new file mode 100644 (file)
index 0000000..a3df018
--- /dev/null
@@ -0,0 +1,60 @@
+@if not defined _echo @echo off
+rem
+rem This file invokes cmake and generates the build system for windows.
+
+set argC=0
+for %%x in (%*) do Set /A argC+=1
+
+if %argC% lss 3 GOTO :USAGE
+if %1=="/?" GOTO :USAGE
+
+setlocal
+set basePath=%~dp0
+:: remove quotes
+set "basePath=%basePath:"=%"
+:: remove trailing slash
+if %basePath:~-1%==\ set "basePath=%basePath:~0,-1%"
+
+set __SourceDir=%1
+set __VSVersion=%2
+set __Arch=%3
+set __CmakeGenerator=Visual Studio
+
+if /i "%__NMakeMakefiles%" == "1" (
+    set __CmakeGenerator=NMake Makefiles
+) else (
+    if /i "%__VSVersion%" == "vs2019" (set __CmakeGenerator=%__CmakeGenerator% 16 2019)
+    if /i "%__VSVersion%" == "vs2017" (set __CmakeGenerator=%__CmakeGenerator% 15 2017)
+
+    if /i "%__Arch%" == "x64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A x64)
+    if /i "%__Arch%" == "arm" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM)
+    if /i "%__Arch%" == "arm64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64)
+    if /i "%__Arch%" == "x86" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A Win32)
+)
+
+:loop
+if [%4] == [] goto end_loop
+set __ExtraCmakeParams=%__ExtraCmakeParams% %4
+shift
+goto loop
+:end_loop
+
+if defined CMakePath goto DoGen
+
+:: Eval the output from set-cmake-path.ps1
+for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& "%basePath%\set-cmake-path.ps1""') do %%a
+
+:DoGen
+"%CMakePath%" "-DCMAKE_USER_MAKE_RULES_OVERRIDE=%basePath%\windows-compiler-override.txt" "-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLR_CMAKE_HOST_ARCH=%__Arch%" %__ExtraCmakeParams% -G "%__CmakeGenerator%" %__SourceDir%
+endlocal
+GOTO :DONE
+
+:USAGE
+  echo "Usage..."
+  echo "gen-buildsys-win.bat <path to top level CMakeLists.txt> <VSVersion>"
+  echo "Specify the path to the top level CMake file - <ProjectK>/src/NDP"
+  echo "Specify the VSVersion to be used - VS2017 or VS2019"
+  EXIT /B 1
+
+:DONE
+  EXIT /B 0
diff --git a/eng/generateexportedsymbols.awk b/eng/generateexportedsymbols.awk
new file mode 100644 (file)
index 0000000..1d9b200
--- /dev/null
@@ -0,0 +1,11 @@
+{ 
+       # Remove the CR character in case the sources are mapped from
+       # a Windows share and contain CRLF line endings
+       gsub(/\r/,"", $0);
+
+       # Skip empty lines and comment lines starting with semicolon
+       if (NF && !match($0, /^[:space:]*;/))
+       {
+               print "_"  $0;
+       }
+} 
diff --git a/eng/generateversionscript.awk b/eng/generateversionscript.awk
new file mode 100644 (file)
index 0000000..226c6a5
--- /dev/null
@@ -0,0 +1,19 @@
+BEGIN {
+       print "V1.0 {";
+       print "    global:";
+} 
+{ 
+       # Remove the CR character in case the sources are mapped from
+       # a Windows share and contain CRLF line endings
+       gsub(/\r/,"", $0);
+       
+       # Skip empty lines and comment lines starting with semicolon
+       if (NF && !match($0, /^[ \t]*;/))
+       {
+               print "        "  $0 ";";
+       }
+} 
+END {
+       print "    local: *;"
+       print "};";
+}
diff --git a/eng/init-distro-rid.sh b/eng/init-distro-rid.sh
new file mode 100755 (executable)
index 0000000..bc38ed9
--- /dev/null
@@ -0,0 +1,176 @@
+#!/usr/bin/env bash
+
+# initNonPortableDistroRid
+#
+# Input:
+#   buildOs: (str)
+#   buildArch: (str)
+#   isPortable: (int)
+#   rootfsDir: (str)
+#
+# Return:
+#   None
+#
+# Notes:
+#
+# initNonPortableDistroRid will attempt to initialize a non portable rid. These
+# rids are specific to distros need to build the product/package and consume
+# them on the same platform.
+#
+# If -portablebuild=false is passed a non-portable rid will be created for any
+# distro.
+#
+# Below is the list of current non-portable platforms.
+#
+# Builds from the following *must* be non-portable:
+#
+#   |    OS     |           Expected RID            |
+#   -------------------------------------------------
+#   |   rhel6   |           rhel.6-x64              |
+#   |  alpine*  |        linux-musl-(arch)          |
+#   |  freeBSD  |        freebsd.(version)-x64      |
+#
+# It is important to note that the function does not return anything, but it 
+# will set __DistroRid if there is a non-portable distro rid to be used.
+#
+initNonPortableDistroRid()
+{
+    # Make sure out parameter is cleared.
+    __DistroRid=
+
+    local buildOs=$1
+    local buildArch=$2
+    local isPortable=$3
+    local rootfsDir=$4
+
+    if [ "$buildOs" = "Linux" ]; then
+        # RHEL 6 is the only distro we will check redHat release for.
+        if [ -e "${rootfsDir}/etc/os-release" ]; then
+            source "${rootfsDir}/etc/os-release"
+
+            # We have forced __PortableBuild=0. This is because -portablebuld
+            # has been passed as false.
+            if (( ${isPortable} == 0 )); then
+                if [ "${ID}" == "rhel" ]; then
+                    # remove the last version digit    
+                    VERSION_ID=${VERSION_ID%.*}
+                fi
+
+                nonPortableBuildID="${ID}.${VERSION_ID}-${buildArch}"
+            fi
+
+            if [ "${ID}" == "alpine" ]; then
+                export __Alpine=true
+            fi
+            
+        elif [ -e "${rootfsDir}/etc/redhat-release" ]; then
+            local redhatRelease=$(<${rootfsDir}/etc/redhat-release)
+
+            if [[ "${redhatRelease}" == "CentOS release 6."* || "$redhatRelease" == "Red Hat Enterprise Linux Server release 6."* ]]; then
+                nonPortableBuildID="rhel.6-${buildArch}"
+            fi
+        elif [ -e "${rootfsDir}/android_platform" ]; then
+            source $rootfsDir/android_platform
+            nonPortableBuildID="$RID"
+        fi
+    fi
+
+    if [ "$buildOs" = "FreeBSD" ]; then
+        __freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'.'`
+        nonPortableBuildID="freebsd.$__freebsd_version-${buildArch}"
+    fi
+
+    if [ "${nonPortableBuildID}" != "" ]; then
+        export __DistroRid=${nonPortableBuildID}
+
+        # We are using a non-portable build rid. Force __PortableBuild to false.
+        export __PortableBuild=0
+    fi
+}
+
+
+# initDistroRidGlobal
+#
+# Input:
+#   os: (str)
+#   arch: (str)
+#   isPortable: (int)
+#   rootfsDir?: (nullable:string)
+#
+# Return:
+#   None
+#
+# Notes:
+#
+# The following out parameters are returned
+#
+#   __DistroRid
+#   __PortableBuild
+#
+initDistroRidGlobal()
+{
+    # __DistroRid must be set at the end of the function.
+    # Previously we would create a variable __HostDistroRid and/or __DistroRid.
+    #
+    # __HostDistroRid was used in the case of a non-portable build, it has been
+    # deprecated. Now only __DistroRid is supported. It will be used for both
+    # portable and non-portable rids and will be used in build-packages.sh
+
+    local buildOs=$1
+    local buildArch=$2
+    local isPortable=$3
+    local rootfsDir=$4
+
+    # Setup whether this is a crossbuild. We can find this out if rootfsDir
+    # is set. 
+    local isCrossBuild=0
+
+    if [ -z "${rootfsDir}" ]; then
+        isCrossBuild=0
+    else
+        # We may have a cross build. Check for the existance of the rootfsDir
+        if [ -e ${rootfsDir} ]; then
+            isCrossBuild=1
+        else
+            echo "Error rootfsDir has been passed, but the location is not valid."
+            exit 1
+        fi
+    fi
+
+    initNonPortableDistroRid ${buildOs} ${buildArch} ${isPortable} ${rootfsDir}
+
+    if [ -z "${__DistroRid}" ]; then
+        # The non-portable build rid was not set. Set the portable rid.
+
+        export __PortableBuild=1
+        local distroRid=""
+
+        # Check for alpine. It is the only portable build that will will have
+        # its name in the portable build rid.
+        if [ -e "${rootfsDir}/etc/os-release" ]; then
+            source "${rootfsDir}/etc/os-release"
+            if [ "${ID}" = "alpine" ]; then
+                distroRid="linux-musl-${buildArch}"
+            fi
+        fi
+
+        if [ "${distroRid}" == "" ]; then
+            if [ "$buildOs" = "Linux" ]; then
+                distroRid="linux-$buildArch"
+            elif [ "$buildOs" = "OSX" ]; then
+                distroRid="osx-$buildArch"
+            elif [ "$buildOs" = "FreeBSD" ]; then
+                distroRid="freebsd-$buildArch"
+            fi
+        fi
+
+        export __DistroRid=${distroRid}
+    fi
+
+    if [ -z "$__DistroRid" ]; then
+        echo "DistroRid is not set. This is almost certainly an error"
+        exit 1
+    else
+        export __RuntimeId=${__DistroRid}
+    fi
+}
diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh
deleted file mode 100755 (executable)
index 608d06e..0000000
+++ /dev/null
@@ -1,464 +0,0 @@
-#!/usr/bin/env bash
-
-initTargetDistroRid()
-{
-    source "$__RepoRootDir/eng/native/init-distro-rid.sh"
-
-    local passedRootfsDir=""
-
-    # Only pass ROOTFS_DIR if cross is specified and the target platform is not Darwin that doesn't use rootfs
-    if [[ "$__CrossBuild" == 1 && "$platform" != "Darwin" ]]; then
-        passedRootfsDir="$ROOTFS_DIR"
-    fi
-
-    initDistroRidGlobal "$__TargetOS" "$__BuildArch" "$__PortableBuild" "$passedRootfsDir"
-}
-
-setup_dirs()
-{
-    echo Setting up directories for build
-
-    mkdir -p "$__RootBinDir"
-    mkdir -p "$__BinDir"
-    mkdir -p "$__IntermediatesDir"
-}
-
-# Check the system to ensure the right prereqs are in place
-check_prereqs()
-{
-    echo "Checking prerequisites..."
-
-    if [[ "$__HostOS" == "OSX" ]]; then
-        # Check presence of pkg-config on the path
-        command -v pkg-config 2>/dev/null || { echo >&2 "Please install pkg-config before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/macos-requirements.md"; exit 1; }
-
-        if ! pkg-config openssl ; then
-            # We export the proper PKG_CONFIG_PATH where openssl was installed by Homebrew
-            # It's important to _export_ it since build-commons.sh is sourced by other scripts such as build-native.sh
-            export PKG_CONFIG_PATH=$(brew --prefix)/opt/openssl@1.1/lib/pkgconfig:$(brew --prefix)/opt/openssl/lib/pkgconfig
-            # We try again with the PKG_CONFIG_PATH in place, if pkg-config still can't find OpenSSL, exit with an error, cmake won't find OpenSSL either
-            pkg-config openssl || { echo >&2 "Please install openssl before running this script, see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/macos-requirements.md"; exit 1; }
-        fi
-    fi
-
-    if [[ "$__UseNinja" == 1 ]]; then
-        command -v ninja 2>/dev/null || command -v ninja-build 2>/dev/null || { echo "Unable to locate ninja!"; exit 1; }
-    fi
-}
-
-build_native()
-{
-    if [[ ! -e "$__RepoRootDir/artifacts/obj/_version.c" ]]; then
-        eval "$__RepoRootDir/eng/native/version/copy_version_files.sh"
-    fi
-
-    targetOS="$1"
-    platformArch="$2"
-    cmakeDir="$3"
-    intermediatesDir="$4"
-    target="$5"
-    cmakeArgs="$6"
-    message="$7"
-
-    # All set to commence the build
-    echo "Commencing build of \"$target\" target in \"$message\" for $__TargetOS.$__BuildArch.$__BuildType in $intermediatesDir"
-
-    if [[ "$targetOS" == OSX || "$targetOS" == MacCatalyst ]]; then
-        if [[ "$platformArch" == x64 ]]; then
-            cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $cmakeArgs"
-        elif [[ "$platformArch" == arm64 ]]; then
-            cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $cmakeArgs"
-        else
-            echo "Error: Unknown OSX architecture $platformArch."
-            exit 1
-        fi
-    fi
-
-    if [[ "$targetOS" == MacCatalyst ]]; then
-        cmakeArgs="-DCMAKE_SYSTEM_VARIANT=MacCatalyst $cmakeArgs"
-    fi
-
-    if [[ "$targetOS" == Android && -z "$ROOTFS_DIR" ]]; then
-        if [[ -z "$ANDROID_NDK_ROOT" ]]; then
-            echo "Error: You need to set the ANDROID_NDK_ROOT environment variable pointing to the Android NDK root."
-            exit 1
-        fi
-
-        # keep ANDROID_NATIVE_API_LEVEL in sync with src/mono/Directory.Build.props
-        cmakeArgs="-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=21 $cmakeArgs"
-
-        # Don't try to set CC/CXX in init-compiler.sh - it's handled in android.toolchain.cmake already
-        __Compiler="default"
-
-        if [[ "$platformArch" == x64 ]]; then
-            cmakeArgs="-DANDROID_ABI=x86_64 $cmakeArgs"
-        elif [[ "$platformArch" == x86 ]]; then
-            cmakeArgs="-DANDROID_ABI=x86 $cmakeArgs"
-        elif [[ "$platformArch" == arm64 ]]; then
-            cmakeArgs="-DANDROID_ABI=arm64-v8a $cmakeArgs"
-        elif [[ "$platformArch" == arm ]]; then
-            cmakeArgs="-DANDROID_ABI=armeabi-v7a $cmakeArgs"
-        else
-            echo "Error: Unknown Android architecture $platformArch."
-            exit 1
-        fi
-    fi
-
-    if [[ "$__UseNinja" == 1 ]]; then
-        generator="ninja"
-        buildTool="$(command -v ninja || command -v ninja-build)"
-    else
-        buildTool="make"
-    fi
-
-    if [[ "$__SkipConfigure" == 0 ]]; then
-
-        if [[ "$__StaticAnalyzer" == 1 ]]; then
-            scan_build=scan-build
-        fi
-
-        nextCommand="\"$__RepoRootDir/eng/native/gen-buildsys.sh\" \"$cmakeDir\" \"$intermediatesDir\" $platformArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType \"$generator\" $scan_build $cmakeArgs"
-        echo "Invoking $nextCommand"
-        eval $nextCommand
-
-        local exit_code="$?"
-        if [[ "$exit_code" != 0  ]]; then
-            echo "${__ErrMsgPrefix}Failed to generate \"$message\" build project!"
-            exit "$exit_code"
-        fi
-    fi
-
-    # Check that the makefiles were created.
-    if [[ ! -f "$intermediatesDir/CMakeCache.txt" ]]; then
-        echo "${__ErrMsgPrefix}Unable to find generated build files for \"$message\" project!"
-        exit 1
-    fi
-
-    # Build
-    if [[ "$__ConfigureOnly" == 1 ]]; then
-        echo "Finish configuration & skipping \"$message\" build."
-        return
-    fi
-
-    SAVED_CFLAGS="${CFLAGS}"
-    SAVED_CXXFLAGS="${CXXFLAGS}"
-    SAVED_LDFLAGS="${LDFLAGS}"
-
-    # Let users provide additional compiler/linker flags via EXTRA_CFLAGS/EXTRA_CXXFLAGS/EXTRA_LDFLAGS.
-    # If users directly override CFLAG/CXXFLAGS/LDFLAGS, that may lead to some configure tests working incorrectly.
-    # See https://github.com/dotnet/runtime/issues/35727 for more information.
-    export CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
-    export CXXFLAGS="${CXXFLAGS} ${EXTRA_CXXFLAGS}"
-    export LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"
-
-    local exit_code
-    if [[ "$__StaticAnalyzer" == 1 ]]; then
-        pushd "$intermediatesDir"
-
-        buildTool="$SCAN_BUILD_COMMAND -o $__BinDir/scan-build-log $buildTool"
-        echo "Executing $buildTool $target -j $__NumProc"
-        "$buildTool" $target -j "$__NumProc"
-        exit_code="$?"
-
-        popd
-    else
-        cmake_command=cmake
-        if [[ "$build_arch" == "wasm" ]]; then
-            cmake_command="emcmake cmake"
-            echo "Executing $cmake_command --build \"$intermediatesDir\" --target $target -- -j $__NumProc"
-            $cmake_command --build "$intermediatesDir" --target $target -- -j "$__NumProc"
-            exit_code="$?"
-        else
-            # For non-wasm Unix scenarios, we may have to use an old version of CMake that doesn't support
-            # multiple targets. Instead, directly invoke the build tool to build multiple targets in one invocation.
-            pushd "$intermediatesDir"
-
-            echo "Executing $buildTool $target -j $__NumProc"
-            "$buildTool" $target -j "$__NumProc"
-            exit_code="$?"
-
-            popd
-        fi
-    fi
-
-    CFLAGS="${SAVED_CFLAGS}"
-    CXXFLAGS="${SAVED_CXXFLAGS}"
-    LDFLAGS="${SAVED_LDFLAGS}"
-
-    if [[ "$exit_code" != 0 ]]; then
-        echo "${__ErrMsgPrefix}Failed to build \"$message\"."
-        exit "$exit_code"
-    fi
-}
-
-usage()
-{
-    echo "Usage: $0 <options>"
-    echo ""
-    echo "Common Options:"
-    echo ""
-    echo "BuildArch can be: -arm, -armel, -arm64, -s390x, x64, x86, -wasm"
-    echo "BuildType can be: -debug, -checked, -release"
-    echo "-os: target OS (defaults to running OS)"
-    echo "-bindir: output directory (defaults to $__ProjectRoot/artifacts)"
-    echo "-ci: indicates if this is a CI build."
-    echo "-clang: optional argument to build using clang in PATH (default)."
-    echo "-clangx.y: optional argument to build using clang version x.y."
-    echo "-cmakeargs: user-settable additional arguments passed to CMake."
-    echo "-configureonly: do not perform any builds; just configure the build."
-    echo "-cross: optional argument to signify cross compilation,"
-    echo "        will use ROOTFS_DIR environment variable if set."
-    echo "-gcc: optional argument to build using gcc in PATH."
-    echo "-gccx.y: optional argument to build using gcc version x.y."
-    echo "-ninja: target ninja instead of GNU make"
-    echo "-numproc: set the number of build processes."
-    echo "-portablebuild: pass -portablebuild=false to force a non-portable build."
-    echo "-skipconfigure: skip build configuration."
-    echo "-keepnativesymbols: keep native/unmanaged debug symbols."
-    echo "-verbose: optional argument to enable verbose build output."
-    echo ""
-    echo "Additional Options:"
-    echo ""
-    for i in "${!usage_list[@]}"; do
-        echo "${usage_list[${i}]}"
-    done
-    echo ""
-    exit 1
-}
-
-source "$__RepoRootDir/eng/native/init-os-and-arch.sh"
-
-__BuildArch=$arch
-__HostArch=$arch
-__TargetOS=$os
-__HostOS=$os
-__BuildOS=$os
-
-# Get the number of processors available to the scheduler
-# Other techniques such as `nproc` only get the number of
-# processors available to a single process.
-platform="$(uname)"
-if [[ "$platform" == "FreeBSD" ]]; then
-  __NumProc=$(($(sysctl -n hw.ncpu)+1))
-elif [[ "$platform" == "NetBSD" || "$platform" == "SunOS" ]]; then
-  __NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
-elif [[ "$platform" == "Darwin" ]]; then
-  __NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
-else
-  if command -v nproc > /dev/null 2>&1; then
-    __NumProc=$(nproc --all)
-  elif (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
-    __NumProc=$(getconf _NPROCESSORS_ONLN)
-  else
-    __NumProc=1
-  fi
-fi
-
-while :; do
-    if [[ "$#" -le 0 ]]; then
-        break
-    fi
-
-    lowerI="$(echo "${1/--/-}" | tr "[:upper:]" "[:lower:]")"
-    case "$lowerI" in
-        -\?|-h|--help)
-            usage
-            exit 1
-            ;;
-
-        arm|-arm)
-            __BuildArch=arm
-            ;;
-
-        arm64|-arm64)
-            __BuildArch=arm64
-            ;;
-
-        armel|-armel)
-            __BuildArch=armel
-            ;;
-
-        bindir|-bindir)
-            if [[ -n "$2" ]]; then
-                __RootBinDir="$2"
-                if [[ ! -d "$__RootBinDir" ]]; then
-                    mkdir "$__RootBinDir"
-                fi
-                __RootBinParent=$(dirname "$__RootBinDir")
-                __RootBinName="${__RootBinDir##*/}"
-                __RootBinDir="$(cd "$__RootBinParent" &>/dev/null && printf %s/%s "$PWD" "$__RootBinName")"
-                shift
-            else
-                echo "ERROR: 'bindir' requires a non-empty option argument"
-                exit 1
-            fi
-            ;;
-
-        checked|-checked)
-            __BuildType=Checked
-            ;;
-
-        ci|-ci)
-            __ArcadeScriptArgs="--ci"
-            __ErrMsgPrefix="##vso[task.logissue type=error]"
-            ;;
-
-        clang*|-clang*)
-                __Compiler=clang
-                # clangx.y or clang-x.y
-                version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
-                parts=(${version//./ })
-                __CompilerMajorVersion="${parts[0]}"
-                __CompilerMinorVersion="${parts[1]}"
-                if [[ -z "$__CompilerMinorVersion" && "$__CompilerMajorVersion" -le 6 ]]; then
-                    __CompilerMinorVersion=0;
-                fi
-            ;;
-
-        cmakeargs|-cmakeargs)
-            if [[ -n "$2" ]]; then
-                __CMakeArgs="$2 $__CMakeArgs"
-                shift
-            else
-                echo "ERROR: 'cmakeargs' requires a non-empty option argument"
-                exit 1
-            fi
-            ;;
-
-        configureonly|-configureonly)
-            __ConfigureOnly=1
-            __SkipMSCorLib=1
-            __SkipNuget=1
-            ;;
-
-        cross|-cross)
-            __CrossBuild=1
-            ;;
-
-        debug|-debug)
-            __BuildType=Debug
-            ;;
-
-        gcc*|-gcc*)
-                __Compiler=gcc
-                # gccx.y or gcc-x.y
-                version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
-                parts=(${version//./ })
-                __CompilerMajorVersion="${parts[0]}"
-                __CompilerMinorVersion="${parts[1]}"
-            ;;
-
-        keepnativesymbols|-keepnativesymbols)
-            __CMakeArgs="$__CMakeArgs -DCLR_CMAKE_KEEP_NATIVE_SYMBOLS=true"
-            ;;
-
-        ninja|-ninja)
-            __UseNinja=1
-            ;;
-
-        numproc|-numproc)
-            if [[ -n "$2" ]]; then
-              __NumProc="$2"
-              shift
-            else
-              echo "ERROR: 'numproc' requires a non-empty option argument"
-              exit 1
-            fi
-            ;;
-
-        portablebuild=false|-portablebuild=false)
-            __PortableBuild=0
-            ;;
-
-        release|-release)
-            __BuildType=Release
-            ;;
-
-        skipconfigure|-skipconfigure)
-            __SkipConfigure=1
-            ;;
-
-        verbose|-verbose)
-            __VerboseBuild=1
-            ;;
-
-        x86|-x86)
-            __BuildArch=x86
-            ;;
-
-        x64|-x64)
-            __BuildArch=x64
-            ;;
-
-        s390x|-s390x)
-            __BuildArch=s390x
-            ;;
-
-        wasm|-wasm)
-            __BuildArch=wasm
-            ;;
-
-        os|-os)
-            if [[ -n "$2" ]]; then
-                __TargetOS="$2"
-                shift
-            else
-                echo "ERROR: 'os' requires a non-empty option argument"
-                exit 1
-            fi
-            ;;
-
-        *)
-            handle_arguments "$1" "$2"
-            if [[ "$__ShiftArgs" == 1 ]]; then
-                shift
-                __ShiftArgs=0
-            fi
-            ;;
-    esac
-
-    shift
-done
-
-__CommonMSBuildArgs="/p:TargetArchitecture=$__BuildArch /p:Configuration=$__BuildType /p:TargetOS=$__TargetOS /nodeReuse:false $__OfficialBuildIdArg $__SignTypeArg $__SkipRestoreArg"
-
-# Configure environment if we are doing a verbose build
-if [[ "$__VerboseBuild" == 1 ]]; then
-    VERBOSE=1
-    export VERBOSE
-    __CommonMSBuildArgs="$__CommonMSBuildArgs /v:detailed"
-fi
-
-if [[ "$__PortableBuild" == 0 ]]; then
-    __CommonMSBuildArgs="$__CommonMSBuildArgs /p:PortableBuild=false"
-fi
-
-if [[ "$__BuildArch" == wasm ]]; then
-    # nothing to do here
-    true
-elif [[ "$__TargetOS" == iOS || "$__TargetOS" == iOSSimulator ]]; then
-    # nothing to do here
-    true
-elif [[ "$__TargetOS" == tvOS || "$__TargetOS" == tvOSSimulator ]]; then
-    # nothing to do here
-    true
-elif [[ "$__TargetOS" == Android ]]; then
-    # nothing to do here
-    true
-else
-    __CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"
-fi
-
-# Configure environment if we are doing a cross compile.
-if [[ "$__CrossBuild" == 1 ]]; then
-    CROSSCOMPILE=1
-    export CROSSCOMPILE
-    # Darwin that doesn't use rootfs
-    if [[ ! -n "$ROOTFS_DIR" && "$platform" != "Darwin" ]]; then
-        ROOTFS_DIR="$__RepoRootDir/.tools/rootfs/$__BuildArch"
-        export ROOTFS_DIR
-    fi
-fi
-
-# init the target distro name
-initTargetDistroRid
diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
deleted file mode 100644 (file)
index a298574..0000000
+++ /dev/null
@@ -1,701 +0,0 @@
-include(${CMAKE_CURRENT_LIST_DIR}/configuretools.cmake)
-
-# Set initial flags for each configuration
-
-set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
-set(CMAKE_C_STANDARD 11)
-set(CMAKE_C_STANDARD_REQUIRED ON)
-set(CMAKE_CXX_STANDARD 11)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
-include(CheckCCompilerFlag)
-include(CheckCXXCompilerFlag)
-
-# "configureoptimization.cmake" must be included after CLR_CMAKE_HOST_UNIX has been set.
-include(${CMAKE_CURRENT_LIST_DIR}/configureoptimization.cmake)
-
-#-----------------------------------------------------
-# Initialize Cmake compiler flags and other variables
-#-----------------------------------------------------
-
-if (CLR_CMAKE_HOST_UNIX)
-    add_compile_options(-g)
-    add_compile_options(-Wall)
-    if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-        add_compile_options(-Wno-null-conversion)
-    else()
-        add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Werror=conversion-null>)
-    endif()
-endif()
-
-if (CMAKE_CONFIGURATION_TYPES) # multi-configuration generator?
-    set(CMAKE_CONFIGURATION_TYPES "Debug;Checked;Release;RelWithDebInfo" CACHE STRING "" FORCE)
-endif (CMAKE_CONFIGURATION_TYPES)
-
-set(CMAKE_C_FLAGS_CHECKED "")
-set(CMAKE_CXX_FLAGS_CHECKED "")
-set(CMAKE_EXE_LINKER_FLAGS_CHECKED "")
-set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "")
-
-set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "")
-set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "")
-set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "")
-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "")
-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "")
-set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "")
-
-add_compile_definitions("$<$<CONFIG:DEBUG>:DEBUG;_DEBUG;_DBG;URTBLDENV_FRIENDLY=Debug;BUILDENV_DEBUG=1>")
-add_compile_definitions("$<$<CONFIG:CHECKED>:DEBUG;_DEBUG;_DBG;URTBLDENV_FRIENDLY=Checked;BUILDENV_CHECKED=1>")
-add_compile_definitions("$<$<OR:$<CONFIG:RELEASE>,$<CONFIG:RELWITHDEBINFO>>:NDEBUG;URTBLDENV_FRIENDLY=Retail>")
-
-if (MSVC)
-  add_linker_flag(/guard:cf)
-
-  # Linker flags
-  #
-  set (WINDOWS_SUBSYSTEM_VERSION 6.01)
-
-  if (CLR_CMAKE_HOST_ARCH_ARM)
-    set(WINDOWS_SUBSYSTEM_VERSION 6.02) #windows subsystem - arm minimum is 6.02
-  elseif(CLR_CMAKE_HOST_ARCH_ARM64)
-    set(WINDOWS_SUBSYSTEM_VERSION 6.03) #windows subsystem - arm64 minimum is 6.03
-  endif ()
-
-  #Do not create Side-by-Side Assembly Manifest
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO")
-  # can handle addresses larger than 2 gigabytes
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
-  #shrink pdb size
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /PDBCOMPRESS")
-
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG")
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4197,4013,4254,4070,4221")
-  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,${WINDOWS_SUBSYSTEM_VERSION}")
-
-  set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221")
-
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG")
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /PDBCOMPRESS")
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1572864")
-
-  # Checked build specific flags
-  add_linker_flag(/INCREMENTAL:NO CHECKED) # prevent "warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:REF' specification"
-  add_linker_flag(/OPT:REF CHECKED)
-  add_linker_flag(/OPT:NOICF CHECKED)
-
-  # Release build specific flags
-  add_linker_flag(/LTCG RELEASE)
-  add_linker_flag(/OPT:REF RELEASE)
-  add_linker_flag(/OPT:ICF RELEASE)
-  add_linker_flag(/INCREMENTAL:NO RELEASE)
-  set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG")
-
-  # ReleaseWithDebugInfo build specific flags
-  add_linker_flag(/LTCG RELWITHDEBINFO)
-  add_linker_flag(/OPT:REF RELWITHDEBINFO)
-  add_linker_flag(/OPT:ICF RELWITHDEBINFO)
-  set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /LTCG")
-
-  # Force uCRT to be dynamically linked for Release build
-  add_linker_flag(/NODEFAULTLIB:libucrt.lib RELEASE)
-  add_linker_flag(/DEFAULTLIB:ucrt.lib RELEASE)
-
-elseif (CLR_CMAKE_HOST_UNIX)
-  # Set the values to display when interactively configuring CMAKE_BUILD_TYPE
-  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "DEBUG;CHECKED;RELEASE;RELWITHDEBINFO")
-
-  # Use uppercase CMAKE_BUILD_TYPE for the string comparisons below
-  string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE)
-
-  set(CLR_SANITIZE_CXX_OPTIONS "")
-  set(CLR_SANITIZE_LINK_OPTIONS "")
-
-  # set the CLANG sanitizer flags for debug build
-  if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
-    # obtain settings from running enablesanitizers.sh
-    string(FIND "$ENV{DEBUG_SANITIZERS}" "asan" __ASAN_POS)
-    string(FIND "$ENV{DEBUG_SANITIZERS}" "ubsan" __UBSAN_POS)
-    if ((${__ASAN_POS} GREATER -1) OR (${__UBSAN_POS} GREATER -1))
-      list(APPEND CLR_SANITIZE_CXX_OPTIONS -fsanitize-blacklist=${CMAKE_CURRENT_SOURCE_DIR}/sanitizerblacklist.txt)
-      set (CLR_CXX_SANITIZERS "")
-      set (CLR_LINK_SANITIZERS "")
-      if (${__ASAN_POS} GREATER -1)
-        list(APPEND CLR_CXX_SANITIZERS address)
-        list(APPEND CLR_LINK_SANITIZERS address)
-        set(CLR_SANITIZE_CXX_FLAGS "${CLR_SANITIZE_CXX_FLAGS}address,")
-        set(CLR_SANITIZE_LINK_FLAGS "${CLR_SANITIZE_LINK_FLAGS}address,")
-        add_definitions(-DHAS_ASAN)
-        message("Address Sanitizer (asan) enabled")
-      endif ()
-      if (${__UBSAN_POS} GREATER -1)
-        # all sanitizier flags are enabled except alignment (due to heavy use of __unaligned modifier)
-        list(APPEND CLR_CXX_SANITIZERS
-          "bool"
-          bounds
-          enum
-          float-cast-overflow
-          float-divide-by-zero
-          "function"
-          integer
-          nonnull-attribute
-          null
-          object-size
-          "return"
-          returns-nonnull-attribute
-          shift
-          unreachable
-          vla-bound
-          vptr)
-        list(APPEND CLR_LINK_SANITIZERS
-          undefined)
-        message("Undefined Behavior Sanitizer (ubsan) enabled")
-      endif ()
-      list(JOIN CLR_CXX_SANITIZERS "," CLR_CXX_SANITIZERS_OPTIONS)
-      list(APPEND CLR_SANITIZE_CXX_OPTIONS "-fsanitize=${CLR_CXX_SANITIZERS_OPTIONS}")
-      list(JOIN CLR_LINK_SANITIZERS "," CLR_LINK_SANITIZERS_OPTIONS)
-      list(APPEND CLR_SANITIZE_LINK_OPTIONS "-fsanitize=${CLR_LINK_SANITIZERS_OPTIONS}")
-
-      # -fdata-sections -ffunction-sections: each function has own section instead of one per .o file (needed for --gc-sections)
-      # -O1: optimization level used instead of -O0 to avoid compile error "invalid operand for inline asm constraint"
-      add_compile_options("$<$<OR:$<CONFIG:DEBUG>,$<CONFIG:CHECKED>>:${CLR_SANITIZE_CXX_OPTIONS};-fdata-sections;--ffunction-sections;-O1>")
-      add_linker_flag("${CLR_SANITIZE_LINK_OPTIONS}" DEBUG CHECKED)
-      # -Wl and --gc-sections: drop unused sections\functions (similar to Windows /Gy function-level-linking)
-      add_linker_flag("-Wl,--gc-sections" DEBUG CHECKED)
-    endif ()
-  endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
-
-  if(CLR_CMAKE_HOST_BROWSER)
-    # The emscripten build has additional warnings so -Werror breaks
-    add_compile_options(-Wno-unused-parameter)
-    add_compile_options(-Wno-alloca)
-    add_compile_options(-Wno-implicit-int-float-conversion)
-  endif()
-endif(MSVC)
-
-# CLR_ADDITIONAL_LINKER_FLAGS - used for passing additional arguments to linker
-# CLR_ADDITIONAL_COMPILER_OPTIONS - used for passing additional arguments to compiler
-#
-# For example:
-#       ./build-native.sh cmakeargs "-DCLR_ADDITIONAL_COMPILER_OPTIONS=<...>" cmakeargs "-DCLR_ADDITIONAL_LINKER_FLAGS=<...>"
-#
-if(CLR_CMAKE_HOST_UNIX)
-  foreach(ADDTL_LINKER_FLAG ${CLR_ADDITIONAL_LINKER_FLAGS})
-    add_linker_flag(${ADDTL_LINKER_FLAG})
-  endforeach()
-endif(CLR_CMAKE_HOST_UNIX)
-
-if(CLR_CMAKE_HOST_LINUX)
-  add_compile_options($<$<COMPILE_LANGUAGE:ASM>:-Wa,--noexecstack>)
-  add_linker_flag(-Wl,--build-id=sha1)
-  add_linker_flag(-Wl,-z,relro,-z,now)
-elseif(CLR_CMAKE_HOST_FREEBSD)
-  add_compile_options($<$<COMPILE_LANGUAGE:ASM>:-Wa,--noexecstack>)
-  add_linker_flag("-Wl,--build-id=sha1")
-elseif(CLR_CMAKE_HOST_SUNOS)
-  add_compile_options($<$<COMPILE_LANGUAGE:ASM>:-Wa,--noexecstack>)
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
-  add_definitions(-D__EXTENSIONS__ -D_XPG4_2 -D_POSIX_PTHREAD_SEMANTICS)
-elseif(CLR_CMAKE_HOST_OSX AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
-  add_definitions(-D_XOPEN_SOURCE)
-  add_linker_flag("-Wl,-bind_at_load")
-endif()
-
-#------------------------------------
-# Definitions (for platform)
-#-----------------------------------
-if (CLR_CMAKE_HOST_ARCH_AMD64)
-  set(ARCH_HOST_NAME x64)
-  add_definitions(-DHOST_AMD64 -DHOST_64BIT)
-elseif (CLR_CMAKE_HOST_ARCH_I386)
-  set(ARCH_HOST_NAME x86)
-  add_definitions(-DHOST_X86)
-elseif (CLR_CMAKE_HOST_ARCH_ARM)
-  set(ARCH_HOST_NAME arm)
-  add_definitions(-DHOST_ARM)
-elseif (CLR_CMAKE_HOST_ARCH_ARM64)
-  set(ARCH_HOST_NAME arm64)
-  add_definitions(-DHOST_ARM64 -DHOST_64BIT)
-elseif (CLR_CMAKE_HOST_ARCH_S390X)
-  set(ARCH_HOST_NAME s390x)
-  add_definitions(-DHOST_S390X -DHOST_64BIT -DBIGENDIAN)
-elseif (CLR_CMAKE_HOST_ARCH_WASM)
-  set(ARCH_HOST_NAME wasm)
-  add_definitions(-DHOST_WASM -DHOST_32BIT=1)
-elseif (CLR_CMAKE_HOST_ARCH_MIPS64)
-  set(ARCH_HOST_NAME mips64)
-  add_definitions(-DHOST_MIPS64 -DHOST_64BIT=1)
-else ()
-  clr_unknown_arch()
-endif ()
-
-if (CLR_CMAKE_HOST_UNIX)
-  if(CLR_CMAKE_HOST_LINUX)
-    if(CLR_CMAKE_HOST_UNIX_AMD64)
-      message("Detected Linux x86_64")
-    elseif(CLR_CMAKE_HOST_UNIX_ARM)
-      message("Detected Linux ARM")
-    elseif(CLR_CMAKE_HOST_UNIX_ARM64)
-      message("Detected Linux ARM64")
-    elseif(CLR_CMAKE_HOST_UNIX_X86)
-      message("Detected Linux i686")
-    elseif(CLR_CMAKE_HOST_UNIX_S390X)
-      message("Detected Linux s390x")
-    else()
-      clr_unknown_arch()
-    endif()
-  endif(CLR_CMAKE_HOST_LINUX)
-endif(CLR_CMAKE_HOST_UNIX)
-
-if (CLR_CMAKE_HOST_UNIX)
-  add_definitions(-DHOST_UNIX)
-
-  if(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_MACCATALYST)
-    add_definitions(-DHOST_OSX)
-    if(CLR_CMAKE_HOST_UNIX_AMD64)
-      message("Detected OSX x86_64")
-    elseif(CLR_CMAKE_HOST_UNIX_ARM64)
-      message("Detected OSX ARM64")
-    else()
-      clr_unknown_arch()
-    endif()
-  elseif(CLR_CMAKE_HOST_FREEBSD)
-    message("Detected FreeBSD amd64")
-  elseif(CLR_CMAKE_HOST_NETBSD)
-    message("Detected NetBSD amd64")
-  elseif(CLR_CMAKE_HOST_SUNOS)
-    message("Detected SunOS amd64")
-  endif(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_MACCATALYST)
-endif(CLR_CMAKE_HOST_UNIX)
-
-if (CLR_CMAKE_HOST_WIN32)
-  add_definitions(-DHOST_WINDOWS)
-
-  # Define the CRT lib references that link into Desktop imports
-  set(STATIC_MT_CRT_LIB  "libcmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
-  set(STATIC_MT_VCRT_LIB  "libvcruntime$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
-  set(STATIC_MT_CPP_LIB  "libcpmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib")
-endif(CLR_CMAKE_HOST_WIN32)
-
-# Unconditionally define _FILE_OFFSET_BITS as 64 on all platforms.
-add_definitions(-D_FILE_OFFSET_BITS=64)
-
-# Architecture specific files folder name
-if (CLR_CMAKE_TARGET_ARCH_AMD64)
-    set(ARCH_SOURCES_DIR amd64)
-    set(ARCH_TARGET_NAME x64)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_AMD64>)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_64BIT>)
-elseif (CLR_CMAKE_TARGET_ARCH_ARM64)
-    set(ARCH_SOURCES_DIR arm64)
-    set(ARCH_TARGET_NAME arm64)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_ARM64>)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_64BIT>)
-elseif (CLR_CMAKE_TARGET_ARCH_ARM)
-    set(ARCH_SOURCES_DIR arm)
-    set(ARCH_TARGET_NAME arm)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_ARM>)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_32BIT>)
-elseif (CLR_CMAKE_TARGET_ARCH_I386)
-    set(ARCH_TARGET_NAME x86)
-    set(ARCH_SOURCES_DIR i386)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_X86>)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_32BIT>)
-elseif (CLR_CMAKE_TARGET_ARCH_S390X)
-    set(ARCH_TARGET_NAME s390x)
-    set(ARCH_SOURCES_DIR s390x)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_S390X>)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_64BIT>)
-elseif (CLR_CMAKE_TARGET_ARCH_WASM)
-    set(ARCH_TARGET_NAME wasm)
-    set(ARCH_SOURCES_DIR wasm)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_WASM>)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_32BIT>)
-elseif (CLR_CMAKE_TARGET_ARCH_MIPS64)
-    set(ARCH_TARGET_NAME mips64)
-    set(ARCH_SOURCES_DIR mips64)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_MIPS64>)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_64BIT>)
-else ()
-    clr_unknown_arch()
-endif ()
-
-#--------------------------------------
-# Compile Options
-#--------------------------------------
-if (CLR_CMAKE_HOST_UNIX)
-  # Disable frame pointer optimizations so profilers can get better call stacks
-  add_compile_options(-fno-omit-frame-pointer)
-
-  # The -fms-extensions enable the stuff like __if_exists, __declspec(uuid()), etc.
-  add_compile_options(-fms-extensions)
-  #-fms-compatibility      Enable full Microsoft Visual C++ compatibility
-  #-fms-extensions         Accept some non-standard constructs supported by the Microsoft compiler
-
-  # Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
-  # using twos-complement representation (this is normally undefined according to the C++ spec).
-  add_compile_options(-fwrapv)
-
-  if(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_MACCATALYST)
-    # We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2)
-    add_compile_options(-fstack-protector)
-  elseif(NOT CLR_CMAKE_HOST_BROWSER)
-    check_c_compiler_flag(-fstack-protector-strong COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
-    if (COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
-      add_compile_options(-fstack-protector-strong)
-    endif()
-  endif(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_MACCATALYST)
-
-  # Suppress warnings-as-errors in release branches to reduce servicing churn
-  if (PRERELEASE)
-    add_compile_options(-Werror)
-  endif(PRERELEASE)
-
-  # Disabled common warnings
-  add_compile_options(-Wno-unused-variable)
-  add_compile_options(-Wno-unused-value)
-  add_compile_options(-Wno-unused-function)
-  add_compile_options(-Wno-tautological-compare)
-  add_compile_options(-Wno-unknown-pragmas)
-
-  # Explicitly enabled warnings
-  check_c_compiler_flag(-Wimplicit-fallthrough COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH)
-  if (COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH)
-    add_compile_options(-Wimplicit-fallthrough)
-  endif()
-
-  #These seem to indicate real issues
-  add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>)
-
-  add_compile_options(-Wno-unused-but-set-variable)
-
-  if (CMAKE_C_COMPILER_ID MATCHES "Clang")
-    add_compile_options(-Wno-unknown-warning-option)
-
-    # The -ferror-limit is helpful during the porting, it makes sure the compiler doesn't stop
-    # after hitting just about 20 errors.
-    add_compile_options(-ferror-limit=4096)
-
-    # Disabled warnings
-    add_compile_options(-Wno-unused-private-field)
-    # There are constants of type BOOL used in a condition. But BOOL is defined as int
-    # and so the compiler thinks that there is a mistake.
-    add_compile_options(-Wno-constant-logical-operand)
-    # We use pshpack1/2/4/8.h and poppack.h headers to set and restore packing. However
-    # clang 6.0 complains when the packing change lifetime is not contained within
-    # a header file.
-    add_compile_options(-Wno-pragma-pack)
-
-    # The following warning indicates that an attribute __attribute__((__ms_struct__)) was applied
-    # to a struct or a class that has virtual members or a base class. In that case, clang
-    # may not generate the same object layout as MSVC.
-    add_compile_options(-Wno-incompatible-ms-struct)
-
-    add_compile_options(-Wno-reserved-identifier)
-  else()
-    add_compile_options(-Wno-uninitialized)
-    add_compile_options(-Wno-strict-aliasing)
-    add_compile_options(-Wno-array-bounds)
-    add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-class-memaccess>)
-    add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-misleading-indentation>)
-    add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-stringop-overflow>)
-    add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-stringop-truncation>)
-    add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-placement-new>)
-
-    if (CMAKE_CXX_COMPILER_ID)
-      check_cxx_compiler_flag(-faligned-new COMPILER_SUPPORTS_F_ALIGNED_NEW)
-      if (COMPILER_SUPPORTS_F_ALIGNED_NEW)
-        add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-faligned-new>)
-      endif()
-    endif()
-  endif()
-
-  # Some architectures (e.g., ARM) assume char type is unsigned while CoreCLR assumes char is signed
-  # as x64 does. It has been causing issues in ARM (https://github.com/dotnet/runtime/issues/5778)
-  add_compile_options(-fsigned-char)
-
-  # We mark the function which needs exporting with DLLEXPORT
-  add_compile_options(-fvisibility=hidden)
-
-  # Specify the minimum supported version of macOS
-  # Mac Catalyst needs a special CFLAG, exclusive with mmacosx-version-min
-  if(CLR_CMAKE_HOST_MACCATALYST)
-    # Somewhere between CMake 3.17 and 3.19.4, it became impossible to not pass
-    # a value for mmacosx-version-min (blank CMAKE_OSX_DEPLOYMENT_TARGET gets
-    # replaced with a default value, and always gets expanded to an OS version.
-    # https://gitlab.kitware.com/cmake/cmake/-/issues/20132
-    # We need to disable the warning that -tagret replaces -mmacosx-version-min
-    set(DISABLE_OVERRIDING_MIN_VERSION_ERROR -Wno-overriding-t-option)
-    add_link_options(-Wno-overriding-t-option)
-    if(CLR_CMAKE_HOST_ARCH_ARM64)
-      set(MACOS_VERSION_MIN_FLAGS "-target arm64-apple-ios14.2-macabi")
-      add_link_options(-target arm64-apple-ios14.2-macabi)
-    elseif(CLR_CMAKE_HOST_ARCH_AMD64)
-      set(MACOS_VERSION_MIN_FLAGS "-target x86_64-apple-ios13.5-macabi")
-      add_link_options(-target x86_64-apple-ios13.5-macabi)
-    else()
-      clr_unknown_arch()
-    endif()
-    # These options are intentionally set using the CMAKE_XXX_FLAGS instead of
-    # add_compile_options so that they take effect on the configuration functions
-    # in various configure.cmake files.
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MACOS_VERSION_MIN_FLAGS} ${DISABLE_OVERRIDING_MIN_VERSION_ERROR}")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MACOS_VERSION_MIN_FLAGS} ${DISABLE_OVERRIDING_MIN_VERSION_ERROR}")
-    set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${MACOS_VERSION_MIN_FLAGS} ${DISABLE_OVERRIDING_MIN_VERSION_ERROR}")
-  elseif(CLR_CMAKE_HOST_OSX)
-    if(CLR_CMAKE_HOST_ARCH_ARM64)
-      set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
-      add_compile_options(-arch arm64)
-    elseif(CLR_CMAKE_HOST_ARCH_AMD64)
-      set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
-      add_compile_options(-arch x86_64)
-    else()
-      clr_unknown_arch()
-    endif()
-  endif(CLR_CMAKE_HOST_MACCATALYST)
-
-endif(CLR_CMAKE_HOST_UNIX)
-
-if(CLR_CMAKE_TARGET_UNIX)
-  add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_UNIX>)
-  # Contracts are disabled on UNIX.
-  add_definitions(-DDISABLE_CONTRACTS)
-  if(CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_OSX>)
-  elseif(CLR_CMAKE_TARGET_FREEBSD)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_FREEBSD>)
-  elseif(CLR_CMAKE_TARGET_ANDROID)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_ANDROID>)
-  elseif(CLR_CMAKE_TARGET_LINUX)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_LINUX>)
-  elseif(CLR_CMAKE_TARGET_NETBSD)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_NETBSD>)
-  elseif(CLR_CMAKE_TARGET_SUNOS)
-    add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_SUNOS>)
-  endif()
-else(CLR_CMAKE_TARGET_UNIX)
-  add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_OS>>>:TARGET_WINDOWS>)
-endif(CLR_CMAKE_TARGET_UNIX)
-
-if(CLR_CMAKE_HOST_UNIX_ARM)
-   if (NOT DEFINED CLR_ARM_FPU_TYPE)
-     set(CLR_ARM_FPU_TYPE vfpv3)
-   endif(NOT DEFINED CLR_ARM_FPU_TYPE)
-
-   # Because we don't use CMAKE_C_COMPILER/CMAKE_CXX_COMPILER to use clang
-   # we have to set the triple by adding a compiler argument
-   add_compile_options(-mthumb)
-   add_compile_options(-mfpu=${CLR_ARM_FPU_TYPE})
-   if (NOT DEFINED CLR_ARM_FPU_CAPABILITY)
-     set(CLR_ARM_FPU_CAPABILITY 0x7)
-   endif(NOT DEFINED CLR_ARM_FPU_CAPABILITY)
-   add_definitions(-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY})
-   add_compile_options(-march=armv7-a)
-   if(ARM_SOFTFP)
-     add_definitions(-DARM_SOFTFP)
-     add_compile_options(-mfloat-abi=softfp)
-   endif(ARM_SOFTFP)
-endif(CLR_CMAKE_HOST_UNIX_ARM)
-
-if(CLR_CMAKE_HOST_UNIX_X86)
-  add_compile_options(-msse2)
-endif()
-
-if(CLR_CMAKE_HOST_UNIX)
-  add_compile_options(${CLR_ADDITIONAL_COMPILER_OPTIONS})
-endif(CLR_CMAKE_HOST_UNIX)
-
-if (MSVC)
-  # Compile options for targeting windows
-
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/nologo>) # Suppress Startup Banner
-  # /W3 is added by default by CMake, so remove it
-  string(REPLACE "/W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-  string(REPLACE "/W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
-  # set default warning level to 3 but allow targets to override it.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W$<GENEX_EVAL:$<IF:$<BOOL:$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>>,$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>,3>>>)
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/WX>) # treat warnings as errors
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oi>) # enable intrinsics
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oy->) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Gm->) # disable minimal rebuild
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Zp8>) # pack structs on 8-byte boundary
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Gy>) # separate functions for linker
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/GS>) # Explicitly enable the buffer security checks
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/fp:precise>) # Enable precise floating point
-
-  # disable C++ RTTI
-  # /GR is added by default by CMake, so remove it manually.
-  string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
-
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/FC>) # use full pathnames in diagnostics
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/MP>) # Build with Multiple Processes (number of processes equal to the number of processors)
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Zm200>) # Specify Precompiled Header Memory Allocation Limit of 150MB
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Zc:strictStrings>) # Disable string-literal to char* or wchar_t* conversion
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Zc:wchar_t>) # wchar_t is a built-in type.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Zc:inline>) # All inline functions must have their definition available in the current translation unit.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Zc:forScope>) # Enforce standards-compliant for scope.
-
-  # Disable Warnings:
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4065>) # switch statement contains 'default' but no 'case' labels
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4100>) # 'identifier' : unreferenced formal parameter
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4127>) # conditional expression is constant
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4189>) # local variable is initialized but not referenced
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4200>) # nonstandard extension used : zero-sized array in struct/union
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4201>) # nonstandard extension used : nameless struct/union
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4245>) # conversion from 'type1' to 'type2', signed/unsigned mismatch
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4291>) # no matching operator delete found; memory will not be freed if initialization throws an exception
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4456>) # declaration of 'identifier' hides previous local declaration
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4457>) # declaration of 'identifier' hides function parameter
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4458>) # declaration of 'identifier' hides class member
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4733>) # Inline asm assigning to 'FS:0' : handler not registered as safe handler
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4838>) # conversion from 'type_1' to 'type_2' requires a narrowing conversion
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4960>) # 'function' is too big to be profiled
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4961>) # No profile data was merged into '.pgd file', profile-guided optimizations disabled
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd5105>) # macro expansion producing 'defined' has undefined behavior
-
-  # Treat Warnings as Errors:
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4007>) # 'main' : must be __cdecl.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4013>) # 'function' undefined - assuming extern returning int.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4102>) # "'%$S' : unreferenced label".
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4551>) # Function call missing argument list.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4700>) # Local used w/o being initialized.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4640>) # 'instance' : construction of local static object is not thread-safe
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4806>) # Unsafe operation involving type 'bool'.
-
-  # Set Warning Level 3:
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/w34092>) # Sizeof returns 'unsigned long'.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/w34121>) # Structure is sensitive to alignment.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/w34125>) # Decimal digit in octal sequence.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/w34130>) # Logical operation on address of string constant.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/w34132>) # Const object should be initialized.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/w34212>) # Function declaration used ellipsis.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/w34530>) # C++ exception handler used, but unwind semantics are not enabled. Specify -GX.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/w35038>) # data member 'member1' will be initialized after data member 'member2'.
-
-  # Set Warning Level 4:
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/w44177>) # Pragma data_seg s/b at global scope.
-
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Zi>) # enable debugging information
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/ZH:SHA_256>) # use SHA256 for generating hashes of compiler processed source files.
-  add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/source-charset:utf-8>) # Force MSVC to compile source as UTF-8.
-
-  if (CLR_CMAKE_HOST_ARCH_I386)
-    add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Gz>)
-  endif (CLR_CMAKE_HOST_ARCH_I386)
-
-  add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>>:/GL>)
-
-  if (CLR_CMAKE_HOST_ARCH_AMD64)
-    # The generator expression in the following command means that the /homeparams option is added only for debug builds for C and C++ source files
-    add_compile_options($<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:C,CXX>>:/homeparams>) # Force parameters passed in registers to be written to the stack
-  endif (CLR_CMAKE_HOST_ARCH_AMD64)
-
-  # enable control-flow-guard support for native components for non-Arm64 builds
-  # Added using variables instead of add_compile_options to let individual projects override it
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /guard:cf")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")
-
-  # Enable EH-continuation table and CET-compatibility for native components for amd64 builds except for components of the Mono
-  # runtime. Added some switches using variables instead of add_compile_options to let individual projects override it.
-  if (CLR_CMAKE_HOST_ARCH_AMD64 AND NOT CLR_CMAKE_RUNTIME_MONO)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /guard:ehcont")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:ehcont")
-    set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /guard:ehcont")
-    add_linker_flag(/guard:ehcont)
-    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /CETCOMPAT")
-  endif (CLR_CMAKE_HOST_ARCH_AMD64 AND NOT CLR_CMAKE_RUNTIME_MONO)
-
-  # Statically linked CRT (libcmt[d].lib, libvcruntime[d].lib and libucrt[d].lib) by default. This is done to avoid
-  # linking in VCRUNTIME140.DLL for a simplified xcopy experience by reducing the dependency on VC REDIST.
-  #
-  # For Release builds, we shall dynamically link into uCRT [ucrtbase.dll] (which is pushed down as a Windows Update on downlevel OS) but
-  # wont do the same for debug/checked builds since ucrtbased.dll is not redistributable and Debug/Checked builds are not
-  # production-time scenarios.
-  set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<AND:$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>,$<NOT:$<BOOL:$<TARGET_PROPERTY:DAC_COMPONENT>>>>:Debug>)
-
-  add_compile_options($<$<COMPILE_LANGUAGE:ASM_MASM>:/ZH:SHA_256>)
-
-  if (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)
-    # Contracts work too slow on ARM/ARM64 DEBUG/CHECKED.
-    add_definitions(-DDISABLE_CONTRACTS)
-  endif (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)
-
-  # Don't display the output header when building RC files.
-  add_compile_options($<$<COMPILE_LANGUAGE:RC>:/nologo>)
-endif (MSVC)
-
-if(CLR_CMAKE_ENABLE_CODE_COVERAGE)
-
-  if(CLR_CMAKE_HOST_UNIX)
-    string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE)
-    if(NOT UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
-      message( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" )
-    endif(NOT UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
-
-    add_compile_options(-fprofile-arcs)
-    add_compile_options(-ftest-coverage)
-    add_linker_flag(--coverage)
-  else()
-    message(FATAL_ERROR "Code coverage builds not supported on current platform")
-  endif(CLR_CMAKE_HOST_UNIX)
-
-endif(CLR_CMAKE_ENABLE_CODE_COVERAGE)
-
-if (CMAKE_GENERATOR MATCHES "(Makefile|Ninja)")
-  set(CMAKE_RC_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
-endif()
-
-# Ensure other tools are present
-if (CLR_CMAKE_HOST_WIN32)
-    if(CLR_CMAKE_HOST_ARCH_ARM)
-
-      # Explicitly specify the assembler to be used for Arm32 compile
-      file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm\\armasm.exe" CMAKE_ASM_COMPILER)
-
-      set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER})
-      message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}")
-
-      # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly
-      # use ml[64].exe as the assembler.
-      enable_language(ASM)
-      set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded         "")
-      set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL      "")
-      set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug    "")
-      set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
-      set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -g <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
-
-    elseif(CLR_CMAKE_HOST_ARCH_ARM64)
-
-      # Explicitly specify the assembler to be used for Arm64 compile
-      file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm64\\armasm64.exe" CMAKE_ASM_COMPILER)
-
-      set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER})
-      message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}")
-
-      # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly
-      # use ml[64].exe as the assembler.
-      enable_language(ASM)
-      set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded         "")
-      set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL      "")
-      set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug    "")
-      set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
-      set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -g <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
-    else()
-      enable_language(ASM_MASM)
-      set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded         "")
-      set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL      "")
-      set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug    "")
-      set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
-    endif()
-
-    # Ensure that MC is present
-    find_program(MC mc)
-    if (MC STREQUAL "MC-NOTFOUND")
-        message(FATAL_ERROR "MC not found")
-    endif()
-
-elseif (NOT CLR_CMAKE_HOST_BROWSER)
-    enable_language(ASM)
-
-endif(CLR_CMAKE_HOST_WIN32)
diff --git a/eng/native/configureoptimization.cmake b/eng/native/configureoptimization.cmake
deleted file mode 100644 (file)
index 50c7b1c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-if(CLR_CMAKE_HOST_WIN32)
-    add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Debug>>:/Od>)
-    if (CLR_CMAKE_HOST_ARCH_I386)
-        # The Windows x86 Checked CLR has some kind of problem with exception handling
-        # when compiled with /O2. Issue: https://github.com/dotnet/runtime/issues/59845.
-        add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Checked>>:/O1>)
-    else()
-        add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Checked>>:/O2>)
-    endif()
-    add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Release>>:/Ox>)
-    add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:RelWithDebInfo>>:/O2>)
-elseif(CLR_CMAKE_HOST_UNIX)
-    add_compile_options($<$<CONFIG:Debug>:-O0>)
-    add_compile_options($<$<CONFIG:Checked>:-O2>)
-    add_compile_options($<$<CONFIG:Release>:-O3>)
-    add_compile_options($<$<CONFIG:RelWithDebInfo>:-O2>)
-endif()
diff --git a/eng/native/configurepaths.cmake b/eng/native/configurepaths.cmake
deleted file mode 100644 (file)
index 19407a4..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-get_filename_component(CLR_REPO_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE)
-set(CLR_ENG_NATIVE_DIR ${CMAKE_CURRENT_LIST_DIR})
-get_filename_component(CLR_SRC_NATIVE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../src/native ABSOLUTE)
-get_filename_component(CLR_SRC_LIBS_NATIVE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../src/libraries/Native ABSOLUTE)
-set (CLR_ARTIFACTS_OBJ_DIR "${CLR_REPO_ROOT_DIR}/artifacts/obj")
-set(VERSION_HEADER_PATH "${CLR_ARTIFACTS_OBJ_DIR}/_version.h")
-set(VERSION_FILE_PATH "${CLR_ARTIFACTS_OBJ_DIR}/_version.c")
-set(VERSION_FILE_RC_PATH "${CLR_ARTIFACTS_OBJ_DIR}/NativeVersion.rc")
-set(RUNTIME_VERSION_HEADER_PATH "${CLR_ARTIFACTS_OBJ_DIR}/runtime_version.h")
diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake
deleted file mode 100644 (file)
index f5c8abe..0000000
+++ /dev/null
@@ -1,427 +0,0 @@
-include(${CMAKE_CURRENT_LIST_DIR}/functions.cmake)
-
-# If set, indicates that this is not an officially supported release
-# Keep in sync with IsPrerelease in Directory.Build.props
-set(PRERELEASE 1)
-
-#----------------------------------------
-# Detect and set platform variable names
-#     - for non-windows build platform & architecture is detected using inbuilt CMAKE variables and cross target component configure
-#     - for windows we use the passed in parameter to CMAKE to determine build arch
-#----------------------------------------
-set(CLR_CMAKE_HOST_OS ${CMAKE_SYSTEM_NAME})
-if(CLR_CMAKE_HOST_OS STREQUAL Linux)
-    set(CLR_CMAKE_HOST_UNIX 1)
-    if(CLR_CROSS_COMPONENTS_BUILD)
-        # CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host.
-        if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
-            if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm" OR CLR_CMAKE_TARGET_ARCH STREQUAL "armel")
-                if(CMAKE_CROSSCOMPILING)
-                    set(CLR_CMAKE_HOST_UNIX_X86 1)
-                else()
-                    set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-                endif()
-            else()
-                set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-            endif()
-        elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL i686)
-            set(CLR_CMAKE_HOST_UNIX_X86 1)
-        else()
-            clr_unknown_arch()
-        endif()
-    else()
-        # CMAKE_SYSTEM_PROCESSOR returns the value of `uname -p` on target.
-        # For the AMD/Intel 64bit architecture two different strings are common.
-        # Linux and Darwin identify it as "x86_64" while FreeBSD and netbsd uses the
-        # "amd64" string. Accept either of the two here.
-        if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
-            set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
-            set(CLR_CMAKE_HOST_UNIX_ARM 1)
-            set(CLR_CMAKE_HOST_UNIX_ARMV7L 1)
-        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a)
-            set(CLR_CMAKE_HOST_UNIX_ARM 1)
-        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
-            set(CLR_CMAKE_HOST_UNIX_ARM64 1)
-        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686 OR CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
-            set(CLR_CMAKE_HOST_UNIX_X86 1)
-        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL s390x)
-            set(CLR_CMAKE_HOST_UNIX_S390X 1)
-        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL mips64)
-            set(CLR_CMAKE_HOST_UNIX_MIPS64 1)
-        else()
-            clr_unknown_arch()
-        endif()
-    endif()
-    set(CLR_CMAKE_HOST_LINUX 1)
-
-    # Detect Linux ID
-    set(LINUX_ID_FILE "/etc/os-release")
-    if(CMAKE_CROSSCOMPILING)
-        set(LINUX_ID_FILE "${CMAKE_SYSROOT}${LINUX_ID_FILE}")
-    endif()
-
-    if(EXISTS ${LINUX_ID_FILE})
-        execute_process(
-            COMMAND bash -c "source ${LINUX_ID_FILE} && echo \$ID"
-            OUTPUT_VARIABLE CLR_CMAKE_LINUX_ID
-            OUTPUT_STRIP_TRAILING_WHITESPACE)
-    endif()
-
-    if(DEFINED CLR_CMAKE_LINUX_ID)
-        if(CLR_CMAKE_LINUX_ID STREQUAL tizen)
-            set(CLR_CMAKE_TARGET_TIZEN_LINUX 1)
-            set(CLR_CMAKE_HOST_OS ${CLR_CMAKE_LINUX_ID})
-        elseif(CLR_CMAKE_LINUX_ID STREQUAL alpine)
-            set(CLR_CMAKE_HOST_ALPINE_LINUX 1)
-            set(CLR_CMAKE_HOST_OS ${CLR_CMAKE_LINUX_ID})
-        endif()
-    endif(DEFINED CLR_CMAKE_LINUX_ID)
-endif(CLR_CMAKE_HOST_OS STREQUAL Linux)
-
-if(CLR_CMAKE_HOST_OS STREQUAL Darwin)
-    set(CLR_CMAKE_HOST_UNIX 1)
-
-    if(CMAKE_SYSTEM_VARIANT STREQUAL MacCatalyst)
-      set(CLR_CMAKE_HOST_MACCATALYST 1)
-    else()
-      set(CLR_CMAKE_HOST_OSX 1)
-    endif(CMAKE_SYSTEM_VARIANT STREQUAL MacCatalyst)
-
-    if(CMAKE_OSX_ARCHITECTURES STREQUAL x86_64)
-        set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-    elseif(CMAKE_OSX_ARCHITECTURES STREQUAL arm64)
-        set(CLR_CMAKE_HOST_UNIX_ARM64 1)
-    else()
-        clr_unknown_arch()
-    endif()
-    set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} <FLAGS> <DEFINES> <INCLUDES> -o <OBJECT> -c <SOURCE>")
-endif(CLR_CMAKE_HOST_OS STREQUAL Darwin)
-
-if(CLR_CMAKE_HOST_OS STREQUAL iOS OR CLR_CMAKE_HOST_OS STREQUAL iOSSimulator)
-    set(CLR_CMAKE_HOST_UNIX 1)
-    set(CLR_CMAKE_HOST_IOS 1)
-    if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
-        set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
-        set(CLR_CMAKE_HOST_UNIX_X86 1)
-    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "armv7")
-        set(CLR_CMAKE_HOST_UNIX_ARM 1)
-    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
-        set(CLR_CMAKE_HOST_UNIX_ARM64 1)
-    else()
-        clr_unknown_arch()
-    endif()
-endif(CLR_CMAKE_HOST_OS STREQUAL iOS OR CLR_CMAKE_HOST_OS STREQUAL iOSSimulator)
-
-if(CLR_CMAKE_HOST_OS STREQUAL tvOS OR CLR_CMAKE_HOST_OS STREQUAL tvOSSimulator)
-    set(CLR_CMAKE_HOST_UNIX 1)
-    set(CLR_CMAKE_HOST_TVOS 1)
-    if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
-        set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
-        set(CLR_CMAKE_HOST_UNIX_ARM64 1)
-    else()
-        clr_unknown_arch()
-    endif()
-endif(CLR_CMAKE_HOST_OS STREQUAL tvOS OR CLR_CMAKE_HOST_OS STREQUAL tvOSSimulator)
-
-if(CLR_CMAKE_HOST_OS STREQUAL Android)
-    set(CLR_CMAKE_HOST_UNIX 1)
-    set(CLR_CMAKE_HOST_LINUX 1)
-    set(CLR_CMAKE_HOST_ANDROID 1)
-    if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
-        set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-    elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a)
-        set(CLR_CMAKE_HOST_UNIX_ARM 1)
-    elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
-        set(CLR_CMAKE_HOST_UNIX_ARM64 1)
-    elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
-        set(CLR_CMAKE_HOST_UNIX_X86 1)
-    else()
-        clr_unknown_arch()
-    endif()
-endif(CLR_CMAKE_HOST_OS STREQUAL Android)
-
-if(CLR_CMAKE_HOST_OS STREQUAL FreeBSD)
-    set(CLR_CMAKE_HOST_UNIX 1)
-    set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-    set(CLR_CMAKE_HOST_FREEBSD 1)
-endif(CLR_CMAKE_HOST_OS STREQUAL FreeBSD)
-
-if(CLR_CMAKE_HOST_OS STREQUAL OpenBSD)
-    set(CLR_CMAKE_HOST_UNIX 1)
-    set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-    set(CLR_CMAKE_HOST_OPENBSD 1)
-endif(CLR_CMAKE_HOST_OS STREQUAL OpenBSD)
-
-if(CLR_CMAKE_HOST_OS STREQUAL NetBSD)
-    set(CLR_CMAKE_HOST_UNIX 1)
-    set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-    set(CLR_CMAKE_HOST_NETBSD 1)
-endif(CLR_CMAKE_HOST_OS STREQUAL NetBSD)
-
-if(CLR_CMAKE_HOST_OS STREQUAL SunOS)
-    set(CLR_CMAKE_HOST_UNIX 1)
-    EXECUTE_PROCESS(
-        COMMAND isainfo -n
-        OUTPUT_VARIABLE SUNOS_NATIVE_INSTRUCTION_SET)
-
-    if(SUNOS_NATIVE_INSTRUCTION_SET MATCHES "amd64" OR CMAKE_CROSSCOMPILING)
-        set(CLR_CMAKE_HOST_UNIX_AMD64 1)
-        set(CMAKE_SYSTEM_PROCESSOR "amd64")
-    else()
-        clr_unknown_arch()
-    endif()
-
-    EXECUTE_PROCESS(
-        COMMAND uname -o
-        OUTPUT_VARIABLE SUNOS_KERNEL_KIND
-        ERROR_QUIET)
-
-    set(CLR_CMAKE_HOST_SUNOS 1)
-    if(SUNOS_KERNEL_KIND STREQUAL illumos OR CMAKE_CROSSCOMPILING)
-        set(CLR_CMAKE_HOST_OS_ILLUMOS 1)
-    else(SUNOS_KERNEL_KIND STREQUAL illumos OR CMAKE_CROSSCOMPILING)
-        set(CLR_CMAKE_HOST_OS_SOLARIS 1)
-    endif(SUNOS_KERNEL_KIND STREQUAL illumos OR CMAKE_CROSSCOMPILING)
-endif(CLR_CMAKE_HOST_OS STREQUAL SunOS)
-
-if(CLR_CMAKE_HOST_OS STREQUAL Windows)
-    set(CLR_CMAKE_HOST_OS windows)
-    set(CLR_CMAKE_HOST_WIN32 1)
-endif(CLR_CMAKE_HOST_OS STREQUAL Windows)
-
-if(CLR_CMAKE_HOST_OS STREQUAL Emscripten)
-    set(CLR_CMAKE_HOST_UNIX 1)
-    set(CLR_CMAKE_HOST_BROWSER 1)
-endif(CLR_CMAKE_HOST_OS STREQUAL Emscripten)
-
-#--------------------------------------------
-# This repo builds two set of binaries
-# 1. binaries which execute on target arch machine
-#        - for such binaries host architecture & target architecture are same
-#        - eg. coreclr.dll
-# 2. binaries which execute on host machine but target another architecture
-#        - host architecture is different from target architecture
-#        - eg. crossgen.exe - runs on x64 machine and generates nis targeting arm64
-#        - for complete list of such binaries refer to file crosscomponents.cmake
-#-------------------------------------------------------------
-# Set HOST architecture variables
-if(CLR_CMAKE_HOST_UNIX_ARM)
-    set(CLR_CMAKE_HOST_ARCH_ARM 1)
-    set(CLR_CMAKE_HOST_ARCH "arm")
-
-    if(CLR_CMAKE_HOST_UNIX_ARMV7L)
-        set(CLR_CMAKE_HOST_ARCH_ARMV7L 1)
-    endif()
-elseif(CLR_CMAKE_HOST_UNIX_ARM64)
-    set(CLR_CMAKE_HOST_ARCH_ARM64 1)
-    set(CLR_CMAKE_HOST_ARCH "arm64")
-elseif(CLR_CMAKE_HOST_UNIX_AMD64)
-    set(CLR_CMAKE_HOST_ARCH_AMD64 1)
-    set(CLR_CMAKE_HOST_ARCH "x64")
-elseif(CLR_CMAKE_HOST_UNIX_X86)
-    set(CLR_CMAKE_HOST_ARCH_I386 1)
-    set(CLR_CMAKE_HOST_ARCH "x86")
-elseif(CLR_CMAKE_HOST_UNIX_S390X)
-    set(CLR_CMAKE_HOST_ARCH_S390X 1)
-    set(CLR_CMAKE_HOST_ARCH "s390x")
-elseif(CLR_CMAKE_HOST_BROWSER)
-    set(CLR_CMAKE_HOST_ARCH_WASM 1)
-    set(CLR_CMAKE_HOST_ARCH "wasm")
-elseif(CLR_CMAKE_HOST_UNIX_MIPS64)
-    set(CLR_CMAKE_HOST_ARCH_MIPS64 1)
-    set(CLR_CMAKE_HOST_ARCH "mips64")
-elseif(WIN32)
-    # CLR_CMAKE_HOST_ARCH is passed in as param to cmake
-    if (CLR_CMAKE_HOST_ARCH STREQUAL x64)
-        set(CLR_CMAKE_HOST_ARCH_AMD64 1)
-    elseif(CLR_CMAKE_HOST_ARCH STREQUAL x86)
-        set(CLR_CMAKE_HOST_ARCH_I386 1)
-    elseif(CLR_CMAKE_HOST_ARCH STREQUAL arm)
-        set(CLR_CMAKE_HOST_ARCH_ARM 1)
-    elseif(CLR_CMAKE_HOST_ARCH STREQUAL arm64)
-        set(CLR_CMAKE_HOST_ARCH_ARM64 1)
-    else()
-        clr_unknown_arch()
-    endif()
-endif()
-
-# Set TARGET architecture variables
-# Target arch will be a cmake param (optional) for both windows as well as non-windows build
-# if target arch is not specified then host & target are same
-if(NOT DEFINED CLR_CMAKE_TARGET_ARCH OR CLR_CMAKE_TARGET_ARCH STREQUAL "" )
-  set(CLR_CMAKE_TARGET_ARCH ${CLR_CMAKE_HOST_ARCH})
-
-  # This is required for "arm" targets (CMAKE_SYSTEM_PROCESSOR "armv7l"),
-  # for which this flag otherwise won't be set up below
-  if (CLR_CMAKE_HOST_ARCH_ARMV7L)
-    set(CLR_CMAKE_TARGET_ARCH_ARMV7L 1)
-  endif()
-endif()
-
-# Set target architecture variables
-if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
-    set(CLR_CMAKE_TARGET_ARCH_AMD64 1)
-  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
-    set(CLR_CMAKE_TARGET_ARCH_I386 1)
-  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
-    set(CLR_CMAKE_TARGET_ARCH_ARM64 1)
-  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm)
-    set(CLR_CMAKE_TARGET_ARCH_ARM 1)
-  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armel)
-    set(CLR_CMAKE_TARGET_ARCH_ARM 1)
-    set(CLR_CMAKE_TARGET_ARCH_ARMV7L 1)
-    set(ARM_SOFTFP 1)
-  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL s390x)
-    set(CLR_CMAKE_TARGET_ARCH_S390X 1)
-  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL wasm)
-    set(CLR_CMAKE_TARGET_ARCH_WASM 1)
-  elseif(CLR_CMAKE_TARGET_ARCH STREQUAL mips64)
-    set(CLR_CMAKE_TARGET_ARCH_MIPS64 1)
-  else()
-    clr_unknown_arch()
-endif()
-
-# Set TARGET architecture variables
-# Target os will be a cmake param (optional) for both windows as well as non-windows build
-# if target os is not specified then host & target os are same
-if (NOT DEFINED CLR_CMAKE_TARGET_OS OR CLR_CMAKE_TARGET_OS STREQUAL "" )
-  set(CLR_CMAKE_TARGET_OS ${CLR_CMAKE_HOST_OS})
-endif()
-
-if(CLR_CMAKE_TARGET_OS STREQUAL Linux)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_LINUX 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL Linux)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL tizen)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_LINUX 1)
-    set(CLR_CMAKE_TARGET_TIZEN_LINUX 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL tizen)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL alpine)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_LINUX 1)
-    set(CLR_CMAKE_TARGET_ALPINE_LINUX 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL alpine)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL Android)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_LINUX 1)
-    set(CLR_CMAKE_TARGET_ANDROID 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL Android)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL Darwin)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-
-    if(CMAKE_SYSTEM_VARIANT STREQUAL MacCatalyst)
-        set(CLR_CMAKE_TARGET_MACCATALYST 1)
-    else()
-        set(CLR_CMAKE_TARGET_OSX 1)
-    endif(CMAKE_SYSTEM_VARIANT STREQUAL MacCatalyst)
-endif(CLR_CMAKE_TARGET_OS STREQUAL Darwin)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL iOS OR CLR_CMAKE_TARGET_OS STREQUAL iOSSimulator)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_IOS 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL iOS OR CLR_CMAKE_TARGET_OS STREQUAL iOSSimulator)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL tvOS OR CLR_CMAKE_TARGET_OS STREQUAL tvOSSimulator)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_TVOS 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL tvOS OR CLR_CMAKE_TARGET_OS STREQUAL tvOSSimulator)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL FreeBSD)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_FREEBSD 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL FreeBSD)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL OpenBSD)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_OPENBSD 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL OpenBSD)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL NetBSD)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_NETBSD 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL NetBSD)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL SunOS)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    if(CLR_CMAKE_HOST_OS_ILLUMOS)
-        set(CLR_CMAKE_TARGET_OS_ILLUMOS 1)
-    else(CLR_CMAKE_HOST_OS_ILLUMOS)
-        set(CLR_CMAKE_TARGET_OS_SOLARIS 1)
-    endif(CLR_CMAKE_HOST_OS_ILLUMOS)
-    set(CLR_CMAKE_TARGET_SUNOS 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL SunOS)
-
-if(CLR_CMAKE_TARGET_OS STREQUAL Emscripten)
-    set(CLR_CMAKE_TARGET_UNIX 1)
-    set(CLR_CMAKE_TARGET_LINUX 1)
-    set(CLR_CMAKE_TARGET_BROWSER 1)
-endif(CLR_CMAKE_TARGET_OS STREQUAL Emscripten)
-
-if(CLR_CMAKE_TARGET_UNIX)
-    if(CLR_CMAKE_TARGET_ARCH STREQUAL x64)
-        set(CLR_CMAKE_TARGET_UNIX_AMD64 1)
-    elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armel)
-        set(CLR_CMAKE_TARGET_UNIX_ARM 1)
-    elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm)
-        set(CLR_CMAKE_TARGET_UNIX_ARM 1)
-    elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
-        set(CLR_CMAKE_TARGET_UNIX_ARM64 1)
-    elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
-        set(CLR_CMAKE_TARGET_UNIX_X86 1)
-    elseif(CLR_CMAKE_TARGET_ARCH STREQUAL s390x)
-        set(CLR_CMAKE_TARGET_UNIX_S390X 1)
-    elseif(CLR_CMAKE_TARGET_ARCH STREQUAL wasm)
-        set(CLR_CMAKE_TARGET_UNIX_WASM 1)
-    elseif(CLR_CMAKE_TARGET_ARCH STREQUAL mips64)
-        set(CLR_CMAKE_TARGET_UNIX_MIPS64 1)
-    else()
-        clr_unknown_arch()
-    endif()
-else()
-    set(CLR_CMAKE_TARGET_WIN32 1)
-endif(CLR_CMAKE_TARGET_UNIX)
-
-# check if host & target os/arch combination are valid
-if (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS)
-    if(NOT(CLR_CMAKE_TARGET_ARCH STREQUAL CLR_CMAKE_HOST_ARCH))
-        if(NOT((CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_I386)))
-            message(FATAL_ERROR "Invalid platform and target arch combination TARGET_ARCH=${CLR_CMAKE_TARGET_ARCH} HOST_ARCH=${CLR_CMAKE_HOST_ARCH}")
-        endif()
-    endif()
-else()
-    if(NOT (CLR_CMAKE_HOST_OS STREQUAL windows))
-        message(FATAL_ERROR "Invalid host and target os/arch combination. Host OS: ${CLR_CMAKE_HOST_OS}")
-    endif()
-    if(NOT (CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_ALPINE_LINUX))
-        message(FATAL_ERROR "Invalid host and target os/arch combination. Target OS: ${CLR_CMAKE_TARGET_OS}")
-    endif()
-    if(NOT ((CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM)))
-        message(FATAL_ERROR "Invalid host and target os/arch combination. Host Arch: ${CLR_CMAKE_HOST_ARCH} Target Arch: ${CLR_CMAKE_TARGET_ARCH}")
-    endif()
-endif()
-
-if(NOT CLR_CMAKE_TARGET_BROWSER)
-    # The default linker on Solaris also does not support PIE.
-    if(NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_SUNOS AND NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_HOST_TVOS AND NOT CLR_CMAKE_HOST_IOS AND NOT MSVC)
-        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
-        add_compile_options($<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-fPIE>)
-        add_compile_options($<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:-fPIC>)
-    endif()
-
-    set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-endif()
-
-string(TOLOWER "${CMAKE_BUILD_TYPE}" LOWERCASE_CMAKE_BUILD_TYPE)
-if(LOWERCASE_CMAKE_BUILD_TYPE STREQUAL debug)
-    # Clear _FORTIFY_SOURCE=2, if set
-    string(REPLACE "-D_FORTIFY_SOURCE=2 " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-    string(REPLACE "-D_FORTIFY_SOURCE=2 " "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
-endif()
diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake
deleted file mode 100644 (file)
index 136cd67..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-include(${CMAKE_CURRENT_LIST_DIR}/configureplatform.cmake)
-
-# Get the version of the compiler that is in the file name for tool location.
-set (CLR_CMAKE_COMPILER_FILE_NAME_VERSION "")
-if (CMAKE_C_COMPILER MATCHES "-?[0-9]+(\.[0-9]+)?$")
-  set(CLR_CMAKE_COMPILER_FILE_NAME_VERSION "${CMAKE_MATCH_0}")
-endif()
-
-if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER)
-  if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-    if(APPLE)
-      set(TOOLSET_PREFIX "")
-    else()
-      set(TOOLSET_PREFIX "llvm-")
-    endif()
-  elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
-    if(CMAKE_CROSSCOMPILING)
-      set(TOOLSET_PREFIX "${CMAKE_CXX_COMPILER_TARGET}-")
-    else()
-      set(TOOLSET_PREFIX "")
-    endif()
-  endif()
-
-  function(locate_toolchain_exec exec var)
-    string(TOUPPER ${exec} EXEC_UPPERCASE)
-    if(NOT "$ENV{CLR_${EXEC_UPPERCASE}}" STREQUAL "")
-      set(${var} "$ENV{CLR_${EXEC_UPPERCASE}}" PARENT_SCOPE)
-      return()
-    endif()
-
-    find_program(EXEC_LOCATION_${exec}
-      NAMES
-      "${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}"
-      "${TOOLSET_PREFIX}${exec}")
-
-    if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND")
-      message(FATAL_ERROR "Unable to find toolchain executable. Name: ${exec}, Prefix: ${TOOLSET_PREFIX}.")
-    endif()
-    set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE)
-  endfunction()
-
-  locate_toolchain_exec(ar CMAKE_AR)
-  locate_toolchain_exec(nm CMAKE_NM)
-  locate_toolchain_exec(ranlib CMAKE_RANLIB)
-
-  if(CMAKE_C_COMPILER_ID MATCHES "Clang")
-    locate_toolchain_exec(link CMAKE_LINKER)
-  endif()
-
-  if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND (NOT CLR_CMAKE_TARGET_ANDROID OR CROSS_ROOTFS))
-    locate_toolchain_exec(objdump CMAKE_OBJDUMP)
-
-    if(CLR_CMAKE_TARGET_ANDROID)
-      set(TOOLSET_PREFIX ${ANDROID_TOOLCHAIN_PREFIX})
-    elseif(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR
-       CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL s390x))
-      set(TOOLSET_PREFIX "${TOOLCHAIN}-")
-    else()
-      set(TOOLSET_PREFIX "")
-    endif()
-
-    locate_toolchain_exec(objcopy CMAKE_OBJCOPY)
-  endif()
-endif()
-
-if (NOT CLR_CMAKE_HOST_WIN32)
-  # detect linker
-  separate_arguments(ldVersion UNIX_COMMAND "${CMAKE_C_COMPILER} ${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version")
-  execute_process(COMMAND ${ldVersion}
-    ERROR_QUIET
-    OUTPUT_VARIABLE ldVersionOutput)
-
-  if("${ldVersionOutput}" MATCHES "LLD")
-    set(LD_LLVM 1)
-  elseif("${ldVersionOutput}" MATCHES "GNU ld" OR "${ldVersionOutput}" MATCHES "GNU gold" OR "${ldVersionOutput}" MATCHES "GNU linkers")
-    set(LD_GNU 1)
-  elseif("${ldVersionOutput}" MATCHES "Solaris Link")
-    set(LD_SOLARIS 1)
-  else(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_MACCATALYST)
-    set(LD_OSX 1)
-  endif()
-endif()
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
deleted file mode 100644 (file)
index 66a91ca..0000000
+++ /dev/null
@@ -1,526 +0,0 @@
-function(clr_unknown_arch)
-    if (WIN32)
-        message(FATAL_ERROR "Only AMD64, ARM64, ARM and I386 are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}")
-    elseif(CLR_CROSS_COMPONENTS_BUILD)
-        message(FATAL_ERROR "Only AMD64, I386 host are supported for linux cross-architecture component. Found: ${CMAKE_SYSTEM_PROCESSOR}")
-    else()
-        message(FATAL_ERROR "Only AMD64, ARM64 and ARM are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}")
-    endif()
-endfunction()
-
-# Build a list of compiler definitions by putting -D in front of each define.
-function(get_compile_definitions DefinitionName)
-    # Get the current list of definitions
-    get_directory_property(COMPILE_DEFINITIONS_LIST COMPILE_DEFINITIONS)
-
-    # The entries that contain generator expressions must have the -D inside of the
-    # expression. So we transform e.g. $<$<CONFIG:Debug>:_DEBUG> to $<$<CONFIG:Debug>:-D_DEBUG>
-
-    # CMake's support for multiple values within a single generator expression is somewhat ad-hoc.
-    # Since we have a number of complex generator expressions, we use them with multiple values to ensure that
-    # we don't forget to update all of the generator expressions if one needs to be updated.
-    # As a result, we need to expand out the multi-valued generator expression to wrap each individual value here.
-    # Otherwise, CMake will fail to expand it.
-    set(LastGeneratorExpression "")
-    foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST)
-      # If there is a definition that uses the $<TARGET_PROPERTY:prop> generator expression
-      # we need to remove it since that generator expression is only valid on binary targets.
-      # Assume that the value is 0.
-      string(REGEX REPLACE "\\$<TARGET_PROPERTY:[^,>]+>" "0" DEFINITION "${DEFINITION}")
-
-      if (${DEFINITION} MATCHES "^\\$<(.+):([^>]+)(>?)$")
-        if("${CMAKE_MATCH_3}" STREQUAL "")
-          set(DEFINITION "$<${CMAKE_MATCH_1}:-D${CMAKE_MATCH_2}>")
-          set(LastGeneratorExpression "${CMAKE_MATCH_1}")
-        else()
-          set(DEFINITION "$<${CMAKE_MATCH_1}:-D${CMAKE_MATCH_2}>")
-        endif()
-      elseif(${DEFINITION} MATCHES "([^>]+)>$")
-        # This entry is the last in a list nested within a generator expression.
-        set(DEFINITION "$<${LastGeneratorExpression}:-D${CMAKE_MATCH_1}>")
-        set(LastGeneratorExpression "")
-      elseif(NOT "${LastGeneratorExpression}" STREQUAL "")
-        set(DEFINITION "$<${LastGeneratorExpression}:-D${DEFINITION}>")
-      else()
-        set(DEFINITION -D${DEFINITION})
-      endif()
-      list(APPEND DEFINITIONS ${DEFINITION})
-    endforeach()
-    set(${DefinitionName} ${DEFINITIONS} PARENT_SCOPE)
-endfunction(get_compile_definitions)
-
-# Build a list of include directories
-function(get_include_directories IncludeDirectories)
-    get_directory_property(dirs INCLUDE_DIRECTORIES)
-    foreach(dir IN LISTS dirs)
-
-      if (CLR_CMAKE_HOST_ARCH_ARM AND WIN32)
-        list(APPEND INC_DIRECTORIES /I${dir})
-      else()
-        list(APPEND INC_DIRECTORIES -I${dir})
-      endif(CLR_CMAKE_HOST_ARCH_ARM AND WIN32)
-
-    endforeach()
-    set(${IncludeDirectories} ${INC_DIRECTORIES} PARENT_SCOPE)
-endfunction(get_include_directories)
-
-# Build a list of include directories for consumption by the assembler
-function(get_include_directories_asm IncludeDirectories)
-    get_directory_property(dirs INCLUDE_DIRECTORIES)
-
-    foreach(dir IN LISTS dirs)
-      list(APPEND INC_DIRECTORIES -I${dir};)
-    endforeach()
-
-    set(${IncludeDirectories} ${INC_DIRECTORIES} PARENT_SCOPE)
-endfunction(get_include_directories_asm)
-
-# Finds and returns unwind libs
-function(find_unwind_libs UnwindLibs)
-    if(CLR_CMAKE_HOST_ARCH_ARM)
-      find_library(UNWIND_ARCH NAMES unwind-arm)
-    endif()
-
-    if(CLR_CMAKE_HOST_ARCH_ARM64)
-      find_library(UNWIND_ARCH NAMES unwind-aarch64)
-    endif()
-
-    if(CLR_CMAKE_HOST_ARCH_AMD64)
-      find_library(UNWIND_ARCH NAMES unwind-x86_64)
-    endif()
-
-    if(CLR_CMAKE_HOST_ARCH_S390X)
-      find_library(UNWIND_ARCH NAMES unwind-s390x)
-    endif()
-
-    if(NOT UNWIND_ARCH STREQUAL UNWIND_ARCH-NOTFOUND)
-       set(UNWIND_LIBS ${UNWIND_ARCH})
-    endif()
-
-    find_library(UNWIND_GENERIC NAMES unwind-generic)
-
-    if(NOT UNWIND_GENERIC STREQUAL UNWIND_GENERIC-NOTFOUND)
-      set(UNWIND_LIBS ${UNWIND_LIBS} ${UNWIND_GENERIC})
-    endif()
-
-    find_library(UNWIND NAMES unwind)
-
-    if(UNWIND STREQUAL UNWIND-NOTFOUND)
-      message(FATAL_ERROR "Cannot find libunwind. Try installing libunwind8-dev or libunwind-devel.")
-    endif()
-
-    set(${UnwindLibs} ${UNWIND_LIBS} ${UNWIND} PARENT_SCOPE)
-endfunction(find_unwind_libs)
-
-# Set the passed in RetSources variable to the list of sources with added current source directory
-# to form absolute paths.
-# The parameters after the RetSources are the input files.
-function(convert_to_absolute_path RetSources)
-    set(Sources ${ARGN})
-    foreach(Source IN LISTS Sources)
-        list(APPEND AbsolutePathSources ${CMAKE_CURRENT_SOURCE_DIR}/${Source})
-    endforeach()
-    set(${RetSources} ${AbsolutePathSources} PARENT_SCOPE)
-endfunction(convert_to_absolute_path)
-
-#Preprocess file
-function(preprocess_file inputFilename outputFilename)
-  get_compile_definitions(PREPROCESS_DEFINITIONS)
-  get_include_directories(PREPROCESS_INCLUDE_DIRECTORIES)
-  if (MSVC)
-    add_custom_command(
-        OUTPUT ${outputFilename}
-        COMMAND ${CMAKE_CXX_COMPILER} ${PREPROCESS_INCLUDE_DIRECTORIES} /P /EP /TC ${PREPROCESS_DEFINITIONS}  /Fi${outputFilename}  ${inputFilename} /nologo
-        DEPENDS ${inputFilename}
-        COMMENT "Preprocessing ${inputFilename}. Outputting to ${outputFilename}"
-    )
-  else()
-    add_custom_command(
-        OUTPUT ${outputFilename}
-        COMMAND ${CMAKE_CXX_COMPILER} -E -P ${PREPROCESS_DEFINITIONS} ${PREPROCESS_INCLUDE_DIRECTORIES} -o ${outputFilename} -x c ${inputFilename}
-        DEPENDS ${inputFilename}
-        COMMENT "Preprocessing ${inputFilename}. Outputting to ${outputFilename}"
-    )
-  endif()
-
-  set_source_files_properties(${outputFilename}
-                              PROPERTIES GENERATED TRUE)
-endfunction()
-
-# preprocess_files(PreprocessedFilesList [fileToPreprocess1 [fileToPreprocess2 ...]])
-function(preprocess_files PreprocessedFilesList)
-  set(FilesToPreprocess ${ARGN})
-  foreach(ASM_FILE IN LISTS FilesToPreprocess)
-    # Inserts a custom command in CMake build to preprocess each asm source file
-    get_filename_component(name ${ASM_FILE} NAME_WE)
-    file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${name}.asm" ASM_PREPROCESSED_FILE)
-    preprocess_file(${ASM_FILE} ${ASM_PREPROCESSED_FILE})
-    list(APPEND PreprocessedFiles ${ASM_PREPROCESSED_FILE})
-  endforeach()
-  set(${PreprocessedFilesList} ${PreprocessedFiles} PARENT_SCOPE)
-endfunction()
-
-function(set_exports_linker_option exports_filename)
-    if(LD_GNU OR LD_SOLARIS OR LD_LLVM)
-        # Add linker exports file option
-        if(LD_SOLARIS)
-            set(EXPORTS_LINKER_OPTION -Wl,-M,${exports_filename} PARENT_SCOPE)
-        else()
-            set(EXPORTS_LINKER_OPTION -Wl,--version-script=${exports_filename} PARENT_SCOPE)
-        endif()
-    elseif(LD_OSX)
-        # Add linker exports file option
-        set(EXPORTS_LINKER_OPTION -Wl,-exported_symbols_list,${exports_filename} PARENT_SCOPE)
-    endif()
-endfunction()
-
-# compile_asm(TARGET target ASM_FILES file1 [file2 ...] OUTPUT_OBJECTS [variableName])
-# CMake does not support the ARM or ARM64 assemblers on Windows when using the
-# MSBuild generator. When the MSBuild generator is in use, we manually compile the assembly files
-# using this function.
-function(compile_asm)
-  set(options "")
-  set(oneValueArgs TARGET OUTPUT_OBJECTS)
-  set(multiValueArgs ASM_FILES)
-  cmake_parse_arguments(COMPILE_ASM "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGV})
-
-  get_include_directories_asm(ASM_INCLUDE_DIRECTORIES)
-
-  set (ASSEMBLED_OBJECTS "")
-
-  foreach(ASM_FILE ${COMPILE_ASM_ASM_FILES})
-    get_filename_component(name ${ASM_FILE} NAME_WE)
-    # Produce object file where CMake would store .obj files for an OBJECT library.
-    # ex: artifacts\obj\coreclr\windows.arm64.Debug\src\vm\wks\cee_wks.dir\Debug\AsmHelpers.obj
-    set (OBJ_FILE "${CMAKE_CURRENT_BINARY_DIR}/${COMPILE_ASM_TARGET}.dir/${CMAKE_CFG_INTDIR}/${name}.obj")
-
-    # Need to compile asm file using custom command as include directories are not provided to asm compiler
-    add_custom_command(OUTPUT ${OBJ_FILE}
-                        COMMAND "${CMAKE_ASM_COMPILER}" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_FILE}
-                        DEPENDS ${ASM_FILE}
-                        COMMENT "Assembling ${ASM_FILE} ---> \"${CMAKE_ASM_COMPILER}\" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_FILE}")
-
-    # mark obj as source that does not require compile
-    set_source_files_properties(${OBJ_FILE} PROPERTIES EXTERNAL_OBJECT TRUE)
-
-    # Add the generated OBJ in the dependency list so that it gets consumed during linkage
-    list(APPEND ASSEMBLED_OBJECTS ${OBJ_FILE})
-  endforeach()
-
-  set(${COMPILE_ASM_OUTPUT_OBJECTS} ${ASSEMBLED_OBJECTS} PARENT_SCOPE)
-endfunction()
-
-# add_component(componentName [targetName] [EXCLUDE_FROM_ALL])
-function(add_component componentName)
-  if (${ARGC} GREATER 2 OR ${ARGC} EQUAL 2)
-    set(componentTargetName "${ARGV1}")
-  else()
-    set(componentTargetName "${componentName}")
-  endif()
-  if (${ARGC} EQUAL 3 AND "${ARG2}" STREQUAL "EXCLUDE_FROM_ALL")
-    set(exclude_from_all_flag "EXCLUDE_FROM_ALL")
-  endif()
-  get_property(definedComponents GLOBAL PROPERTY CLR_CMAKE_COMPONENTS)
-  list (FIND definedComponents "${componentName}" componentIndex)
-  if (${componentIndex} EQUAL -1)
-    list (APPEND definedComponents "${componentName}")
-    add_custom_target("${componentTargetName}"
-      COMMAND "${CMAKE_COMMAND}" "-DCMAKE_INSTALL_COMPONENT=${componentName}" "-DBUILD_TYPE=$<CONFIG>" -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
-      ${exclude_from_all_flag})
-    set_property(GLOBAL PROPERTY CLR_CMAKE_COMPONENTS ${definedComponents})
-  endif()
-endfunction()
-
-function(generate_exports_file)
-  set(INPUT_LIST ${ARGN})
-  list(GET INPUT_LIST -1 outputFilename)
-  list(REMOVE_AT INPUT_LIST -1)
-
-  if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
-    set(SCRIPT_NAME generateexportedsymbols.sh)
-  else()
-    set(SCRIPT_NAME generateversionscript.sh)
-  endif()
-
-  add_custom_command(
-    OUTPUT ${outputFilename}
-    COMMAND ${CLR_ENG_NATIVE_DIR}/${SCRIPT_NAME} ${INPUT_LIST} >${outputFilename}
-    DEPENDS ${INPUT_LIST} ${CLR_ENG_NATIVE_DIR}/${SCRIPT_NAME}
-    COMMENT "Generating exports file ${outputFilename}"
-  )
-  set_source_files_properties(${outputFilename}
-                              PROPERTIES GENERATED TRUE)
-endfunction()
-
-function(generate_exports_file_prefix inputFilename outputFilename prefix)
-
-  if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
-    set(SCRIPT_NAME generateexportedsymbols.sh)
-  else()
-    set(SCRIPT_NAME generateversionscript.sh)
-    if (NOT ${prefix} STREQUAL "")
-        set(EXTRA_ARGS ${prefix})
-    endif()
-  endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
-
-  add_custom_command(
-    OUTPUT ${outputFilename}
-    COMMAND ${CLR_ENG_NATIVE_DIR}/${SCRIPT_NAME} ${inputFilename} ${EXTRA_ARGS} >${outputFilename}
-    DEPENDS ${inputFilename} ${CLR_ENG_NATIVE_DIR}/${SCRIPT_NAME}
-    COMMENT "Generating exports file ${outputFilename}"
-  )
-  set_source_files_properties(${outputFilename}
-                              PROPERTIES GENERATED TRUE)
-endfunction()
-
-function (get_symbol_file_name targetName outputSymbolFilename)
-  if (CLR_CMAKE_HOST_UNIX)
-    if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
-      set(strip_destination_file $<TARGET_FILE:${targetName}>.dwarf)
-    else ()
-      set(strip_destination_file $<TARGET_FILE:${targetName}>.dbg)
-    endif ()
-
-    set(${outputSymbolFilename} ${strip_destination_file} PARENT_SCOPE)
-  else(CLR_CMAKE_HOST_UNIX)
-    # We can't use the $<TARGET_PDB_FILE> generator expression here since
-    # the generator expression isn't supported on resource DLLs.
-    set(${outputSymbolFilename} $<TARGET_FILE_DIR:${targetName}>/$<TARGET_FILE_PREFIX:${targetName}>$<TARGET_FILE_BASE_NAME:${targetName}>.pdb PARENT_SCOPE)
-  endif(CLR_CMAKE_HOST_UNIX)
-endfunction()
-
-function(strip_symbols targetName outputFilename)
-  get_symbol_file_name(${targetName} strip_destination_file)
-  set(${outputFilename} ${strip_destination_file} PARENT_SCOPE)
-  if (CLR_CMAKE_HOST_UNIX)
-    set(strip_source_file $<TARGET_FILE:${targetName}>)
-
-    if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
-
-      # Ensure that dsymutil and strip are present
-      find_program(DSYMUTIL dsymutil)
-      if (DSYMUTIL STREQUAL "DSYMUTIL-NOTFOUND")
-        message(FATAL_ERROR "dsymutil not found")
-      endif()
-
-      find_program(STRIP strip)
-      if (STRIP STREQUAL "STRIP-NOTFOUND")
-        message(FATAL_ERROR "strip not found")
-      endif()
-
-      string(TOLOWER "${CMAKE_BUILD_TYPE}" LOWERCASE_CMAKE_BUILD_TYPE)
-      if (LOWERCASE_CMAKE_BUILD_TYPE STREQUAL release)
-        set(strip_command ${STRIP} -no_code_signature_warning -S ${strip_source_file} && codesign -f -s - ${strip_source_file})
-      else ()
-        set(strip_command)
-      endif ()
-
-      add_custom_command(
-        TARGET ${targetName}
-        POST_BUILD
-        VERBATIM
-        COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file}
-        COMMAND ${strip_command}
-        COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}"
-        )
-    else (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
-
-      add_custom_command(
-        TARGET ${targetName}
-        POST_BUILD
-        VERBATIM
-        COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file}
-        COMMAND ${CMAKE_OBJCOPY} --strip-unneeded ${strip_source_file}
-        COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file}
-        COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}"
-        )
-    endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
-  endif(CLR_CMAKE_HOST_UNIX)
-endfunction()
-
-function(install_with_stripped_symbols targetName kind destination)
-    if(NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS)
-      strip_symbols(${targetName} symbol_file)
-      install_symbol_file(${symbol_file} ${destination} ${ARGN})
-    endif()
-
-    if ((CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) AND ("${kind}" STREQUAL "TARGETS"))
-      # We want to avoid the kind=TARGET install behaviors which corrupt code signatures on osx-arm64
-      set(kind PROGRAMS)
-    endif()
-
-    if ("${kind}" STREQUAL "TARGETS")
-      set(install_source ${targetName})
-    elseif("${kind}" STREQUAL "PROGRAMS")
-      set(install_source $<TARGET_FILE:${targetName}>)
-    else()
-      message(FATAL_ERROR "The `kind` argument has to be either TARGETS or PROGRAMS, ${kind} was provided instead")
-    endif()
-    install(${kind} ${install_source} DESTINATION ${destination} ${ARGN})
-endfunction()
-
-function(install_symbol_file symbol_file destination_path)
-  if(CLR_CMAKE_TARGET_WIN32)
-      install(FILES ${symbol_file} DESTINATION ${destination_path}/PDB ${ARGN})
-  else()
-      install(FILES ${symbol_file} DESTINATION ${destination_path} ${ARGN})
-  endif()
-endfunction()
-
-# install_clr(TARGETS targetName [targetName2 ...] [DESTINATIONS destination [destination2 ...]] [COMPONENT componentName])
-function(install_clr)
-  set(multiValueArgs TARGETS DESTINATIONS)
-  set(singleValueArgs COMPONENT)
-  set(options "")
-  cmake_parse_arguments(INSTALL_CLR "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGV})
-
-  if ("${INSTALL_CLR_TARGETS}" STREQUAL "")
-    message(FATAL_ERROR "At least one target must be passed to install_clr(TARGETS )")
-  endif()
-
-  if ("${INSTALL_CLR_DESTINATIONS}" STREQUAL "")
-    message(FATAL_ERROR "At least one destination must be passed to install_clr.")
-  endif()
-
-  set(destinations "")
-
-  if (NOT "${INSTALL_CLR_DESTINATIONS}" STREQUAL "")
-    list(APPEND destinations ${INSTALL_CLR_DESTINATIONS})
-  endif()
-
-  if ("${INSTALL_CLR_COMPONENT}" STREQUAL "")
-    set(INSTALL_CLR_COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
-  endif()
-
-  foreach(targetName ${INSTALL_CLR_TARGETS})
-    if (NOT "${INSTALL_CLR_COMPONENT}" STREQUAL "${targetName}")
-      get_property(definedComponents GLOBAL PROPERTY CLR_CMAKE_COMPONENTS)
-      list(FIND definedComponents "${INSTALL_CLR_COMPONENT}" componentIdx)
-      if (${componentIdx} EQUAL -1)
-        message(FATAL_ERROR "The ${INSTALL_CLR_COMPONENT} component is not defined. Add a call to `add_component(${INSTALL_CLR_COMPONENT})` to define the component in the build.")
-      endif()
-      add_dependencies(${INSTALL_CLR_COMPONENT} ${targetName})
-    endif()
-    get_target_property(targetType ${targetName} TYPE)
-    if (NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS AND NOT "${targetType}" STREQUAL "STATIC_LIBRARY")
-      get_symbol_file_name(${targetName} symbolFile)
-    endif()
-
-    foreach(destination ${destinations})
-      # We don't need to install the export libraries for our DLLs
-      # since they won't be directly linked against.
-      install(PROGRAMS $<TARGET_FILE:${targetName}> DESTINATION ${destination} COMPONENT ${INSTALL_CLR_COMPONENT})
-      if (NOT "${symbolFile}" STREQUAL "")
-        install_symbol_file(${symbolFile} ${destination} COMPONENT ${INSTALL_CLR_COMPONENT})
-      endif()
-
-      if(CLR_CMAKE_PGO_INSTRUMENT)
-        if(WIN32)
-          get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
-          if(is_multi_config)
-              install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pgd DESTINATION ${destination}/PGD OPTIONAL COMPONENT ${INSTALL_CLR_COMPONENT})
-          else()
-              install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${targetName}.pgd DESTINATION ${destination}/PGD OPTIONAL COMPONENT ${INSTALL_CLR_COMPONENT})
-          endif()
-        endif()
-      endif()
-    endforeach()
-  endforeach()
-endfunction()
-
-# Disable PAX mprotect that would prevent JIT and other codegen in coreclr from working.
-# PAX mprotect prevents:
-# - changing the executable status of memory pages that were
-#   not originally created as executable,
-# - making read-only executable pages writable again,
-# - creating executable pages from anonymous memory,
-# - making read-only-after-relocations (RELRO) data pages writable again.
-function(disable_pax_mprotect targetName)
-  # Disabling PAX hardening only makes sense in systems that use Elf image formats. Particularly, looking
-  # for paxctl in macOS is problematic as it collides with popular software for that OS that performs completely
-  # unrelated functionality. Only look for it when we'll generate Elf images.
-  if (CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS)
-    # Try to locate the paxctl tool. Failure to find it is not fatal,
-    # but the generated executables won't work on a system where PAX is set
-    # to prevent applications to create executable memory mappings.
-    find_program(PAXCTL paxctl)
-
-    if (NOT PAXCTL STREQUAL "PAXCTL-NOTFOUND")
-        add_custom_command(
-        TARGET ${targetName}
-        POST_BUILD
-        VERBATIM
-        COMMAND ${PAXCTL} -c -m $<TARGET_FILE:${targetName}>
-        )
-    endif()
-  endif(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS)
-endfunction()
-
-if (CMAKE_VERSION VERSION_LESS "3.12")
-  # Polyfill add_compile_definitions when it is unavailable
-  function(add_compile_definitions)
-    get_directory_property(DIR_COMPILE_DEFINITIONS COMPILE_DEFINITIONS)
-    list(APPEND DIR_COMPILE_DEFINITIONS ${ARGV})
-    set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${DIR_COMPILE_DEFINITIONS}")
-  endfunction()
-endif()
-
-if (CMAKE_VERSION VERSION_LESS "3.16")
-  # Provide a no-op polyfill for precompiled headers on old CMake versions
-  function(target_precompile_headers)
-  endfunction()
-endif()
-
-# add_linker_flag(Flag [Config1 Config2 ...])
-function(add_linker_flag Flag)
-  if (ARGN STREQUAL "")
-    set("CMAKE_EXE_LINKER_FLAGS" "${CMAKE_EXE_LINKER_FLAGS} ${Flag}" PARENT_SCOPE)
-    set("CMAKE_SHARED_LINKER_FLAGS" "${CMAKE_SHARED_LINKER_FLAGS} ${Flag}" PARENT_SCOPE)
-  else()
-    foreach(Config ${ARGN})
-      set("CMAKE_EXE_LINKER_FLAGS_${Config}" "${CMAKE_EXE_LINKER_FLAGS_${Config}} ${Flag}" PARENT_SCOPE)
-      set("CMAKE_SHARED_LINKER_FLAGS_${Config}" "${CMAKE_SHARED_LINKER_FLAGS_${Config}} ${Flag}" PARENT_SCOPE)
-    endforeach()
-  endif()
-endfunction()
-
-function(link_natvis_sources_for_target targetName linkKind)
-    if (NOT CLR_CMAKE_HOST_WIN32)
-        return()
-    endif()
-    foreach(source ${ARGN})
-        if (NOT IS_ABSOLUTE "${source}")
-            convert_to_absolute_path(source ${source})
-        endif()
-        get_filename_component(extension "${source}" EXT)
-        if ("${extension}" STREQUAL ".natvis")
-            message("Embedding natvis ${source}")
-            # Since natvis embedding is only supported on Windows
-            # we can use target_link_options since our minimum version is high enough
-            target_link_options(${targetName} "${linkKind}" "-NATVIS:${source}")
-        endif()
-    endforeach()
-endfunction()
-
-function(add_executable_clr targetName)
-    if(NOT WIN32)
-      add_executable(${ARGV} ${VERSION_FILE_PATH})
-      disable_pax_mprotect(${ARGV})
-    else()
-      add_executable(${ARGV})
-    endif(NOT WIN32)
-    if(NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS)
-      strip_symbols(${ARGV0} symbolFile)
-    endif()
-endfunction()
-
-function(add_library_clr targetName kind)
-    if(NOT WIN32 AND "${kind}" STREQUAL "SHARED")
-      add_library(${ARGV} ${VERSION_FILE_PATH})
-    else()
-      add_library(${ARGV})
-    endif()
-    if("${kind}" STREQUAL "SHARED" AND NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS)
-      strip_symbols(${ARGV0} symbolFile)
-    endif()
-endfunction()
diff --git a/eng/native/gen-buildsys.cmd b/eng/native/gen-buildsys.cmd
deleted file mode 100644 (file)
index 243921d..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-@if not defined _echo @echo off
-rem
-rem This file invokes cmake and generates the build system for windows.
-
-setlocal
-
-set argC=0
-for %%x in (%*) do Set /A argC+=1
-
-if %argC% lss 4 GOTO :USAGE
-if %1=="/?" GOTO :USAGE
-
-setlocal enabledelayedexpansion
-set basePath=%~dp0
-set __repoRoot=%~dp0..\..\
-:: remove quotes
-set "basePath=%basePath:"=%"
-:: remove trailing slash
-if %basePath:~-1%==\ set "basePath=%basePath:~0,-1%"
-
-set __SourceDir=%1
-set __IntermediatesDir=%2
-set __VSVersion=%3
-set __Arch=%4
-set __CmakeGenerator=Visual Studio
-set __UseEmcmake=0
-if /i "%__Ninja%" == "1" (
-    set __CmakeGenerator=Ninja
-) else (
-    if /i NOT "%__Arch%" == "wasm" (
-        if /i "%__VSVersion%" == "vs2022" (set __CmakeGenerator=%__CmakeGenerator% 17 2022)
-        if /i "%__VSVersion%" == "vs2019" (set __CmakeGenerator=%__CmakeGenerator% 16 2019)
-        if /i "%__VSVersion%" == "vs2017" (set __CmakeGenerator=%__CmakeGenerator% 15 2017)
-
-        if /i "%__Arch%" == "x64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A x64)
-        if /i "%__Arch%" == "arm" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM)
-        if /i "%__Arch%" == "arm64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64)
-        if /i "%__Arch%" == "x86" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A Win32)
-    ) else (
-        set __CmakeGenerator=NMake Makefiles
-    )
-)
-
-if /i "%__Arch%" == "wasm" (
-
-    if "%EMSDK_PATH%" == "" (
-        if not exist "%__repoRoot%src\mono\wasm\emsdk" (
-            echo Error: Should set EMSDK_PATH environment variable pointing to emsdk root.
-            exit /B 1
-        )
-
-        set EMSDK_PATH=%__repoRoot%src\mono\wasm\emsdk
-        set EMSDK_PATH=!EMSDK_PATH:\=/!
-    )
-
-    set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_TOOLCHAIN_FILE=!EMSDK_PATH!/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
-    set __UseEmcmake=1
-) else (
-    set __ExtraCmakeParams=%__ExtraCmakeParams%  "-DCMAKE_SYSTEM_VERSION=10.0"
-)
-
-:loop
-if [%5] == [] goto end_loop
-set __ExtraCmakeParams=%__ExtraCmakeParams% %5
-shift
-goto loop
-:end_loop
-
-set __ExtraCmakeParams="-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLR_CMAKE_HOST_ARCH=%__Arch%" %__ExtraCmakeParams%
-
-set __CmdLineOptionsUpToDateFile=%__IntermediatesDir%\cmake_cmd_line.txt
-set __CMakeCmdLineCache=
-if not "%__ConfigureOnly%" == "1" (
-    REM MSBuild can't reload from a CMake reconfigure during build correctly, so only do this
-    REM command-line up to date check for non-VS generators.
-    if "%__CmakeGenerator:Visual Studio=%" == "%__CmakeGenerator%" (
-        if exist "%__CmdLineOptionsUpToDateFile%" (
-            set /p __CMakeCmdLineCache=<"%__CmdLineOptionsUpToDateFile%"
-            REM Strip the extra space from the end of the cached command line
-            if "!__ExtraCmakeParams!" == "!__CMakeCmdLineCache:~0,-1!" (
-                echo The CMake command line is the same as the last run. Skipping running CMake.
-                exit /B 0
-            ) else (
-                echo The CMake command line differs from the last run. Running CMake again.
-                echo %__ExtraCmakeParams% > %__CmdLineOptionsUpToDateFile%
-            )
-        ) else (
-            echo %__ExtraCmakeParams% > %__CmdLineOptionsUpToDateFile%
-        )
-    )
-)
-
-if /i "%__UseEmcmake%" == "1" (
-    call "!EMSDK_PATH!/emsdk_env.bat" > nul 2>&1 && emcmake "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir%
-) else (
-    "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir%
-)
-endlocal
-exit /B %errorlevel%
-
-:USAGE
-  echo "Usage..."
-  echo "gen-buildsys.cmd <path to top level CMakeLists.txt> <path to location for intermediate files> <VSVersion> <arch>"
-  echo "Specify the path to the top level CMake file - <ProjectK>/src/NDP"
-  echo "Specify the VSVersion to be used - VS2017 or VS2019"
-  EXIT /B 1
diff --git a/eng/native/gen-buildsys.sh b/eng/native/gen-buildsys.sh
deleted file mode 100755 (executable)
index 730d4dc..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/env bash
-#
-# This file invokes cmake and generates the build system for Clang.
-#
-
-scriptroot="$( cd -P "$( dirname "$0" )" && pwd )"
-
-if [[ "$#" -lt 4 ]]; then
-  echo "Usage..."
-  echo "gen-buildsys.sh <path to top level CMakeLists.txt> <path to intermediate directory> <Architecture> <compiler> <compiler major version> <compiler minor version> [build flavor] [ninja] [scan-build] [cmakeargs]"
-  echo "Specify the path to the top level CMake file."
-  echo "Specify the path that the build system files are generated in."
-  echo "Specify the target architecture."
-  echo "Specify the name of compiler (clang or gcc)."
-  echo "Specify the major version of compiler."
-  echo "Specify the minor version of compiler."
-  echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG."
-  echo "Optionally specify 'scan-build' to enable build with clang static analyzer."
-  echo "Use the Ninja generator instead of the Unix Makefiles generator."
-  echo "Pass additional arguments to CMake call."
-  exit 1
-fi
-
-build_arch="$3"
-compiler="$4"
-majorVersion="$5"
-minorVersion="$6"
-
-if [[ "$compiler" != "default" ]]; then
-    nativescriptroot="$( cd -P "$scriptroot/../common/native" && pwd )"
-    source "$nativescriptroot/init-compiler.sh" "$nativescriptroot" "$build_arch" "$compiler" "$majorVersion" "$minorVersion"
-
-    CCC_CC="$CC"
-    CCC_CXX="$CXX"
-fi
-
-export CCC_CC CCC_CXX
-
-buildtype=DEBUG
-code_coverage=OFF
-build_tests=OFF
-scan_build=OFF
-generator="Unix Makefiles"
-__UnprocessedCMakeArgs=""
-
-for i in "${@:7}"; do
-    upperI="$(echo "$i" | tr "[:lower:]" "[:upper:]")"
-    case "$upperI" in
-      # Possible build types are DEBUG, CHECKED, RELEASE, RELWITHDEBINFO.
-      DEBUG | CHECKED | RELEASE | RELWITHDEBINFO)
-      buildtype="$upperI"
-      ;;
-      NINJA)
-      generator=Ninja
-      ;;
-      SCAN-BUILD)
-      echo "Static analysis is turned on for this build."
-      scan_build=ON
-      ;;
-      *)
-      __UnprocessedCMakeArgs="${__UnprocessedCMakeArgs}${__UnprocessedCMakeArgs:+ }$i"
-    esac
-done
-
-cmake_extra_defines=
-if [[ "$CROSSCOMPILE" == "1" ]]; then
-    platform="$(uname)"
-    # OSX doesn't use rootfs
-    if ! [[ -n "$ROOTFS_DIR" || "$platform" == "Darwin" ]]; then
-        echo "ROOTFS_DIR not set for crosscompile"
-        exit 1
-    fi
-
-    TARGET_BUILD_ARCH="$build_arch"
-    export TARGET_BUILD_ARCH
-
-    cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake"
-
-    if [[ "$platform" == "Darwin" ]]; then
-        cmake_extra_defines="$cmake_extra_defines -DCMAKE_SYSTEM_NAME=Darwin"
-    else
-        cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$scriptroot/../common/cross/toolchain.cmake"
-    fi
-fi
-
-if [[ "$build_arch" == "armel" ]]; then
-    cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
-fi
-
-if ! cmake_command=$(command -v cmake); then
-    echo "CMake was not found in PATH."
-    exit 1
-fi
-
-if [[ "$scan_build" == "ON" && -n "$SCAN_BUILD_COMMAND" ]]; then
-    cmake_command="$SCAN_BUILD_COMMAND $cmake_command"
-fi
-
-if [[ "$build_arch" == "wasm" ]]; then
-    cmake_command="emcmake $cmake_command"
-fi
-
-cmake_args_to_cache="$scan_build\n$SCAN_BUILD_COMMAND\n$generator\n$__UnprocessedCMakeArgs"
-cmake_args_cache_file="$2/cmake_cmd_line.txt"
-if [[ -z "$__ConfigureOnly" ]]; then
-    if [[ -e "$cmake_args_cache_file" ]]; then
-        cmake_args_cache=$(<"$cmake_args_cache_file")
-        if [[ "$cmake_args_cache" == "$cmake_args_to_cache" ]]; then
-            echo "CMake command line is unchanged. Reusing previous cache instead of regenerating."
-            exit 0
-        fi
-    fi
-    echo $cmake_args_to_cache > $cmake_args_cache_file
-fi
-
-# We have to be able to build with CMake 3.6.2, so we can't use the -S or -B options
-pushd "$2"
-
-$cmake_command \
-  --no-warn-unused-cli \
-  -G "$generator" \
-  "-DCMAKE_BUILD_TYPE=$buildtype" \
-  "-DCMAKE_INSTALL_PREFIX=$__CMakeBinDir" \
-  $cmake_extra_defines \
-  $__UnprocessedCMakeArgs \
-  "$1"
-
-popd
diff --git a/eng/native/generateexportedsymbols.sh b/eng/native/generateexportedsymbols.sh
deleted file mode 100755 (executable)
index 4a23aa8..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env bash
-
-saved=("$@")
-while test $# -gt 0; do
-  case "$1" in
-    --help|-h)
-      printf "Usage:\ngenerateexportedsymbols.sh <filename>\n"
-      exit 1;;
-    esac
-    shift
-done
-set -- "${saved[@]}"
-
-while read -r line; do
-  # Skip empty lines and comment lines starting with semicolon
-  if [[ "$line" =~ ^\;.*$|^[[:space:]]*$ ]]; then
-    continue
-  fi
-
-  # Remove the CR character in case the sources are mapped from
-  # a Windows share and contain CRLF line endings
-  line="${line//$'\r'/}"
-
-  printf "_%s\n" "${line//#/}"
-done < "$1"
diff --git a/eng/native/generateversionscript.sh b/eng/native/generateversionscript.sh
deleted file mode 100755 (executable)
index 83e2490..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-
-saved=("$@")
-while test $# -gt 0; do
-  case "$1" in
-    --help|-h)
-      printf "Usage:\ngenerateversionscript.sh <filename> <prefix>\n"
-      exit 1;;
-    esac
-    shift
-done
-set -- "${saved[@]}"
-
-prefix="$2"
-
-printf "V1.0 {\n    global:\n"
-
-while read -r line; do
-  # Skip empty lines and comment lines starting with semicolon
-  if [[ "$line" =~ ^\;.*$|^[[:space:]]*$ ]]; then
-    continue
-  fi
-
-  # Remove the CR character in case the sources are mapped from
-  # a Windows share and contain CRLF line endings
-  line="${line//$'\r'/}"
-
-  # Only prefix the entries that start with "#"
-  if [[ "$line" =~ ^#.*$ ]]; then
-    printf "        %s%s;\n" "$prefix" "${line//#/}"
-  else
-    printf "        %s;\n" "$line"
-  fi
-done < "$1"
-
-printf "    local: *;\n};\n"
diff --git a/eng/native/genmoduleindex.cmd b/eng/native/genmoduleindex.cmd
deleted file mode 100644 (file)
index a6be851..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-@echo off
-REM Generate module index header
-
-if [%1]==[] goto :Usage
-if [%2]==[] goto :Usage
-
-setlocal
-for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"size of image"') do set imagesize=%%i
-REM Pad the extracted size to 8 hex digits
-set imagesize=00000000%imagesize%
-set imagesize=%imagesize:~-8%
-
-for /f "tokens=1" %%i in ('dumpbin /HEADERS %1 ^| findstr /c:"time date"') do set timestamp=%%i
-REM Pad the extracted time stamp to 8 hex digits
-set timestamp=00000000%timestamp%
-set timestamp=%timestamp:~-8%
-
-echo 0x08, 0x%timestamp:~6,2%, 0x%timestamp:~4,2%, 0x%timestamp:~2,2%, 0x%timestamp:~0,2%, 0x%imagesize:~6,2%, 0x%imagesize:~4,2%, 0x%imagesize:~2,2%, 0x%imagesize:~0,2%, > %2
-
-endlocal
-exit /b 0
-
-:Usage
-echo Usage: genmoduleindex.cmd ModuleBinaryFile IndexHeaderFile
-exit /b 1
diff --git a/eng/native/genmoduleindex.sh b/eng/native/genmoduleindex.sh
deleted file mode 100755 (executable)
index 399a972..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-#
-# Generate module index header
-#
-set -euo pipefail
-
-if [[ "$#" -lt 2 ]]; then
-  echo "Usage: genmoduleindex.sh ModuleBinaryFile IndexHeaderFile"
-  exit 1
-fi
-
-function printIdAsBinary() {
-  id="$1"
-
-  # Print length in bytes
-  bytesLength="${#id}"
-  printf "0x%02x, " "$((bytesLength/2))"
-
-  # Print each pair of hex digits with 0x prefix followed by a comma
-  while [[ "$id" ]]; do
-    printf '0x%s, ' "${id:0:2}"
-    id=${id:2}
-  done
-}
-
-case "$(uname -s)" in
-Darwin)
-  cmd="dwarfdump -u $1"
-  pattern='^UUID: ([0-9A-Fa-f\-]+)';;
-*)
-  cmd="readelf -n $1"
-  pattern='^[[:space:]]*Build ID: ([0-9A-Fa-f\-]+)';;
-esac
-
-while read -r line; do
-  if [[ "$line" =~ $pattern ]]; then
-    printIdAsBinary "${BASH_REMATCH[1]//-/}"
-    break
-  fi
-done < <(eval "$cmd") > "$2"
diff --git a/eng/native/init-distro-rid.sh b/eng/native/init-distro-rid.sh
deleted file mode 100644 (file)
index 5f6b194..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-#!/usr/bin/env bash
-
-# initNonPortableDistroRid
-#
-# Input:
-#   targetOs: (str)
-#   buildArch: (str)
-#   isPortable: (int)
-#   rootfsDir: (str)
-#
-# Return:
-#   None
-#
-# Notes:
-#
-# initNonPortableDistroRid will attempt to initialize a non portable rid. These
-# rids are specific to distros need to build the product/package and consume
-# them on the same platform.
-#
-# If -portablebuild=false is passed a non-portable rid will be created for any
-# distro.
-#
-# It is important to note that the function does not return anything, but it
-# exports __DistroRid, if there is a non-portable distro rid to be used.
-#
-initNonPortableDistroRid()
-{
-    # Make sure out parameter is cleared.
-    __DistroRid=
-
-    local targetOs="$1"
-    local buildArch="$2"
-    local isPortable="$3"
-    local rootfsDir="$4"
-    local nonPortableBuildID=""
-
-    if [ "$targetOs" = "Linux" ]; then
-        if [ -e "${rootfsDir}/etc/os-release" ]; then
-            source "${rootfsDir}/etc/os-release"
-
-            # We have forced __PortableBuild=0. This is because -portablebuld
-            # has been passed as false.
-            if (( isPortable == 0 )); then
-                if [ "${ID}" = "rhel" ] || [ "${ID}" = "rocky" ]; then
-                    # remove the last version digit
-                    VERSION_ID="${VERSION_ID%.*}"
-                fi
-
-                if [ -z "${VERSION_ID+x}" ]; then
-                        # Rolling release distros do not set VERSION_ID, so omit
-                        # it here to be consistent with everything else.
-                        nonPortableBuildID="${ID}-${buildArch}"
-                else
-                        nonPortableBuildID="${ID}.${VERSION_ID}-${buildArch}"
-                fi
-            fi
-
-        elif [ -e "${rootfsDir}/android_platform" ]; then
-            source "$rootfsDir"/android_platform
-            nonPortableBuildID="$RID"
-        fi
-    fi
-
-    if [ "$targetOs" = "FreeBSD" ]; then
-        if (( isPortable == 0 )); then
-            # $rootfsDir can be empty. freebsd-version is shell script and it should always work.
-            __freebsd_major_version=$($rootfsDir/bin/freebsd-version | { read v; echo "${v%%.*}"; })
-            nonPortableBuildID="freebsd.$__freebsd_major_version-${buildArch}"
-        fi
-    elif command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then
-        __android_sdk_version=$(getprop ro.build.version.sdk)
-        nonPortableBuildID="android.$__android_sdk_version-${buildArch}"
-    elif [ "$targetOs" = "illumos" ]; then
-        __uname_version=$(uname -v)
-        case "$__uname_version" in
-            omnios-*)
-                __omnios_major_version=$(echo "${__uname_version:8:2}")
-                nonPortableBuildID=omnios."$__omnios_major_version"-"$buildArch"
-            ;;
-            joyent_*)
-                __smartos_major_version=$(echo "${__uname_version:7:4}")
-                nonPortableBuildID=smartos."$__smartos_major_version"-"$buildArch"
-            ;;
-            illumos_*)
-                nonPortableBuildID=openindiana-"$buildArch"
-            ;;
-        esac
-    elif [ "$targetOs" = "Solaris" ]; then
-        __uname_version=$(uname -v)
-        __solaris_major_version=$(echo "${__uname_version%.*}")
-        nonPortableBuildID=solaris."$__solaris_major_version"-"$buildArch"
-    fi
-
-    if [ -n "${nonPortableBuildID}" ]; then
-        __DistroRid="${nonPortableBuildID}"
-
-        # We are using a non-portable build rid. Force __PortableBuild to false.
-        __PortableBuild=0
-
-        export __DistroRid __PortableBuild
-    fi
-}
-
-# initDistroRidGlobal
-#
-# Input:
-#   os: (str)
-#   arch: (str)
-#   isPortable: (int)
-#   rootfsDir?: (nullable:string)
-#
-# Return:
-#   None
-#
-# Notes:
-#
-# It is important to note that the function does not return anything, but it
-# exports the following variables on success:
-#
-#   __DistroRid
-#   __PortableBuild
-#
-initDistroRidGlobal()
-{
-    # __DistroRid must be set at the end of the function.
-    # Previously we would create a variable __HostDistroRid and/or __DistroRid.
-    #
-    # __HostDistroRid was used in the case of a non-portable build, it has been
-    # deprecated. Now only __DistroRid is supported. It will be used for both
-    # portable and non-portable rids and will be used in build-packages.sh
-
-    local targetOs="$1"
-    local buildArch="$2"
-    local isPortable="$3"
-    local rootfsDir=""
-    if [ "$#" -ge 4 ]; then
-        rootfsDir="$4"
-    fi
-
-    if [ -n "${rootfsDir}" ]; then
-        # We may have a cross build. Check for the existance of the rootfsDir
-        if [ ! -e "${rootfsDir}" ]; then
-            echo "Error rootfsDir has been passed, but the location is not valid."
-            exit 1
-        fi
-    fi
-
-    initNonPortableDistroRid "${targetOs}" "${buildArch}" "${isPortable}" "${rootfsDir}"
-
-    if [ "$buildArch" = "wasm" ]; then
-        __DistroRid=browser-wasm
-        export __DistroRid
-    fi
-
-    if [ -z "${__DistroRid}" ]; then
-        # The non-portable build rid was not set. Set the portable rid.
-
-        __PortableBuild=1
-        export __PortableBuild
-        local distroRid=""
-
-        # Check for musl-based distros (e.g Alpine Linux, Void Linux).
-        if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl ||
-                strings "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl; then
-            distroRid="linux-musl-${buildArch}"
-        fi
-
-        if [ -z "${distroRid}" ]; then
-            if [ "$targetOs" = "Linux" ]; then
-                distroRid="linux-$buildArch"
-            elif [ "$targetOs" = "OSX" ]; then
-                distroRid="osx-$buildArch"
-            elif [ "$targetOs" = "MacCatalyst" ]; then
-                distroRid="maccatalyst-$buildArch"
-            elif [ "$targetOs" = "tvOS" ]; then
-                distroRid="tvos-$buildArch"
-            elif [ "$targetOs" = "tvOSSimulator" ]; then
-                distroRid="tvossimulator-$buildArch"
-            elif [ "$targetOs" = "iOS" ]; then
-                distroRid="ios-$buildArch"
-            elif [ "$targetOs" = "iOSSimulator" ]; then
-                distroRid="iossimulator-$buildArch"
-            elif [ "$targetOs" = "Android" ]; then
-                distroRid="android-$buildArch"
-            elif [ "$targetOs" = "Browser" ]; then
-                distroRid="browser-$buildArch"
-            elif [ "$targetOs" = "FreeBSD" ]; then
-                distroRid="freebsd-$buildArch"
-            elif [ "$targetOs" = "illumos" ]; then
-                distroRid="illumos-$buildArch"
-            elif [ "$targetOs" = "Solaris" ]; then
-                distroRid="solaris-$buildArch"
-            fi
-        fi
-
-        __DistroRid="${distroRid}"
-        export __DistroRid
-    fi
-
-    if [ -z "$__DistroRid" ]; then
-        echo "DistroRid is not set. This is almost certainly an error"
-        exit 1
-    fi
-
-    echo "__DistroRid: ${__DistroRid}"
-}
diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh
deleted file mode 100644 (file)
index fc4078f..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env bash
-
-# Use uname to determine what the OS is.
-OSName=$(uname -s)
-
-if command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then
-    OSName="Android"
-fi
-
-case "$OSName" in
-FreeBSD|Linux|NetBSD|OpenBSD|SunOS|Android)
-    os="$OSName" ;;
-Darwin)
-    os=OSX ;;
-*)
-    echo "Unsupported OS $OSName detected, configuring as if for Linux"
-    os=Linux ;;
-esac
-
-# On Solaris, `uname -m` is discouraged, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html
-# and `uname -p` returns processor type (e.g. i386 on amd64).
-# The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html.
-if [ "$os" = "SunOS" ]; then
-    if uname -o 2>&1 | grep -q illumos; then
-        os="illumos"
-    else
-        os="Solaris"
-    fi
-    CPUName=$(isainfo -n)
-else
-    # For the rest of the operating systems, use uname(1) to determine what the CPU is.
-    CPUName=$(uname -m)
-fi
-
-case "$CPUName" in
-    arm64|aarch64)
-        arch=arm64
-        ;;
-
-    amd64|x86_64)
-        arch=x64
-        ;;
-
-    armv7l)
-        if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
-            arch=armel
-        else
-            arch=arm
-        fi
-        ;;
-
-    i[3-6]86)
-        echo "Unsupported CPU $CPUName detected, build might not succeed!"
-        arch=x86
-        ;;
-
-    s390x)
-        arch=s390x
-       ;;
-
-    *)
-        echo "Unknown CPU $CPUName detected, configuring as if for x64"
-        arch=x64
-        ;;
-esac
diff --git a/eng/native/init-vs-env.cmd b/eng/native/init-vs-env.cmd
deleted file mode 100644 (file)
index 7eefeea..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-@if not defined _echo @echo off
-
-:: Initializes Visual Studio developer environment. If a build architecture is passed
-:: as an argument, it also initializes VC++ build environment and CMakePath.
-
-set "__VCBuildArch="
-if /i "%~1" == "x86"   (set __VCBuildArch=x86)
-if /i "%~1" == "x64"   (set __VCBuildArch=x86_amd64)
-if /i "%~1" == "arm"   (set __VCBuildArch=x86_arm)
-if /i "%~1" == "arm64" (set __VCBuildArch=x86_arm64)
-if /i "%~1" == "wasm"  (set __VCBuildArch=x86_amd64)
-
-:: Default to highest Visual Studio version available that has Visual C++ tools.
-::
-:: For VS2017 and later, multiple instances can be installed on the same box SxS and VS1*0COMNTOOLS
-:: is no longer set as a global environment variable and is instead only set if the user
-:: has launched the Visual Studio Developer Command Prompt.
-::
-:: Following this logic, we will default to the Visual Studio toolset assocated with the active
-:: Developer Command Prompt. Otherwise, we will query VSWhere to locate the later version of
-:: Visual Studio available on the machine. Finally, we will fail the script if no supported
-:: instance can be found.
-
-if defined VisualStudioVersion goto :VSDetected
-
-set "__VSWhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
-set "__VSCOMNTOOLS="
-
-if exist "%__VSWhere%" (
-    for /f "tokens=*" %%p in (
-        '"%__VSWhere%" -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath'
-    ) do set __VSCOMNTOOLS=%%p\Common7\Tools
-)
-
-if not exist "%__VSCOMNTOOLS%" goto :VSMissing
-
-:: Make sure the current directory stays intact
-set "VSCMD_START_DIR=%CD%"
-
-call "%__VSCOMNTOOLS%\VsDevCmd.bat" -no_logo
-
-:: Clean up helper variables
-set "__VSWhere="
-set "__VSCOMNTOOLS="
-set "VSCMD_START_DIR="
-
-:VSDetected
-if "%VisualStudioVersion%"=="16.0" (
-    set __VSVersion=vs2019
-    set __PlatformToolset=v142
-    goto :SetVCEnvironment
-)
-if "%VisualStudioVersion%"=="17.0" (
-    set __VSVersion=vs2022
-    set __PlatformToolset=v142
-    goto :SetVCEnvironment
-)
-
-:VSMissing
-echo %__MsgPrefix%Error: Visual Studio 2019 or 2022 with C++ tools required. ^
-Please see https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/windows-requirements.md for build requirements.
-exit /b 1
-
-:SetVCEnvironment
-
-if "%__VCBuildArch%"=="" exit /b 0
-
-:: Set the environment for the native build
-call "%VCINSTALLDIR%Auxiliary\Build\vcvarsall.bat" %__VCBuildArch%
-if not "%ErrorLevel%"=="0" exit /b 1
-
-set "__VCBuildArch="
-
-:: Set CMakePath by evaluating the output from set-cmake-path.ps1.
-:: In case of a failure the output is "exit /b 1".
-for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass -File "%~dp0set-cmake-path.ps1"') do %%a
diff --git a/eng/native/naming.props b/eng/native/naming.props
deleted file mode 100644 (file)
index 7a02d6c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<Project>
-  <PropertyGroup>
-    <StaticLibPrefix>lib</StaticLibPrefix>
-  </PropertyGroup>
-
-  <!-- Add path globs specific to native binaries to exclude unnecessary files from packages. -->
-  <Choose>
-    <When Condition="$(PackageRID.StartsWith('win'))">
-      <PropertyGroup>
-        <ExeSuffix>.exe</ExeSuffix>
-        <LibSuffix>.dll</LibSuffix>
-        <StaticLibSuffix>.lib</StaticLibSuffix>
-        <SymbolsSuffix>.pdb</SymbolsSuffix>
-      </PropertyGroup>
-    </When>
-    <When Condition="$(PackageRID.StartsWith('osx'))">
-      <PropertyGroup>
-        <LibPrefix Condition=" '$(SkipLibraryPrefixFromUnix)' == '' ">lib</LibPrefix>
-        <LibSuffix>.dylib</LibSuffix>
-        <StaticLibSuffix>.a</StaticLibSuffix>
-        <SymbolsSuffix>.dwarf</SymbolsSuffix>
-      </PropertyGroup>
-    </When>
-    <When Condition="$(PackageRID.StartsWith('android'))">
-      <PropertyGroup>
-        <LibPrefix Condition=" '$(SkipLibraryPrefixFromUnix)' == '' ">lib</LibPrefix>
-        <LibSuffix>.so</LibSuffix>
-        <StaticLibSuffix>.a</StaticLibSuffix>
-        <!--symbols included in .so, like Linux, but can be generated externally and if so, uses .debug ext-->
-        <SymbolsSuffix>.debug</SymbolsSuffix>
-      </PropertyGroup>
-    </When>
-    <Otherwise>
-      <PropertyGroup>
-        <LibPrefix Condition=" '$(SkipLibraryPrefixFromUnix)' == '' ">lib</LibPrefix>
-        <LibSuffix>.so</LibSuffix>
-        <StaticLibSuffix>.a</StaticLibSuffix>
-        <SymbolsSuffix>.dbg</SymbolsSuffix>
-      </PropertyGroup>
-    </Otherwise>
-  </Choose>
-
-  <ItemGroup>
-    <AdditionalLibPackageExcludes Condition="'$(SymbolsSuffix)' != ''" Include="%2A%2A\%2A$(SymbolsSuffix)" />
-    <AdditionalSymbolPackageExcludes Condition="'$(LibSuffix)' != ''" Include="%2A%2A\%2A.a;%2A%2A\%2A$(LibSuffix)" />
-  </ItemGroup>
-
-  <!-- arcade is using long name for this property; 'SymbolFileExtension'.
-       remove this property group when arcade is updated with short name (SymbolsSuffix). -->
-  <PropertyGroup>
-    <SymbolFileExtension>$(SymbolsSuffix)</SymbolFileExtension>
-  </PropertyGroup>
-
-</Project>
diff --git a/eng/native/output-toolchain-info.cmake b/eng/native/output-toolchain-info.cmake
deleted file mode 100644 (file)
index 8eed988..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Output the toolchain information required to create a command line that builds with the right rootfs as XML
-
-set (ADDED_COMPILE_OPTIONS)
-if (CMAKE_SCRIPT_MODE_FILE)
-  # add_compile_options and add_definitions can't be used in scripts,
-  # so override the implementations to append to a local property
-  macro(add_compile_options)
-    list(APPEND ADDED_COMPILE_OPTIONS ${ARGV})
-  endmacro()
-  macro(add_definitions)
-    list(APPEND ADDED_COMPILE_OPTIONS ${ARGV})
-  endmacro()
-endif()
-
-include(${CMAKE_CURRENT_LIST_DIR}/../common/cross/toolchain.cmake)
-
-message("<toolchain-info>")
-message("<target-triple>${TOOLCHAIN}</target-triple>")
-message("<linker-args>${CMAKE_SHARED_LINKER_FLAGS_INIT}</linker-args>")
-message("<compiler-args>${ADDED_COMPILE_OPTIONS}</compiler-args>")
-message("</toolchain-info>")
\ No newline at end of file
diff --git a/eng/native/sanitizerblacklist.txt b/eng/native/sanitizerblacklist.txt
deleted file mode 100644 (file)
index ecc8bef..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file has exclusions to the Clang address sanitizer to suppress error reports
-# When Clang 3.8 is available, convert these to suppression list instead as that is preferred for internal code
-
-# CMiniMdBase::UsesAllocatedMemory - suppress stack-buffer-underflow (code backs up pointer by -1 to check allocation ownership)
-fun:_ZN11CMiniMdBase19UsesAllocatedMemoryEP11CMiniColDef
-
-# JIT_InitPInvokeFrame - suppress unknown sanitizer issue causing SEGV on unknown address 0x000000000000
-# 0 0x4e8a0c in __ubsan::checkDynamicType(void*, void*, unsigned long)
-# 1 0x4e807f in HandleDynamicTypeCacheMiss(__ubsan::DynamicTypeCacheMissData*, unsigned long, unsigned long, __ubsan::ReportOptions)
-# 2 0x4e8051 in __ubsan_handle_dynamic_type_cache_miss
-# 3 0x7f02ce676cd8 in JIT_InitPInvokeFrame(InlinedCallFrame*, void*) /home/steveharter/git/dotnet_coreclr/vm/jithelpers.cpp:6491:9
-# 4 0x7f0252bbceb2  (<unknown module>)
-fun:_Z20JIT_InitPInvokeFrameP16InlinedCallFramePv
-
diff --git a/eng/native/set-cmake-path.ps1 b/eng/native/set-cmake-path.ps1
deleted file mode 100644 (file)
index d83ce5a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# This script locates the CMake executable for the build system and outputs either the "set CMakePath=..."
-# command (if CMake is found) or the "exit /b 1" command (if not found) for evaluating from batch files.
-
-Set-StrictMode -Version 3
-
-function LocateCMake {
-  # Find the first cmake.exe on the PATH
-  $cmakeApp = (Get-Command cmake.exe -ErrorAction SilentlyContinue)
-  if ($cmakeApp -ne $null) {
-    return $cmakeApp.Path
-  }
-
-  # Find cmake.exe using the registry
-  $cmakeRegKey = Get-ItemProperty HKLM:\SOFTWARE\Kitware\CMake -Name InstallDir -ErrorAction SilentlyContinue
-  if ($cmakeRegKey -eq $null) {
-    $cmakeRegKey = Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Kitware\CMake -Name InstallDir -ErrorAction SilentlyContinue
-  }
-
-  if ($cmakeRegKey -ne $null) {
-    $cmakePath = $cmakeRegKey.InstallDir + "bin\cmake.exe"
-    if (Test-Path $cmakePath -PathType Leaf) {
-      return $cmakePath
-    }
-  }
-
-  return $null
-}
-
-try {
-  $cmakePath = LocateCMake
-
-  if ($cmakePath -eq $null) {
-    throw "CMake is a pre-requisite to build this repository but it was not found on the PATH or in the registry. Please install CMake from https://cmake.org/download/."
-  }
-
-  $version = [Version]$(& $cmakePath --version | Select-String -Pattern '\d+\.\d+\.\d+' | %{$_.Matches.Value})
-
-  if ($version -lt [Version]"3.16.4") {
-    throw "CMake 3.16.4 or newer is required for building this repository. The newest version of CMake installed is $version. Please install CMake 3.16.4 or newer from https://cmake.org/download/."
-  }
-
-  [System.Console]::WriteLine("set CMakePath=" + $cmakePath)
-
-}
-catch {
-  [System.Console]::Error.WriteLine($_.Exception.Message)
-  [System.Console]::WriteLine("exit /b 1")
-}
diff --git a/eng/native/tryrun.cmake b/eng/native/tryrun.cmake
deleted file mode 100644 (file)
index 9619996..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
-set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH})
-
-macro(set_cache_value)
-  set(${ARGV0} ${ARGV1} CACHE STRING "Result from TRY_RUN" FORCE)
-  set(${ARGV0}__TRYRUN_OUTPUT "dummy output" CACHE STRING "Output from TRY_RUN" FORCE)
-endmacro()
-
-if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv7-alpine-linux-musleabihf OR
-   EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf OR
-   EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl)
-
-  set(ALPINE_LINUX 1)
-elseif(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version)
-  set(FREEBSD 1)
-  set(CMAKE_SYSTEM_NAME FreeBSD)
-  set(CLR_CMAKE_TARGET_OS FreeBSD)
-elseif(EXISTS ${CROSS_ROOTFS}/usr/platform/i86pc)
-  set(ILLUMOS 1)
-  set(CLR_CMAKE_TARGET_OS SunOS)
-elseif(EXISTS /System/Library/CoreServices)
-  set(DARWIN 1)
-endif()
-
-if(DARWIN)
-  if(TARGET_ARCH_NAME MATCHES "^(arm64|x64)$")
-    set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1)
-    set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 1)
-    set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 1)
-    set_cache_value(HAVE_BROKEN_FIFO_KEVENT_EXITCODE 1)
-    set_cache_value(HAVE_BROKEN_FIFO_SELECT_EXITCODE 1)
-    set_cache_value(HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE 1)
-    set_cache_value(HAVE_CLOCK_MONOTONIC_EXITCODE 0)
-    set_cache_value(HAVE_CLOCK_REALTIME_EXITCODE 0)
-    set_cache_value(HAVE_CLOCK_THREAD_CPUTIME_EXITCODE 0)
-    set_cache_value(HAVE_CLOCK_GETTIME_NSEC_NP_EXITCODE 0)
-    set_cache_value(HAVE_COMPATIBLE_ACOS_EXITCODE 0)
-    set_cache_value(HAVE_COMPATIBLE_ASIN_EXITCODE 0)
-    set_cache_value(HAVE_COMPATIBLE_ATAN2_EXITCODE 0)
-    set_cache_value(HAVE_COMPATIBLE_EXP_EXITCODE 1)
-    set_cache_value(HAVE_COMPATIBLE_ILOGB0_EXITCODE 0)
-    set_cache_value(HAVE_COMPATIBLE_ILOGBNAN_EXITCODE 1)
-    set_cache_value(HAVE_COMPATIBLE_LOG10_EXITCODE 0)
-    set_cache_value(HAVE_COMPATIBLE_LOG_EXITCODE 0)
-    set_cache_value(HAVE_COMPATIBLE_POW_EXITCODE 0)
-    set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 1)
-    set_cache_value(HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE 0)
-    set_cache_value(HAVE_MMAP_DEV_ZERO_EXITCODE 1)
-    set_cache_value(HAVE_PROCFS_CTL_EXITCODE 1)
-    set_cache_value(HAVE_PROCFS_MAPS_EXITCODE 1)
-    set_cache_value(HAVE_PROCFS_STATUS_EXITCODE 1)
-    set_cache_value(HAVE_PROCFS_STAT_EXITCODE 1)
-    set_cache_value(HAVE_SCHED_GETCPU_EXITCODE 1)
-    set_cache_value(HAVE_SCHED_GET_PRIORITY_EXITCODE 0)
-    set_cache_value(HAVE_VALID_NEGATIVE_INF_POW_EXITCODE 0)
-    set_cache_value(HAVE_VALID_POSITIVE_INF_POW_EXITCODE 0)
-    set_cache_value(HAVE_WORKING_CLOCK_GETTIME_EXITCODE 0)
-    set_cache_value(HAVE_WORKING_GETTIMEOFDAY_EXITCODE 0)
-    set_cache_value(MMAP_ANON_IGNORES_PROTECTION_EXITCODE 1)
-    set_cache_value(ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS_EXITCODE 1)
-    set_cache_value(PTHREAD_CREATE_MODIFIES_ERRNO_EXITCODE 1)
-    set_cache_value(REALPATH_SUPPORTS_NONEXISTENT_FILES_EXITCODE 1)
-    set_cache_value(SEM_INIT_MODIFIES_ERRNO_EXITCODE 1)
-    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)
-  else()
-    message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!")
-  endif()
-elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|s390x|x86)$" OR FREEBSD OR ILLUMOS)
-  set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1)
-  set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 0)
-  set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 0)
-  set_cache_value(HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE 0)
-  set_cache_value(HAVE_CLOCK_MONOTONIC_EXITCODE 0)
-  set_cache_value(HAVE_CLOCK_REALTIME_EXITCODE 0)
-  set_cache_value(HAVE_CLOCK_THREAD_CPUTIME_EXITCODE 0)
-  set_cache_value(HAVE_COMPATIBLE_ACOS_EXITCODE 0)
-  set_cache_value(HAVE_COMPATIBLE_ASIN_EXITCODE 0)
-  set_cache_value(HAVE_COMPATIBLE_ATAN2_EXITCODE 0)
-  set_cache_value(HAVE_COMPATIBLE_ILOGB0_EXITCODE 1)
-  set_cache_value(HAVE_COMPATIBLE_ILOGBNAN_EXITCODE 1)
-  set_cache_value(HAVE_COMPATIBLE_LOG10_EXITCODE 0)
-  set_cache_value(HAVE_COMPATIBLE_LOG_EXITCODE 0)
-  set_cache_value(HAVE_COMPATIBLE_POW_EXITCODE 0)
-  set_cache_value(HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE 0)
-  set_cache_value(HAVE_MMAP_DEV_ZERO_EXITCODE 0)
-  set_cache_value(HAVE_PROCFS_CTL_EXITCODE 1)
-  set_cache_value(HAVE_PROCFS_MAPS_EXITCODE 0)
-  set_cache_value(HAVE_PROCFS_STATUS_EXITCODE 0)
-  set_cache_value(HAVE_PROCFS_STAT_EXITCODE 0)
-  set_cache_value(HAVE_SCHED_GETCPU_EXITCODE 0)
-  set_cache_value(HAVE_SCHED_GET_PRIORITY_EXITCODE 0)
-  set_cache_value(HAVE_VALID_NEGATIVE_INF_POW_EXITCODE 0)
-  set_cache_value(HAVE_VALID_POSITIVE_INF_POW_EXITCODE 0)
-  set_cache_value(HAVE_WORKING_CLOCK_GETTIME_EXITCODE 0)
-  set_cache_value(HAVE_WORKING_GETTIMEOFDAY_EXITCODE 0)
-  set_cache_value(ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS_EXITCODE 1)
-  set_cache_value(PTHREAD_CREATE_MODIFIES_ERRNO_EXITCODE 1)
-  set_cache_value(REALPATH_SUPPORTS_NONEXISTENT_FILES_EXITCODE 1)
-  set_cache_value(SEM_INIT_MODIFIES_ERRNO_EXITCODE 1)
-
-
-  if(ALPINE_LINUX)
-    set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 1)
-    set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 0)
-    set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 1)
-    set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 1)
-  else()
-    set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 0)
-    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 0)
-  endif()
-
-  if (FREEBSD)
-    set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP 1)
-    set_cache_value(HAVE_CLOCK_MONOTONIC 1)
-    set_cache_value(HAVE_CLOCK_REALTIME 1)
-    set_cache_value(HAVE_BROKEN_FIFO_KEVENT_EXITCODE 1)
-    set_cache_value(HAVE_PROCFS_MAPS 0)
-    set_cache_value(HAVE_PROCFS_STAT 0)
-    set_cache_value(HAVE_PROCFS_STATUS_EXITCODE 1)
-    set_cache_value(GETPWUID_R_SETS_ERRNO 0)
-    set_cache_value(UNGETC_NOT_RETURN_EOF 0)
-    set_cache_value(HAVE_COMPATIBLE_ILOGBNAN 1)
-    set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
-  elseif(ILLUMOS)
-    set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 1)
-    set_cache_value(HAVE_COMPATIBLE_ACOS_EXITCODE 1)
-    set_cache_value(HAVE_COMPATIBLE_ASIN_EXITCODE 1)
-    set_cache_value(HAVE_COMPATIBLE_ATAN2_EXITCODE 1)
-    set_cache_value(HAVE_COMPATIBLE_POW_EXITCODE 1)
-    set_cache_value(HAVE_COMPATIBLE_ILOGBNAN_EXITCODE 0)
-    set_cache_value(HAVE_COMPATIBLE_LOG10_EXITCODE 1)
-    set_cache_value(HAVE_COMPATIBLE_LOG_EXITCODE 1)
-    set_cache_value(HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE 1)
-    set_cache_value(HAVE_PROCFS_CTL_EXITCODE 0)
-    set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 1)
-    set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 1)
-    set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 0)
-    set_cache_value(COMPILER_SUPPORTS_W_CLASS_MEMACCESS 1)
-    set_cache_value(HAVE_SET_MAX_VARIABLE 1)
-    set_cache_value(HAVE_FULLY_FEATURED_PTHREAD_MUTEXES 1)
-    set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
-  endif()
-else()
-  message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, s390x and x86 are supported!")
-endif()
-
-if(TARGET_ARCH_NAME STREQUAL "x86" OR TARGET_ARCH_NAME STREQUAL "s390x")
-  set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
-endif()
diff --git a/eng/native/version/NativeVersion.rc b/eng/native/version/NativeVersion.rc
deleted file mode 100644 (file)
index 618bb11..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "_version.h"
-
-#include <windows.h>
-
-VS_VERSION_INFO VERSIONINFO
-FILEVERSION     VER_FILEVERSION
-PRODUCTVERSION  VER_PRODUCTVERSION
-FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
-FILEFLAGS       VER_DEBUG
-FILEOS          VOS__WINDOWS32
-FILETYPE        VFT_DLL
-FILESUBTYPE     VFT2_UNKNOWN
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904E4"
-        BEGIN
-            VALUE "CompanyName",      VER_COMPANYNAME_STR
-            VALUE "FileDescription",  VER_FILEDESCRIPTION_STR
-            VALUE "FileVersion",      VER_FILEVERSION_STR
-            VALUE "InternalName",     VER_INTERNALNAME_STR
-            VALUE "LegalCopyright",   VER_LEGALCOPYRIGHT_STR
-            VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
-            VALUE "ProductName",      VER_PRODUCTNAME_STR
-            VALUE "ProductVersion",   VER_PRODUCTVERSION_STR
-        END
-    END
-
-    BLOCK "VarFileInfo"
-    BEGIN
-        /* The following line should only be modified for localized versions.     */
-        /* It consists of any number of WORD,WORD pairs, with each pair           */
-        /* describing a language,codepage combination supported by the file.      */
-        /*                                                                        */
-        /* For example, a file might have values "0x409,1252" indicating that it  */
-        /* supports English language (0x409) in the Windows ANSI codepage (1252). */
-
-        VALUE "Translation", 0x409, 1252
-
-    END
-END
diff --git a/eng/native/version/_version.c b/eng/native/version/_version.c
deleted file mode 100644 (file)
index 153d9f0..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-static char sccsid[] __attribute__((used)) = "@(#)No version information produced";
diff --git a/eng/native/version/_version.h b/eng/native/version/_version.h
deleted file mode 100644 (file)
index 25268bf..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef VER_COMPANYNAME_STR
-#define VER_COMPANYNAME_STR         ".NET Foundation"
-#endif
-#ifndef VER_FILEDESCRIPTION_STR
-#define VER_FILEDESCRIPTION_STR     ".NET Runtime"
-#endif
-#ifndef VER_INTERNALNAME_STR
-#define VER_INTERNALNAME_STR        VER_FILEDESCRIPTION_STR
-#endif
-#ifndef VER_ORIGINALFILENAME_STR
-#define VER_ORIGINALFILENAME_STR    VER_FILEDESCRIPTION_STR
-#endif
-#ifndef VER_PRODUCTNAME_STR
-#define VER_PRODUCTNAME_STR         ".NET"
-#endif
-#undef VER_PRODUCTVERSION
-#define VER_PRODUCTVERSION          00,00,00,00000
-#undef VER_PRODUCTVERSION_STR
-#define VER_PRODUCTVERSION_STR      "0.0.0"
-#undef VER_FILEVERSION
-#define VER_FILEVERSION             00,00,00,00000
-#undef VER_FILEVERSION_STR
-#define VER_FILEVERSION_STR         "00,00,00,00000"
-#ifndef VER_LEGALCOPYRIGHT_STR
-#define VER_LEGALCOPYRIGHT_STR      ".NET Foundation"
-#endif
-#ifndef VER_DEBUG
-#define VER_DEBUG                   VS_FF_DEBUG
-#endif
diff --git a/eng/native/version/copy_version_files.cmd b/eng/native/version/copy_version_files.cmd
deleted file mode 100644 (file)
index ef5f31e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-@if not defined _echo @echo off
-setlocal EnableDelayedExpansion EnableExtensions
-
-set __VersionFolder=%~dp0
-set __RepoRoot=%~dp0..\..\..
-set __artifactsObjDir=%__RepoRoot%\artifacts\obj
-
-for /r "%__VersionFolder%" %%a in (*.h *.rc) do (
-    if not exist "%__artifactsObjDir%\%%~nxa" (
-        copy "%%a" "%__artifactsObjDir%"
-    )
-)
diff --git a/eng/native/version/copy_version_files.sh b/eng/native/version/copy_version_files.sh
deleted file mode 100755 (executable)
index d60ed47..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-
-__VersionFolder="$(cd "$(dirname "$0")"; pwd -P)"
-__RepoRoot="$(cd "$(dirname "$__VersionFolder")/../../"; pwd -P)"
-
-for path in "${__VersionFolder}/"*{.h,.c}; do
-    if [[ "$(basename $path)" == _version.c ]]; then
-        # For _version.c, update the commit ID if it has changed from the last build.
-        # Set IFS to nothing to prevent the shell from combining all of the piped output into a single line in the script below
-        IFS=
-        # update commit
-        commit="$(git rev-parse HEAD 2>/dev/null)"
-        commit="${commit:-N/A}"
-        substitute="$(printf 'static char sccsid[] __attribute__((used)) = "@(#)Version N/A @Commit: %s";\n' "$commit")"
-        version_file_contents="$(cat "$path" | sed "s|^static.*|$substitute|")"
-        version_file_destination="$__RepoRoot/artifacts/obj/_version.c"
-        current_contents=
-        is_placeholder_file=
-        if [[ -e "$version_file_destination" ]]; then
-            current_contents="$(<"$__RepoRoot/artifacts/obj/_version.c")"
-            # If the current file has the version placeholder this script uses, we can update it
-            # to have the current commit. Otherwise, use the current version file that has the actual product version.
-            is_placeholder_file="$(echo $current_contents | grep "@(#)Version N/A @Commit:")"
-        else
-            # Treat a non-existent file like a file that doesn't exist.
-            is_placeholder_file=1
-        fi
-        if [[ "$is_placeholder_file" && "$version_file_contents" != "$current_contents" ]]; then
-            echo "$version_file_contents" > "$version_file_destination"
-        fi
-    elif [[ ! -e "$__RepoRoot/artifacts/obj/$(basename "$path")" ]]; then
-        cp "$path" "$__RepoRoot/artifacts/obj/"
-    fi
-done
diff --git a/eng/native/version/runtime_version.h b/eng/native/version/runtime_version.h
deleted file mode 100644 (file)
index 12b55fe..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#define RuntimeAssemblyMajorVersion 0
-#define RuntimeAssemblyMinorVersion 0
-#define RuntimeFileMajorVersion 0
-#define RuntimeFileMinorVersion 0
-#define RuntimeFileBuildVersion 0
-#define RuntimeFileRevisionVersion 0
-#define RuntimeProductMajorVersion 0
-#define RuntimeProductMinorVersion 0
-#define RuntimeProductPatchVersion 0
-#define RuntimeProductVersion 0.0.0-dev
index 69b7189cce397877de8e61aafcbb8570ef2c2315..92412258837c29624bb2d91822853a3290aa292f 100644 (file)
         "name": "dotnet-stack",
         "rids": ["win-x64", "win-x86", "win-arm", "win-arm64", "linux-x64", "linux-musl-arm64", "osx-x64", "linux-arm64", "linux-musl-x64", "linux-arm"]
       }
-      {
-        "name": "dotnet-dsrouter",
-        "rids": ["win-x64", "win-x86", "win-arm", "win-arm64", "linux-x64", "linux-musl-arm64", "osx-x64", "linux-arm64", "linux-musl-x64", "linux-arm"]
-      }
     ]
   },
   "NugetAssets": {
@@ -40,7 +36,6 @@
       "dotnet-sos",
       "dotnet-trace",
       "dotnet-stack",
-      "dotnet-dsrouter",
       "Microsoft.Diagnostics.NETCore.Client"
     ]
   }
diff --git a/eng/setup-vs-tools.cmd b/eng/setup-vs-tools.cmd
new file mode 100644 (file)
index 0000000..c5edf5f
--- /dev/null
@@ -0,0 +1,42 @@
+@if not defined _echo @echo off
+
+REM This script is responsible for setting up the vs2017 or vs2019 env
+REM All passed arguments are ignored
+REM Script will return with 0 if pass, 1 if there is a failure to find either
+REM vs2017 or vs2019
+
+:: Default to highest Visual Studio version available
+::
+:: For VS2017 and later, multiple instances can be installed on the same box SxS and VS1*0COMNTOOLS
+:: is no longer set as a global environment variable and is instead only set if the user
+:: has launched the Visual Studio Developer Command Prompt.
+::
+:: Following this logic, we will default to the Visual Studio toolset assocated with the active
+:: Developer Command Prompt. Otherwise, we will query VSWhere to locate the later version of
+:: Visual Studio available on the machine. Finally, we will fail the script if not supported
+:: instance can be found.
+
+if defined VisualStudioVersion (
+    if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment
+    goto skip_setup
+)
+
+echo %__MsgPrefix%Searching ^for Visual Studio 2017 or later installation
+set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
+if exist %_VSWHERE% (
+    for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
+    goto call_vs
+)
+echo Visual Studio 2017 or later not found
+:call_vs
+if not exist "%_VSCOMNTOOLS%" (
+    echo %__MsgPrefix%Error: Visual Studio 2017 or 2019 required.
+    echo        Please see https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/windows-instructions.md for build instructions.
+    exit /b 1
+)
+echo %__MsgPrefix%"%_VSCOMNTOOLS%\VsDevCmd.bat"
+call "%_VSCOMNTOOLS%\VsDevCmd.bat"
+
+:skip_setup
+
+exit /b 0
diff --git a/eng/windows-compiler-override.txt b/eng/windows-compiler-override.txt
new file mode 100644 (file)
index 0000000..f6cb168
--- /dev/null
@@ -0,0 +1,16 @@
+SET (CMAKE_C_FLAGS_INIT                "/Wall /FC")
+SET (CMAKE_C_FLAGS_DEBUG_INIT          "/Od /Zi")
+SET (CLR_C_FLAGS_CHECKED_INIT          "/O1 /Zi")
+SET (CMAKE_C_FLAGS_RELEASE_INIT        "/Ox /Zi")
+SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/O2 /Zi")
+
+SET (CMAKE_CXX_FLAGS_INIT                "/Wall /FC")
+SET (CMAKE_CXX_FLAGS_DEBUG_INIT          "/Od /Zi")
+SET (CLR_CXX_FLAGS_CHECKED_INIT          "/O1 /Zi")
+SET (CMAKE_CXX_FLAGS_RELEASE_INIT        "/Ox /Zi")
+SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/O2 /Zi")
+
+SET (CLR_DEFINES_DEBUG_INIT              DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1)
+SET (CLR_DEFINES_CHECKED_INIT            DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1)
+SET (CLR_DEFINES_RELEASE_INIT            NDEBUG URTBLDENV_FRIENDLY=Retail)
+SET (CLR_DEFINES_RELWITHDEBINFO_INIT     NDEBUG URTBLDENV_FRIENDLY=Retail)
\ No newline at end of file
diff --git a/functions.cmake b/functions.cmake
new file mode 100644 (file)
index 0000000..d952e22
--- /dev/null
@@ -0,0 +1,195 @@
+# Copyright (c) .NET Foundation and contributors. All rights reserved.
+# Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+function(clr_unknown_arch)
+    if (WIN32)
+        message(FATAL_ERROR "Only AMD64, ARM64, ARM and I386 are supported")
+    elseif(CLR_CROSS_COMPONENTS_BUILD)
+        message(FATAL_ERROR "Only AMD64, I386 host are supported for linux cross-architecture component")
+    else()
+        message(FATAL_ERROR "Only AMD64, ARM64 and ARM are supported")
+    endif()
+endfunction()
+
+# Build a list of compiler definitions by putting -D in front of each define.
+function(get_compile_definitions DefinitionName)
+    # Get the current list of definitions
+    get_directory_property(COMPILE_DEFINITIONS_LIST COMPILE_DEFINITIONS)
+
+    foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST)
+        if (${DEFINITION} MATCHES "^\\$<\\$<CONFIG:([^>]+)>:([^>]+)>$")
+            # The entries that contain generator expressions must have the -D inside of the
+            # expression. So we transform e.g. $<$<CONFIG:Debug>:_DEBUG> to $<$<CONFIG:Debug>:-D_DEBUG>
+            set(DEFINITION "$<$<CONFIG:${CMAKE_MATCH_1}>:-D${CMAKE_MATCH_2}>")
+        else()
+            set(DEFINITION -D${DEFINITION})
+        endif()
+        list(APPEND DEFINITIONS ${DEFINITION})
+    endforeach()
+    set(${DefinitionName} ${DEFINITIONS} PARENT_SCOPE)
+endfunction(get_compile_definitions)
+
+# Build a list of include directories
+function(get_include_directories IncludeDirectories)
+    get_directory_property(dirs INCLUDE_DIRECTORIES)
+    foreach(dir IN LISTS dirs)
+
+      if (CLR_CMAKE_PLATFORM_ARCH_ARM AND WIN32)
+        list(APPEND INC_DIRECTORIES /I${dir})
+      else()
+        list(APPEND INC_DIRECTORIES -I${dir})
+      endif(CLR_CMAKE_PLATFORM_ARCH_ARM AND WIN32)
+
+    endforeach()
+    set(${IncludeDirectories} ${INC_DIRECTORIES} PARENT_SCOPE)
+endfunction(get_include_directories)
+
+# Set the passed in RetSources variable to the list of sources with added current source directory
+# to form absolute paths.
+# The parameters after the RetSources are the input files.
+function(convert_to_absolute_path RetSources)
+    set(Sources ${ARGN})
+    foreach(Source IN LISTS Sources)
+        list(APPEND AbsolutePathSources ${CMAKE_CURRENT_SOURCE_DIR}/${Source})
+    endforeach()
+    set(${RetSources} ${AbsolutePathSources} PARENT_SCOPE)
+endfunction(convert_to_absolute_path)
+
+#Preprocess exports definition file
+function(preprocess_def_file inputFilename outputFilename)
+  get_compile_definitions(PREPROCESS_DEFINITIONS)
+  get_include_directories(ASM_INCLUDE_DIRECTORIES)
+  add_custom_command(
+    OUTPUT ${outputFilename}
+    COMMAND ${CMAKE_CXX_COMPILER} ${ASM_INCLUDE_DIRECTORIES} /P /EP /TC ${PREPROCESS_DEFINITIONS}  /Fi${outputFilename}  ${inputFilename}
+    DEPENDS ${inputFilename}
+    COMMENT "Preprocessing ${inputFilename} - ${CMAKE_CXX_COMPILER} ${ASM_INCLUDE_DIRECTORIES} /P /EP /TC ${PREPROCESS_DEFINITIONS}  /Fi${outputFilename}  ${inputFilename}"
+  )
+
+  set_source_files_properties(${outputFilename}
+                              PROPERTIES GENERATED TRUE)
+endfunction()
+function(generate_exports_file)
+  set(INPUT_LIST ${ARGN})
+  list(GET INPUT_LIST -1 outputFilename)
+  list(REMOVE_AT INPUT_LIST -1)
+
+  if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+    set(AWK_SCRIPT eng/generateexportedsymbols.awk)
+  else()
+    set(AWK_SCRIPT eng/generateversionscript.awk)
+  endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+  add_custom_command(
+    OUTPUT ${outputFilename}
+    COMMAND ${AWK} -f ${CMAKE_SOURCE_DIR}/${AWK_SCRIPT} ${INPUT_LIST} >${outputFilename}
+    DEPENDS ${INPUT_LIST} ${CMAKE_SOURCE_DIR}/${AWK_SCRIPT}
+    COMMENT "Generating exports file ${outputFilename}"
+  )
+  set_source_files_properties(${outputFilename}
+                              PROPERTIES GENERATED TRUE)
+endfunction()
+
+function(strip_symbols targetName outputFilename)
+  if (CLR_CMAKE_PLATFORM_UNIX)
+    if (STRIP_SYMBOLS)
+
+      # On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE
+      # generator expression doesn't work correctly returning the wrong path and on
+      # the newer cmake versions the LOCATION property isn't supported anymore.
+      if (CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
+          set(strip_source_file $<TARGET_FILE:${targetName}>)
+      else()
+          get_property(strip_source_file TARGET ${targetName} PROPERTY LOCATION)
+      endif()
+
+      if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
+        set(strip_destination_file ${strip_source_file}.dwarf)
+
+        add_custom_command(
+          TARGET ${targetName}
+          POST_BUILD
+          VERBATIM
+          COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file}
+          COMMAND ${STRIP} -S ${strip_source_file}
+          COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
+        )
+      else (CMAKE_SYSTEM_NAME STREQUAL Darwin)
+        set(strip_destination_file ${strip_source_file}.dbg)
+
+        add_custom_command(
+          TARGET ${targetName}
+          POST_BUILD
+          VERBATIM
+          COMMAND ${OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file}
+          COMMAND ${OBJCOPY} --strip-debug ${strip_source_file}
+          COMMAND ${OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file}
+          COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
+        )
+      endif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+      set(${outputFilename} ${strip_destination_file} PARENT_SCOPE)
+    endif (STRIP_SYMBOLS)
+  endif(CLR_CMAKE_PLATFORM_UNIX)
+endfunction()
+
+function(install_clr targetName)
+  list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX)
+  if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1)
+    strip_symbols(${targetName} strip_destination_file)
+    # On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE
+    # generator expression doesn't work correctly returning the wrong path and on
+    # the newer cmake versions the LOCATION property isn't supported anymore.
+    if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
+       set(install_source_file $<TARGET_FILE:${targetName}>)
+    else()
+        get_property(install_source_file TARGET ${targetName} PROPERTY LOCATION)
+    endif()
+
+    install(PROGRAMS ${install_source_file} DESTINATION .)
+    if(WIN32)
+        install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb DESTINATION .)
+    else()
+        install(FILES ${strip_destination_file} DESTINATION .)
+    endif()
+  endif()
+endfunction()
+
+function(_add_executable)
+    add_executable(${ARGV})
+    list(FIND CLR_CROSS_COMPONENTS_LIST ${ARGV0} INDEX)
+    if (DEFINED CLR_CROSS_COMPONENTS_LIST AND ${INDEX} EQUAL -1)
+     set_target_properties(${ARGV0} PROPERTIES EXCLUDE_FROM_ALL 1)
+    endif()
+endfunction()
+
+function(_add_library)
+    add_library(${ARGV})
+    list(FIND CLR_CROSS_COMPONENTS_LIST ${ARGV0} INDEX)
+    if (DEFINED CLR_CROSS_COMPONENTS_LIST AND ${INDEX} EQUAL -1)
+     set_target_properties(${ARGV0} PROPERTIES EXCLUDE_FROM_ALL 1)
+    endif()
+endfunction()
+
+function(add_library_clr)
+    if(NOT WIN32)
+      _add_library(${ARGV} ${VERSION_FILE_PATH})
+    else()
+      _add_library(${ARGV})
+    endif(NOT WIN32)
+endfunction()
+
+function(add_executable_clr)
+    if(NOT WIN32)
+      _add_executable(${ARGV} ${VERSION_FILE_PATH})
+    else()
+      _add_executable(${ARGV})
+    endif(NOT WIN32)
+endfunction()
+
+function(_install)
+    if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
+      install(${ARGV})
+    endif()
+endfunction()
+
index 52d43e032e9c24c9295fbbc97727fbf3ce51882b..01b98551999889c9271138c2a53c2e9e3dd03a81 100644 (file)
@@ -16,6 +16,6 @@
   },
   "msbuild-sdks": {
     "Microsoft.Build.NoTargets": "2.0.1",
-    "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21559.3"
+    "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21518.1"
   }
 }
index 5f5c4840f8d4abc4547148f06dad329f4329b013..9015d3d4d3d5e9c915c25f41bff5c6d661e46aec 100644 (file)
@@ -2,10 +2,10 @@ include_directories(${ROOT_DIR}/src/pal/prebuilt/inc)
 
 include_directories(inc)
 
-if (CLR_CMAKE_HOST_UNIX)
+if (CLR_CMAKE_PLATFORM_UNIX)
     add_subdirectory(palrt)
     add_subdirectory(pal)
-endif(CLR_CMAKE_HOST_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
 
 add_subdirectory(inc)
 add_subdirectory(SOS)
index b614a2fd56f3c3f7d41509cca6d20c916fa7ed0a..f75f3e1ddcacc0b98763f3aafc284e4686d91669 100644 (file)
@@ -2,6 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
+using Microsoft.Diagnostics.Runtime;
 using Microsoft.Diagnostics.Runtime.Utilities;
 using Microsoft.FileFormats;
 using Microsoft.FileFormats.ELF;
@@ -38,7 +39,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         private readonly IDisposable _onChangeEvent;
         private Flags _flags;
         private PdbFileInfo _pdbFileInfo;
-        protected ImmutableArray<byte> _buildId;
+        private ImmutableArray<byte> _buildId;
         private PEImage _peImage;
 
         public readonly ServiceProvider ServiceProvider;
@@ -90,16 +91,8 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         {
             get
             {
-                // For Windows targets, we can always assume that all the modules are PEs.
-                if (Target.OperatingSystem == OSPlatform.Windows)
-                {
-                    return true;
-                }
-                else
-                {
-                    GetPEInfo();
-                    return (_flags & Flags.IsPEImage) != 0;
-                }
+                GetPEInfo();
+                return (_flags & Flags.IsPEImage) != 0;
             }
         }
 
@@ -148,13 +141,13 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
             }
         }
 
-        public virtual ImmutableArray<byte> BuildId
+        public ImmutableArray<byte> BuildId
         {
             get
             {
                 if (_buildId.IsDefault)
                 {
-                    byte[] id = ModuleService.GetBuildId(ImageBase);
+                    byte[] id = ModuleService.GetBuildId(ImageBase, ImageSize);
                     if (id != null)
                     {
                         _buildId = id.ToImmutableArray();
@@ -180,7 +173,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         {
             if (Target.OperatingSystem == OSPlatform.Windows)
             {
-                Stream stream = ModuleService.MemoryService.CreateMemoryStream(ImageBase, ImageSize);
+                Stream stream = Target.Services.GetService<IMemoryService>().CreateMemoryStream(ImageBase, ImageSize);
                 PEFile image = new(new StreamAddressSpace(stream), isDataSourceVirtualAddressSpace: true);
                 if (image.IsValid())
                 { 
@@ -197,7 +190,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
             {
                 try
                 {
-                    Stream stream = ModuleService.MemoryService.CreateMemoryStream(ImageBase, ImageSize);
+                    Stream stream = Target.Services.GetService<IMemoryService>().CreateMemoryStream(ImageBase, ImageSize);
                     ElfFile elfFile = new(stream, position: ImageBase, leaveOpen: false, isVirtual: true);
                     if (elfFile.Header.IsValid)
                     {
index 253a2be6e1a61a6de168705c7ef6a66852dc15cc..2ddf823d8cf31296ae0bf47297c9a5f43baa2d6f 100644 (file)
@@ -39,7 +39,6 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         const uint VmProtWrite = 0x02;
 
         internal protected readonly ITarget Target;
-        internal protected IMemoryService RawMemoryService;
         private IMemoryService _memoryService;
         private ISymbolService _symbolService;
         private ReadVirtualCache _versionCache;
@@ -49,11 +48,10 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         private static readonly byte[] s_versionString = Encoding.ASCII.GetBytes("@(#)Version ");
         private static readonly int s_versionLength = s_versionString.Length;
 
-        public ModuleService(ITarget target, IMemoryService rawMemoryService)
+        public ModuleService(ITarget target)
         {
             Debug.Assert(target != null);
             Target = target;
-            RawMemoryService = rawMemoryService;
 
             target.OnFlushEvent.Register(() => {
                 _versionCache?.Clear();
@@ -120,7 +118,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         /// <returns>module or null</returns>
         IModule IModuleService.GetModuleFromAddress(ulong address)
         {
-            Debug.Assert((address & ~RawMemoryService.SignExtensionMask()) == 0);
+            Debug.Assert((address & ~MemoryService.SignExtensionMask()) == 0);
             IModule[] modules = GetSortedModules();
             int min = 0, max = modules.Length - 1;
 
@@ -131,7 +129,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
                 IModule module = modules[mid];
 
                 ulong start = module.ImageBase;
-                Debug.Assert((start & ~RawMemoryService.SignExtensionMask()) == 0);
+                Debug.Assert((start & ~MemoryService.SignExtensionMask()) == 0);
                 ulong end = start + module.ImageSize;
 
                 if (address >= start && address < end) {
@@ -240,7 +238,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         /// <returns>PEImage instance or null</returns>
         private PEImage GetPEInfo(bool isVirtual, ulong address, ulong size, ref PdbFileInfo pdbFileInfo, ref Module.Flags flags)
         {
-            Stream stream = RawMemoryService.CreateMemoryStream(address, size);
+            Stream stream = MemoryService.CreateMemoryStream(address, size);
             try
             {
                 stream.Position = 0;
@@ -520,16 +518,18 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         /// Returns the ELF module build id or the MachO module uuid
         /// </summary>
         /// <param name="address">module base address</param>
+        /// <param name="size">module size</param>
         /// <returns>build id or null</returns>
-        internal byte[] GetBuildId(ulong address)
+        internal byte[] GetBuildId(ulong address, ulong size)
         {
-            Stream stream = RawMemoryService.CreateMemoryStream();
+            Debug.Assert(size > 0);
+            Stream stream = MemoryService.CreateMemoryStream(address, size);
             byte[] buildId = null;
             try
             {
                 if (Target.OperatingSystem == OSPlatform.Linux)
                 {
-                    var elfFile = new ELFFile(new StreamAddressSpace(stream), address, true);
+                    var elfFile = new ELFFile(new StreamAddressSpace(stream), 0, true);
                     if (elfFile.IsValid())
                     {
                         buildId = elfFile.BuildID;
@@ -537,7 +537,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
                 }
                 else if (Target.OperatingSystem == OSPlatform.OSX)
                 {
-                    var machOFile = new MachOFile(new StreamAddressSpace(stream), address, true);
+                    var machOFile = new MachOFile(new StreamAddressSpace(stream), 0, true);
                     if (machOFile.IsValid())
                     {
                         buildId = machOFile.Uuid;
@@ -555,20 +555,21 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         /// Get the version string from a Linux or MacOS image
         /// </summary>
         /// <param name="address">image base</param>
+        /// <param name="size">image size</param>
         /// <returns>version string or null</returns>
-        protected string GetVersionString(ulong address)
+        protected string GetVersionString(ulong address, ulong size)
         {
-            Stream stream = RawMemoryService.CreateMemoryStream();
+            Stream stream = MemoryService.CreateMemoryStream(address, size);
             try
             {
                 if (Target.OperatingSystem == OSPlatform.Linux)
                 {
-                    var elfFile = new ELFFile(new StreamAddressSpace(stream), address, true);
+                    var elfFile = new ELFFile(new StreamAddressSpace(stream), 0, true);
                     if (elfFile.IsValid())
                     {
                         foreach (ELFProgramHeader programHeader in elfFile.Segments.Select((segment) => segment.Header))
                         {
-                            uint flags = RawMemoryService.PointerSize == 8 ? programHeader.Flags : programHeader.Flags32;
+                            uint flags = MemoryService.PointerSize == 8 ? programHeader.Flags : programHeader.Flags32;
                             if (programHeader.Type == ELFProgramHeaderType.Load &&
                                (flags & (uint)ELFProgramHeaderAttributes.Writable) != 0)
                             {
@@ -584,7 +585,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
                 }
                 else if (Target.OperatingSystem == OSPlatform.OSX)
                 {
-                    var machOFile = new MachOFile(new StreamAddressSpace(stream), address, true);
+                    var machOFile = new MachOFile(new StreamAddressSpace(stream), 0, true);
                     if (machOFile.IsValid())
                     {
                         foreach (MachSegmentLoadCommand loadCommand in machOFile.Segments.Select((segment) => segment.LoadCommand))
@@ -593,9 +594,9 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
                                (loadCommand.InitProt & VmProtWrite) != 0 && 
                                 loadCommand.SegName.ToString() != "__LINKEDIT")
                             {
-                                ulong loadAddress = loadCommand.VMAddress + machOFile.PreferredVMBaseAddress;
+                                ulong loadAddress = loadCommand.VMAddress;
                                 long loadSize = (long)loadCommand.VMSize;
-                                if (SearchVersionString(loadAddress, loadSize, out string productVersion))
+                                if (SearchVersionString(address + loadAddress, loadSize, out string productVersion))
                                 {
                                     return productVersion;
                                 }
@@ -627,8 +628,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
             byte[] buffer = new byte[s_versionString.Length];
 
             if (_versionCache == null) {
-                // We use the possibly mapped memory service to find the version string in case it isn't in the dump.
-                _versionCache = new ReadVirtualCache(Target.Services.GetService<IMemoryService>());
+                _versionCache = new ReadVirtualCache(MemoryService);
             }
             _versionCache.Clear();
 
@@ -690,11 +690,11 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
             else {
                 return string.Equals(Path.GetFileName(module.FileName), moduleName);
             }
-        } 
+        }
 
-        internal protected IMemoryService MemoryService => _memoryService ??= Target.Services.GetService<IMemoryService>();
+        protected IMemoryService MemoryService => _memoryService ??= Target.Services.GetService<IMemoryService>();
 
-        internal protected ISymbolService SymbolService => _symbolService ??= Target.Services.GetService<ISymbolService>(); 
+        protected ISymbolService SymbolService => _symbolService ??= Target.Services.GetService<ISymbolService>(); 
 
         /// <summary>
         /// Search memory helper class
index 7fd2e230ffa0c348935e4cd9bd25f96e448ba6cf..939ad8f6694840fe1fd98ee7cc2bd61ede66d37a 100644 (file)
@@ -5,8 +5,8 @@
 using Microsoft.Diagnostics.Runtime;
 using System;
 using System.Collections.Generic;
-using System.Collections.Immutable;
 using System.Diagnostics;
+using System.IO;
 using System.Linq;
 using System.Runtime.InteropServices;
 
@@ -22,7 +22,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
             // This is what clrmd returns for non-PE modules that don't have a timestamp
             private const uint InvalidTimeStamp = 0;
 
-            private static readonly VersionInfo EmptyVersionInfo = new (0, 0, 0, 0);
+            private static readonly Microsoft.Diagnostics.Runtime.VersionInfo EmptyVersionInfo = new (0, 0, 0, 0);
             private readonly ModuleServiceFromDataReader _moduleService;
             private readonly IExportReader _exportReader;
             private readonly ModuleInfo _moduleInfo;
@@ -54,20 +54,6 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
 
             public override uint? IndexTimeStamp => _moduleInfo.IndexTimeStamp == InvalidTimeStamp ? null : (uint)_moduleInfo.IndexTimeStamp;
 
-            public override ImmutableArray<byte> BuildId
-            {
-                get
-                {
-                    if (_buildId.IsDefault)
-                    {
-                        ImmutableArray<byte> buildId = _moduleService._dataReader.GetBuildId(ImageBase);
-                        // If the data reader can't get the build id, it returns a empty (instead of default) immutable array.
-                        _buildId = buildId.IsDefaultOrEmpty ? base.BuildId : buildId;
-                    }
-                    return _buildId;
-                }
-            }
-
             public override VersionData VersionData
             {
                 get 
@@ -98,7 +84,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
                     {
                         if (_moduleService.Target.OperatingSystem != OSPlatform.Windows && !IsPEImage)
                         {
-                            _versionString = _moduleService.GetVersionString(ImageBase);
+                            _versionString = _moduleService.GetVersionString(ImageBase, ImageSize);
                         }
                     }
                     return _versionString;
@@ -122,8 +108,8 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
 
         private readonly IDataReader _dataReader;
 
-        public ModuleServiceFromDataReader(ITarget target, IMemoryService rawMemoryService, IDataReader dataReader)
-            : base(target, rawMemoryService)
+        public ModuleServiceFromDataReader(ITarget target, IDataReader dataReader)
+            : base(target)
         {
             _dataReader = dataReader;
         }
index 55dbe636de6e4aada6b097a3d4c82ba58d67278e..493415975e380b11cab466e14fb3e4841c8ae2ce 100644 (file)
@@ -47,20 +47,13 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
             }
 
             // Add the thread, memory, and module services
-            IMemoryService rawMemoryService = new MemoryServiceFromDataReader(_dataReader);
             ServiceProvider.AddServiceFactory<IThreadService>(() => new ThreadServiceFromDataReader(this, _dataReader));
-            ServiceProvider.AddServiceFactory<IModuleService>(() => new ModuleServiceFromDataReader(this, rawMemoryService, _dataReader));
+            ServiceProvider.AddServiceFactory<IModuleService>(() => new ModuleServiceFromDataReader(this, _dataReader));
             ServiceProvider.AddServiceFactory<IMemoryService>(() => {
-                IMemoryService memoryService = rawMemoryService;
-                if (IsDump)
+                IMemoryService memoryService = new MemoryServiceFromDataReader(_dataReader);
+                if (IsDump && Host.HostType == HostType.DotnetDump)
                 {
                     memoryService = new ImageMappingMemoryService(this, memoryService);
-                    // Any dump created for a MacOS target does not have managed assemblies in the module service so
-                    // we need to use the metadata mapping memory service to make sure the metadata is available.
-                    if (targetOS == OSPlatform.OSX)
-                    {
-                        memoryService = new MetadataMappingMemoryService(this, memoryService);
-                    }
                 }
                 return memoryService;
             });
index 2674d567ac534281aa40f4969a2c5c298302e180..2fba2bb1c615d2bddc11453026f538be3c75a2c1 100644 (file)
@@ -104,27 +104,15 @@ namespace Microsoft.Diagnostics.DebugServices
             return false;
         }
 
-        /// <summary>
-        /// Create a stream for all of memory.
-        /// </summary>
-        /// <param name="memoryService">memory service instance</param>
-        /// <returns>Stream of all of memory</returns>
-        public static Stream CreateMemoryStream(this IMemoryService memoryService)
-        {
-            return new TargetStream(memoryService, 0, long.MaxValue);
-        }
-
         /// <summary>
         /// Create a stream for the address range.
         /// </summary>
         /// <param name="memoryService">memory service instance</param>
         /// <param name="address">address to read</param>
         /// <param name="size">size of stream</param>
-        /// <returns>memory range Stream</returns>
+        /// <returns></returns>
         public static Stream CreateMemoryStream(this IMemoryService memoryService, ulong address, ulong size)
         {
-            Debug.Assert(address != 0);
-            Debug.Assert(size != 0);
             return new TargetStream(memoryService, address, size);
         }
 
@@ -145,6 +133,8 @@ namespace Microsoft.Diagnostics.DebugServices
             public TargetStream(IMemoryService memoryService, ulong address, ulong size)
                 : base()
             {
+                Debug.Assert(address != 0);
+                Debug.Assert(size != 0);
                 _memoryService = memoryService;
                 _address = address;
                 Length = (long)size;
index b2e1b274e8376efb48995bb8156c6b4f399dcf28..87c39f69d8f92f89f5b8324d555d91e5a62d9d3b 100644 (file)
@@ -3,16 +3,8 @@
 // See the LICENSE file in the project root for more information.
 
 using Microsoft.Diagnostics.DebugServices;
-using Microsoft.FileFormats;
-using Microsoft.FileFormats.ELF;
-using Microsoft.FileFormats.MachO;
-using System;
-using System.Diagnostics;
 using System.Diagnostics.Tracing;
-using System.IO;
 using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text.RegularExpressions;
 
 namespace Microsoft.Diagnostics.ExtensionCommands
 {
@@ -22,107 +14,38 @@ namespace Microsoft.Diagnostics.ExtensionCommands
         [Option(Name = "--verbose", Aliases = new string[] { "-v" }, Help = "Displays more details.")]
         public bool Verbose { get; set; }
 
-        [Option(Name = "--segments", Aliases = new string[] { "-s" }, Help = "Displays the module segments.")]
-        public bool Segment { get; set; }
-
-
-        [Option(Name = "--name", Aliases = new string[] { "-n" }, Help = "RegEx filter on module name (path not included).")]
-        public string ModuleName { get; set; }
-
         public IModuleService ModuleService { get; set; }
 
         public override void Invoke()
         {
-            Regex regex = ModuleName is not null ? new Regex(ModuleName, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant) : null;
             ulong totalSize = 0;
-
             foreach (IModule module in ModuleService.EnumerateModules().OrderBy((m) => m.ModuleIndex))
             {
                 totalSize += module.ImageSize;
-                if (regex is null || regex.IsMatch(Path.GetFileName(module.FileName)))
+                if (Verbose)
                 {
-                    if (Verbose)
-                    {
-                        WriteLine("{0} {1}", module.ModuleIndex, module.FileName);
-                        WriteLine("    Address:         {0:X16}", module.ImageBase);
-                        WriteLine("    ImageSize:       {0:X8}", module.ImageSize);
-                        WriteLine("    IsPEImage:       {0}", module.IsPEImage);
-                        WriteLine("    IsManaged:       {0}", module.IsManaged);
-                        WriteLine("    IsFileLayout:    {0}", module.IsFileLayout?.ToString() ?? "<unknown>");
-                        WriteLine("    IndexFileSize:   {0}", module.IndexFileSize?.ToString("X8") ?? "<none>");
-                        WriteLine("    IndexTimeStamp:  {0}", module.IndexTimeStamp?.ToString("X8") ?? "<none>");
-                        WriteLine("    Version:         {0}", module.VersionData?.ToString() ?? "<none>");
-                        string versionString = module.VersionString;
-                        if (!string.IsNullOrEmpty(versionString))
-                        {
-                            WriteLine("                     {0}", versionString);
-                        }
-                        WriteLine("    PdbInfo:         {0}", module.PdbFileInfo?.ToString() ?? "<none>");
-                        WriteLine("    BuildId:         {0}", !module.BuildId.IsDefaultOrEmpty ? string.Concat(module.BuildId.Select((b) => b.ToString("x2"))) : "<none>");
-                    }
-                    else
-                    {
-                        WriteLine("{0:X16} {1:X8} {2}", module.ImageBase, module.ImageSize, module.FileName);
-                    }
-                    if (Segment)
-                    {
-                        DisplaySegments(module.ImageBase);
+                    WriteLine("{0} {1}", module.ModuleIndex, module.FileName);
+                    WriteLine("    Address:         {0:X16}", module.ImageBase);
+                    WriteLine("    ImageSize:       {0:X8}", module.ImageSize);
+                    WriteLine("    IsPEImage:       {0}", module.IsPEImage);
+                    WriteLine("    IsManaged:       {0}", module.IsManaged);
+                    WriteLine("    IsFileLayout:    {0}", module.IsFileLayout?.ToString() ?? "<unknown>");
+                    WriteLine("    IndexFileSize:   {0}", module.IndexFileSize?.ToString("X8") ?? "<none>");
+                    WriteLine("    IndexTimeStamp:  {0}", module.IndexTimeStamp?.ToString("X8") ?? "<none>");
+                    WriteLine("    Version:         {0}", module.VersionData?.ToString() ?? "<none>");
+                    string versionString = module.VersionString;
+                    if (!string.IsNullOrEmpty(versionString)) {
+                        WriteLine("                     {0}", versionString);
                     }
+                    WriteLine("    PdbInfo:         {0}", module.PdbFileInfo?.ToString() ?? "<none>");
+                    WriteLine("    BuildId:         {0}", !module.BuildId.IsDefaultOrEmpty ? string.Concat(module.BuildId.Select((b) => b.ToString("x2"))) : "<none>");
                 }
-            }
-            WriteLine("Total image size: {0}", totalSize);
-        }
-
-        public ITarget Target { get; set; }
-
-        public IMemoryService MemoryService { get; set; }
-
-        void DisplaySegments(ulong address)
-        {
-            try
-            {
-                if (Target.OperatingSystem == OSPlatform.Linux)
-                {
-                    Stream stream = MemoryService.CreateMemoryStream();
-                    var elfFile = new ELFFile(new StreamAddressSpace(stream), address, true);
-                    if (elfFile.IsValid())
-                    {
-                        foreach (ELFProgramHeader programHeader in elfFile.Segments.Select((segment) => segment.Header))
-                        {
-                            uint flags = MemoryService.PointerSize == 8 ? programHeader.Flags : programHeader.Flags32;
-                            ulong loadAddress = programHeader.VirtualAddress;
-                            ulong loadSize = programHeader.VirtualSize;
-                            ulong fileOffset = programHeader.FileOffset;
-                            string type = programHeader.Type.ToString();
-                            WriteLine($"        Segment: {loadAddress:X16} {loadSize:X16} {fileOffset:X16} {flags:x2} {type}");
-                        }
-                    }
-                }
-                else if (Target.OperatingSystem == OSPlatform.OSX)
+                else
                 {
-                    Stream stream = MemoryService.CreateMemoryStream();
-                    MachOFile machOFile = new(new StreamAddressSpace(stream), address, true);
-                    if (machOFile.IsValid())
-                    {
-                        WriteLine("    LoadAddress:     {0:X16}", machOFile.LoadAddress);
-                        WriteLine("    LoadBias:        {0:X16}", machOFile.PreferredVMBaseAddress);
-                        for (int i = 0; i < machOFile.Segments.Length; i++)
-                        {
-                            MachSegment segment = machOFile.Segments[i];
-                            ulong loadAddress = segment.LoadCommand.VMAddress;
-                            ulong loadSize = segment.LoadCommand.VMSize;
-                            ulong fileOffset = segment.LoadCommand.FileOffset;
-                            uint prot = segment.LoadCommand.InitProt;
-                            string name = segment.LoadCommand.SegName.ToString();
-                            WriteLine($"        Segment {i}: {loadAddress:X16} {loadSize:X16} {fileOffset:X16} {prot:x2} {name}");
-                        }
-                    }
+                    WriteLine("{0:X16} {1:X8} {2}", module.ImageBase, module.ImageSize, module.FileName);
                 }
             }
-            catch (Exception ex) when (ex is InvalidVirtualAddressException || ex is BadInputFormatException)
-            {
-                Trace.TraceError($"Exception displaying module segments: {ex}");
-            }
+            WriteLine("Total image size: {0}", totalSize);
         }
     }
 }
index 1466f02a5315b30e870d7131778e095f4c0e55fb..d002d73677359d4c99bb4640150cd9f815ac6297 100644 (file)
@@ -2,7 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-using System;
 using System.Collections.Generic;
 using System.Linq;
 using Microsoft.Diagnostics.NETCore.Client;
@@ -23,11 +22,5 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
             // CONSIDER: Might have to deduplicate providers and merge them together.
             return _configurations.SelectMany(c => c.GetProviders()).ToList();
         }
-
-        public override bool RequestRundown
-        {
-            get => _configurations.Any(c => c.RequestRundown);
-            set => throw new NotSupportedException();
-        }
     }
 }
index 99d9bc4231a5a163b01ae7fd820987c463514d6b..415c29bf519c18489a201cf3a1b11a835fac9c3d 100644 (file)
@@ -19,7 +19,6 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 
         public AspNetTriggerSourceConfiguration(float? heartbeatIntervalSeconds = null)
         {
-            RequestRundown = false;
             _heartbeatIntervalSeconds = heartbeatIntervalSeconds;
         }
 
index 6d8109f80b26f8b2d5218f8d04eb8e969595e915..11a4a88f94c27edaa8d12bf7ea091111fc267431 100644 (file)
@@ -11,12 +11,13 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
     public sealed class EventPipeProviderSourceConfiguration : MonitoringSourceConfiguration
     {
         private readonly IEnumerable<EventPipeProvider> _providers;
+        private readonly bool _requestRundown;
         private readonly int _bufferSizeInMB;
 
         public EventPipeProviderSourceConfiguration(bool requestRundown = true, int bufferSizeInMB = 256, params EventPipeProvider[] providers)
         {
             _providers = providers;
-            RequestRundown = requestRundown;
+            _requestRundown = requestRundown;
             _bufferSizeInMB = bufferSizeInMB;
         }
 
@@ -25,6 +26,8 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
             return _providers.ToList();
         }
 
+        public override bool RequestRundown => _requestRundown;
+
         public override int BufferSizeInMB => _bufferSizeInMB;
     }
 }
index 8ddad7ff5d5595eead1e8fc4c4747200928e29d1..afcf9be8ff87cf19c088411e6f487832763fbd14 100644 (file)
@@ -11,11 +11,6 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 {
     public sealed class GCDumpSourceConfiguration : MonitoringSourceConfiguration
     {
-        public GCDumpSourceConfiguration()
-        {
-            RequestRundown = false;
-        }
-
         public override IList<EventPipeProvider> GetProviders()
         {
             var providers = new List<EventPipeProvider>()
index ef58ab5b6eb76870f7c0b0deed9e78a5165a08a1..904e8d843f87d76a75355fdb9805c7cb02ae2cac 100644 (file)
@@ -10,12 +10,6 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 {
     public sealed class HttpRequestSourceConfiguration : MonitoringSourceConfiguration
     {
-        public HttpRequestSourceConfiguration()
-        {
-            //CONSIDER removing rundown for this scenario.
-            RequestRundown = true;
-        }
-
         private const string DiagnosticFilterString =
                 "Microsoft.AspNetCore/Microsoft.AspNetCore.Hosting.HttpRequestIn.Start@Activity1Start:-" +
                     "Request.Scheme" +
index f30749b193f4953a39d7d66af2bff7d462b60951..3cd63d20f11a390ccf8db01308272194c560734d 100644 (file)
@@ -22,7 +22,6 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
         /// </summary>
         public LoggingSourceConfiguration(LogLevel level, LogMessageType messageType, IDictionary<string, LogLevel?> filterSpecs, bool useAppFilters)
         {
-            RequestRundown = false;
             _filterSpecs = ToFilterSpecsString(filterSpecs, useAppFilters);
             _keywords = (long)ToKeywords(messageType);
             _level = ToEventLevel(level);
index 4047e1124228f0e39ec00545e1be70eddac00b89..30d4f970f8095e65ae94cb49b876ae7a03fc9297 100644 (file)
@@ -19,7 +19,6 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 
         public MetricSourceConfiguration(float metricIntervalSeconds, IEnumerable<string> customProviderNames)
         {
-            RequestRundown = false;
             if (customProviderNames == null)
             {
                 throw new ArgumentNullException(nameof(customProviderNames));
index 00486370f5c491089ecffdd39f5f08600dddf66a..2fc5c24d80ae36ddf06c36571262827a7e349d8a 100644 (file)
@@ -32,7 +32,7 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 
         public abstract IList<EventPipeProvider> GetProviders();
 
-        public virtual bool RequestRundown { get; set; } = true;
+        public virtual bool RequestRundown => true;
 
         public virtual int BufferSizeInMB => 256;
     }
index f7079791ffa83a4fd07aee17ad502d1e60297d13..62b5a97974bf3c32e561f7535f6e6cbc17b1cba0 100644 (file)
@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information.
 
 using Microsoft.Diagnostics.NETCore.Client;
-using System;
 using System.Collections.Generic;
 using System.Diagnostics.Tracing;
 
@@ -19,10 +18,6 @@ namespace Microsoft.Diagnostics.Monitoring.EventPipe
 
         public override int BufferSizeInMB => 1;
 
-        public override bool RequestRundown
-        {
-            get => false;
-            set => throw new NotSupportedException();
-        }
+        public override bool RequestRundown => false;
     }
 }
index e928aaea0c214554c3ffc37b4b6f268f1e43c5d8..d77497edf8b5e7d6294719a1d78492a0b4b766b7 100644 (file)
@@ -127,26 +127,6 @@ namespace Microsoft.Diagnostics.NETCore.Client
             ValidateResponseMessage(response, nameof(WriteDump));
         }
 
-        /// <summary>
-        /// Trigger a core dump generation.
-        /// </summary> 
-        /// <param name="dumpType">Type of the dump to be generated</param>
-        /// <param name="dumpPath">Full path to the dump to be generated. By default it is /tmp/coredump.{pid}</param>
-        /// <param name="flags">logging and crash report flags. On runtimes less than 6.0, only LoggingEnabled is supported.</param>
-        public void WriteDump(DumpType dumpType, string dumpPath, WriteDumpFlags flags)
-        {
-            IpcMessage request = CreateWriteDumpMessage2(dumpType, dumpPath, flags);
-            IpcMessage response = IpcClient.SendMessage(_endpoint, request);
-            if (!ValidateResponseMessage(response, nameof(WriteDump), ValidateResponseOptions.UnknownCommandReturnsFalse))
-            {
-                if ((flags & ~WriteDumpFlags.LoggingEnabled) != 0)
-                {
-                    throw new ArgumentException($"Only {nameof(WriteDumpFlags.LoggingEnabled)} flag is supported by this runtime version", nameof(flags));
-                }
-                WriteDump(dumpType, dumpPath, logDumpGeneration: (flags & WriteDumpFlags.LoggingEnabled) != 0);
-            }
-        }
-
         /// <summary>
         /// Trigger a core dump generation.
         /// </summary> 
@@ -154,34 +134,13 @@ namespace Microsoft.Diagnostics.NETCore.Client
         /// <param name="dumpPath">Full path to the dump to be generated. By default it is /tmp/coredump.{pid}</param>
         /// <param name="logDumpGeneration">When set to true, display the dump generation debug log to the console.</param>
         /// <param name="token">The token to monitor for cancellation requests.</param>
-        public async Task WriteDumpAsync(DumpType dumpType, string dumpPath, bool logDumpGeneration, CancellationToken token)
+        internal async Task WriteDumpAsync(DumpType dumpType, string dumpPath, bool logDumpGeneration, CancellationToken token)
         {
             IpcMessage request = CreateWriteDumpMessage(dumpType, dumpPath, logDumpGeneration);
             IpcMessage response = await IpcClient.SendMessageAsync(_endpoint, request, token).ConfigureAwait(false);
             ValidateResponseMessage(response, nameof(WriteDumpAsync));
         }
 
-        /// <summary>
-        /// Trigger a core dump generation.
-        /// </summary> 
-        /// <param name="dumpType">Type of the dump to be generated</param>
-        /// <param name="dumpPath">Full path to the dump to be generated. By default it is /tmp/coredump.{pid}</param>
-        /// <param name="flags">logging and crash report flags. On runtimes less than 6.0, only LoggingEnabled is supported.</param>
-        /// <param name="token">The token to monitor for cancellation requests.</param>
-        public async Task WriteDumpAsync(DumpType dumpType, string dumpPath, WriteDumpFlags flags, CancellationToken token)
-        {
-            IpcMessage request = CreateWriteDumpMessage2(dumpType, dumpPath, flags);
-            IpcMessage response = await IpcClient.SendMessageAsync(_endpoint, request, token).ConfigureAwait(false);
-            if (!ValidateResponseMessage(response, nameof(WriteDumpAsync), ValidateResponseOptions.UnknownCommandReturnsFalse))
-            {
-                if ((flags & ~WriteDumpFlags.LoggingEnabled) != 0)
-                {
-                    throw new ArgumentException($"Only {nameof(WriteDumpFlags.LoggingEnabled)} flag is supported by this runtime version", nameof(flags));
-                }
-                await WriteDumpAsync(dumpType, dumpPath, logDumpGeneration: (flags & WriteDumpFlags.LoggingEnabled) != 0, token);
-            }
-        }
-
         /// <summary>
         /// Attach a profiler.
         /// </summary>
@@ -434,17 +393,6 @@ namespace Microsoft.Diagnostics.NETCore.Client
                 Guid guidVal = (Guid)((object)obj);
                 writer.Write(guidVal.ToByteArray());
             }
-            else if (typeof(T) == typeof(byte[]))
-            {
-                byte[] byteArray = (byte[])((object)obj);
-                uint length = byteArray == null ? 0U : (uint)byteArray.Length;
-                writer.Write(length);
-
-                if (length > 0)
-                {
-                    writer.Write(byteArray);
-                }
-            }
             else
             {
                 throw new ArgumentException($"Type {obj.GetType()} is not supported in SerializePayloadArgument, please add it.");
@@ -523,15 +471,6 @@ namespace Microsoft.Diagnostics.NETCore.Client
             return new IpcMessage(DiagnosticsServerCommandSet.Dump, (byte)DumpCommandId.GenerateCoreDump, payload);
         }
 
-        private static IpcMessage CreateWriteDumpMessage2(DumpType dumpType, string dumpPath, WriteDumpFlags flags)
-        {
-            if (string.IsNullOrEmpty(dumpPath))
-                throw new ArgumentNullException($"{nameof(dumpPath)} required");
-
-            byte[] payload = SerializePayload(dumpPath, (uint)dumpType, (uint)flags);
-            return new IpcMessage(DiagnosticsServerCommandSet.Dump, (byte)DumpCommandId.GenerateCoreDump2, payload);
-        }
-
         private static ProcessInfo GetProcessInfoFromResponse(IpcResponse response, string operationName)
         {
             ValidateResponseMessage(response.Message, operationName);
diff --git a/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/WriteDumpFlags.cs b/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/WriteDumpFlags.cs
deleted file mode 100644 (file)
index b1f93cd..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace Microsoft.Diagnostics.NETCore.Client
-{
-    public enum WriteDumpFlags
-    {
-        None = 0x00,
-        LoggingEnabled = 0x01,
-        VerboseLoggingEnabled = 0x02,
-        CrashReportEnabled = 0x04
-    }
-}
\ No newline at end of file
index b1f4e80ef17da29b2541c7021afa635cac6a7868..d76f0df0bf228362bf9cc311d0d77209eae7d2ac 100644 (file)
@@ -35,7 +35,6 @@ namespace Microsoft.Diagnostics.NETCore.Client
     internal enum DumpCommandId : byte
     {
         GenerateCoreDump = 0x01,
-        GenerateCoreDump2 = 0x02,
     }
 
     internal enum ProfilerCommandId : byte
index 44eeb6ca7e67cee1cf23274229f4ef4b83fc4403..10d13a100f3017fc4aff0c4fafc64951633117e4 100644 (file)
@@ -85,13 +85,7 @@ namespace Microsoft.Diagnostics.NETCore.Client
                     PipeDirection.InOut,
                     PipeOptions.Asynchronous,
                     TokenImpersonationLevel.Impersonation);
-
-                // Pass non-infinite timeout in order to cause internal connection algorithm
-                // to check the CancellationToken periodically. Otherwise, if the named pipe
-                // is waited using WaitNamedPipe with an infinite timeout, then the
-                // CancellationToken cannot be observed.
-                await namedPipe.ConnectAsync(int.MaxValue, token).ConfigureAwait(false);
-                
+                await namedPipe.ConnectAsync(token).ConfigureAwait(false);
                 return namedPipe;
             }
             else if (config.Transport == IpcEndpointConfig.TransportType.UnixDomainSocket)
index 3cf3c2661c53ec23ace6714cfb0194216ee887a4..51a3ac808da002e5c1fe8c3902052802bfdfbc84 100644 (file)
@@ -1,13 +1,14 @@
-if(CLR_CMAKE_HOST_UNIX)
+if(CLR_CMAKE_PLATFORM_UNIX)
     include_directories(${ROOT_DIR}/src/pal/inc)
     include_directories(${ROOT_DIR}/src/pal/inc/rt)
 
     add_subdirectory(lldbplugin)
-endif(CLR_CMAKE_HOST_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
 
 # lldbplugin doesn't build with these options
 if(WIN32)
   message(STATUS "CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
+  include_directories("$ENV{ProgramFiles(x86)}/Windows Kits/10/Include/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
 
   message(STATUS "VSInstallDir: $ENV{VSInstallDir}")
   include_directories("$ENV{VSInstallDir}/DIA SDK/include")
@@ -28,7 +29,7 @@ add_subdirectory(dbgutil)
 add_subdirectory(SOS.Extensions)
 add_subdirectory(Strike)
 
-if(CLR_CMAKE_HOST_UNIX)
+if(CLR_CMAKE_PLATFORM_UNIX)
   add_compile_options(-fPIC)
 
   # Include the dummy c++ include files
@@ -36,4 +37,4 @@ if(CLR_CMAKE_HOST_UNIX)
 
   # This prevents inclusion of standard C compiler headers
   add_compile_options(-nostdinc)
-endif(CLR_CMAKE_HOST_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
index 29572e36ba9941064879eb1742f95dd66620043e..8ca01b708c73f968ae626baf2c2f15ec5c653b95 100644 (file)
@@ -302,16 +302,9 @@ namespace SOS.Extensions
             IntPtr self)
         {
             Trace.TraceInformation("HostServices.DestroyTarget #{0}", _target != null ? _target.Id : "<none>");
-            try
-            {
-                if (_target != null)
-                {
-                    DestroyTarget(_target);
-                }
-            }
-            catch (Exception ex)
+            if (_target != null)
             {
-                Trace.TraceError(ex.ToString());
+                DestroyTarget(_target);
             }
         }
 
@@ -357,29 +350,22 @@ namespace SOS.Extensions
             IntPtr self)
         {
             Trace.TraceInformation("HostServices.Uninitialize");
-            try
-            {
-                DestroyTarget(self);
+            DestroyTarget(self);
 
-                if (DebuggerServices != null)
-                {
-                    DebuggerServices.Release();
-                    DebuggerServices = null;
-                }
+            if (DebuggerServices != null)
+            {
+                DebuggerServices.Release();
+                DebuggerServices = null;
+            }
 
-                // Send shutdown event on exit
-                OnShutdownEvent.Fire();
+            // Send shutdown event on exit
+            OnShutdownEvent.Fire();
 
-                // Release the host services wrapper
-                Release();
+            // Release the host services wrapper
+            Release();
 
-                // Clear HostService instance
-                Instance = null;
-            }
-            catch (Exception ex)
-            {
-                Trace.TraceError(ex.ToString());
-            }
+            // Clear HostService instance
+            Instance = null;
         }
 
         #endregion
index cbd533e41ab77466f4547ed28b2c221703289051..29b04ed03f1963ab0266174e97d0b14033144cfc 100644 (file)
@@ -99,7 +99,7 @@ namespace SOS.Extensions
                         {
                             if (_moduleService.Target.OperatingSystem != OSPlatform.Windows && !IsPEImage)
                             {
-                                _versionString = _moduleService.GetVersionString(ImageBase);
+                                _versionString = _moduleService.GetVersionString(ImageBase, ImageSize);
                             }
                         }
                     }
@@ -133,8 +133,8 @@ namespace SOS.Extensions
 
         private readonly DebuggerServices _debuggerServices;
 
-        internal ModuleServiceFromDebuggerServices(ITarget target, IMemoryService rawMemoryService, DebuggerServices debuggerServices)
-            : base(target, rawMemoryService)
+        internal ModuleServiceFromDebuggerServices(ITarget target, DebuggerServices debuggerServices)
+            : base(target)
         {
             Debug.Assert(debuggerServices != null);
             _debuggerServices = debuggerServices;
index 3ce6225dae067a48ff9aac1020ea9ff727fe9848..3a44ba2f805735ae98ba62ea34e676da95eb06e6 100644 (file)
@@ -72,19 +72,18 @@ namespace SOS.Extensions
             }
 
             // Add the thread, memory, and module services
-            IMemoryService rawMemoryService = new MemoryServiceFromDebuggerServices(this, debuggerServices);
-            ServiceProvider.AddServiceFactory<IModuleService>(() => new ModuleServiceFromDebuggerServices(this, rawMemoryService, debuggerServices));
+            ServiceProvider.AddServiceFactory<IModuleService>(() => new ModuleServiceFromDebuggerServices(this, debuggerServices));
             ServiceProvider.AddServiceFactory<IThreadService>(() => new ThreadServiceFromDebuggerServices(this, debuggerServices));
             ServiceProvider.AddServiceFactory<IMemoryService>(() => {
+                IMemoryService memoryService = new MemoryServiceFromDebuggerServices(this, debuggerServices);
                 Debug.Assert(Host.HostType != HostType.DotnetDump);
-                IMemoryService memoryService = rawMemoryService;
                 if (IsDump && Host.HostType == HostType.Lldb)
                 {
                     // This is a special memory service that maps the managed assemblies' metadata into the address 
                     // space. The lldb debugger returns zero's (instead of failing the memory read) for missing pages
                     // in core dumps that older (< 5.0) createdumps generate so it needs this special metadata mapping 
                     // memory service. dotnet-dump needs this logic for clrstack -i (uses ICorDebug data targets).
-                    return new MetadataMappingMemoryService(this, memoryService);
+                    memoryService = new MetadataMappingMemoryService(this, memoryService);
                 }
                 return memoryService;
             });
index 62928a90df1f259216072a95abc29457b400047c..71cf779bf4a3e18433c5030aa416a8e95806c0cf 100644 (file)
@@ -135,13 +135,13 @@ namespace SOS.Hosting
         private void Flush()
         {
             // TODO: there is a better way to flush _corDebugProcess with ICorDebugProcess4::ProcessStateChanged(FLUSH_ALL)
-            if (_corDebugProcess != IntPtr.Zero)
+            if (_corDebugProcess == IntPtr.Zero)
             {
                 COMHelper.Release(_corDebugProcess);
                 _corDebugProcess = IntPtr.Zero;
             }
             // TODO: there is a better way to flush _clrDataProcess with ICLRDataProcess::Flush()
-            if (_clrDataProcess != IntPtr.Zero)
+            if (_clrDataProcess == IntPtr.Zero)
             {
                 COMHelper.Release(_clrDataProcess);
                 _clrDataProcess = IntPtr.Zero;
index 25dd90b3abf72307437d7a112e3fd46153e833cd..ea90410b6ad9a0a57e2195c93028224fb0b4e0ce 100644 (file)
@@ -200,22 +200,20 @@ namespace SOS.Hosting
             {
                 try
                 {
+                    Stream stream = MemoryService.CreateMemoryStream(address, size);
                     KeyGenerator generator = null;
                     if (config == RuntimeConfiguration.UnixCore)
                     {
-                        Stream stream = MemoryService.CreateMemoryStream();
-                        var elfFile = new ELFFile(new StreamAddressSpace(stream), address, true);
+                        var elfFile = new ELFFile(new StreamAddressSpace(stream), 0, true);
                         generator = new ELFFileKeyGenerator(Tracer.Instance, elfFile, moduleFilePath);
                     }
                     else if (config == RuntimeConfiguration.OSXCore)
                     {
-                        Stream stream = MemoryService.CreateMemoryStream();
-                        var machOFile = new MachOFile(new StreamAddressSpace(stream), address, true);
+                        var machOFile = new MachOFile(new StreamAddressSpace(stream), 0, true);
                         generator = new MachOFileKeyGenerator(Tracer.Instance, machOFile, moduleFilePath);
                     }
                     else if (config == RuntimeConfiguration.WindowsCore || config ==  RuntimeConfiguration.WindowsDesktop)
                     {
-                        Stream stream = MemoryService.CreateMemoryStream(address, size);
                         var peFile = new PEFile(new StreamAddressSpace(stream), true);
                         generator = new PEFileKeyGenerator(Tracer.Instance, peFile, moduleFilePath);
                     }
@@ -273,55 +271,52 @@ namespace SOS.Hosting
             int moduleIndexSize,
             IntPtr moduleIndex)
         {
-            if (_symbolService.IsSymbolStoreEnabled)
+            try
             {
-                try
+                KeyTypeFlags flags = specialKeys ? KeyTypeFlags.DacDbiKeys : KeyTypeFlags.IdentityKey;
+                byte[] id = new byte[moduleIndexSize];
+                Marshal.Copy(moduleIndex, id, 0, moduleIndexSize);
+
+                IEnumerable<SymbolStoreKey> keys = null;
+                switch (config)
                 {
-                    KeyTypeFlags flags = specialKeys ? KeyTypeFlags.DacDbiKeys : KeyTypeFlags.IdentityKey;
-                    byte[] id = new byte[moduleIndexSize];
-                    Marshal.Copy(moduleIndex, id, 0, moduleIndexSize);
+                    case RuntimeConfiguration.UnixCore:
+                        keys = ELFFileKeyGenerator.GetKeys(flags, moduleFilePath, id, symbolFile: false, symbolFileName: null);
+                        break;
 
-                    IEnumerable<SymbolStoreKey> keys = null;
-                    switch (config)
-                    {
-                        case RuntimeConfiguration.UnixCore:
-                            keys = ELFFileKeyGenerator.GetKeys(flags, moduleFilePath, id, symbolFile: false, symbolFileName: null);
-                            break;
-
-                        case RuntimeConfiguration.OSXCore:
-                            keys = MachOFileKeyGenerator.GetKeys(flags, moduleFilePath, id, symbolFile: false, symbolFileName: null);
-                            break;
-
-                        case RuntimeConfiguration.WindowsCore:
-                        case RuntimeConfiguration.WindowsDesktop:
-                            uint timeStamp = BitConverter.ToUInt32(id, 0);
-                            uint fileSize = BitConverter.ToUInt32(id, 4);
-                            SymbolStoreKey key = PEFileKeyGenerator.GetKey(moduleFilePath, timeStamp, fileSize);
-                            keys = new SymbolStoreKey[] { key };
-                            break;
-
-                        default:
-                            Trace.TraceError("LoadNativeSymbolsFromIndex: unsupported platform {0}", config);
-                            return;
-                    }
-                    foreach (SymbolStoreKey key in keys)
-                    {
-                        string moduleFileName = Path.GetFileName(key.FullPathName);
-                        Trace.TraceInformation("{0} {1}", key.FullPathName, key.Index);
+                    case RuntimeConfiguration.OSXCore:
+                        keys = MachOFileKeyGenerator.GetKeys(flags, moduleFilePath, id, symbolFile: false, symbolFileName: null);
+                        break;
 
-                        string downloadFilePath = _symbolService.DownloadFile(key);
-                        if (downloadFilePath != null)
-                        {
-                            Trace.TraceInformation("{0}: {1}", moduleFileName, downloadFilePath);
-                            callback(parameter, moduleFileName, downloadFilePath);
-                        }
-                    }
+                    case RuntimeConfiguration.WindowsCore:
+                    case RuntimeConfiguration.WindowsDesktop:
+                        uint timeStamp = BitConverter.ToUInt32(id, 0);
+                        uint fileSize = BitConverter.ToUInt32(id, 4);
+                        SymbolStoreKey key = PEFileKeyGenerator.GetKey(moduleFilePath, timeStamp, fileSize);
+                        keys = new SymbolStoreKey[] { key };
+                        break;
+
+                    default:
+                        Trace.TraceError("LoadNativeSymbolsFromIndex: unsupported platform {0}", config);
+                        return;
                 }
-                catch (Exception ex) when (ex is BadInputFormatException || ex is InvalidVirtualAddressException || ex is TaskCanceledException)
+                foreach (SymbolStoreKey key in keys)
                 {
-                    Trace.TraceError("{0} - {1}", ex.Message, moduleFilePath);
+                    string moduleFileName = Path.GetFileName(key.FullPathName);
+                    Trace.TraceInformation("{0} {1}", key.FullPathName, key.Index);
+
+                    string downloadFilePath = _symbolService.DownloadFile(key);
+                    if (downloadFilePath != null)
+                    {
+                        Trace.TraceInformation("{0}: {1}", moduleFileName, downloadFilePath);
+                        callback(parameter, moduleFileName, downloadFilePath);
+                    }
                 }
             }
+            catch (Exception ex) when (ex is BadInputFormatException || ex is InvalidVirtualAddressException || ex is TaskCanceledException)
+            {
+                Trace.TraceError("{0} - {1}", ex.Message, moduleFilePath);
+            }
         }
 
         /// <summary>
index 4a8e97e2dd70ca907d249892d82be8097c777268..f81a88cd6b70bb399e4da44aef53dd0335e7ffe7 100644 (file)
          <TargetPath>$(SymbolsDir)</TargetPath>
       </ZipSymbolFiles>
 
-      <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.x64.$(Configuration)\PDB\sos.pdb">
+      <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.x64.$(Configuration)\sos.pdb">
          <TargetPath>$(SymbolsDir)\win-x64</TargetPath>
       </ZipSymbolFiles>
 
-      <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.x86.$(Configuration)\PDB\sos.pdb">
+      <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.x86.$(Configuration)\sos.pdb">
          <TargetPath>$(SymbolsDir)\win-x86</TargetPath>
       </ZipSymbolFiles>
 
-      <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.arm.$(Configuration)\PDB\sos.pdb">
+      <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.arm.$(Configuration)\sos.pdb">
          <TargetPath>$(SymbolsDir)\win-arm</TargetPath>
       </ZipSymbolFiles>
 
-      <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.arm64.$(Configuration)\PDB\sos.pdb">
+      <ZipSymbolFiles Include="$(ArtifactsBinDir)Windows_NT.arm64.$(Configuration)\sos.pdb">
          <TargetPath>$(SymbolsDir)\win-arm64</TargetPath>
       </ZipSymbolFiles>
     </ItemGroup>
index d5256031e425736e0f90ea9f32767817ae666ee0..e291c400c28c6fcd5724f656ef4239a075cc4ea5 100644 (file)
       <PackagePath>$(SOSPackagePathPrefix)</PackagePath>
     </None>
 
-    <None Include="$(ArtifactsBinDir)\Windows_NT.x64.$(Configuration)\PDB\sos.pdb" Pack="true" Visible="false">
+    <None Include="$(ArtifactsBinDir)\Windows_NT.x64.$(Configuration)\sos.pdb" Pack="true" Visible="false">
       <PackagePath>$(SOSPackagePathPrefix)/win-x64</PackagePath>
     </None>
-    <None Include="$(ArtifactsBinDir)\Windows_NT.x86.$(Configuration)\PDB\sos.pdb" Pack="true" Visible="false">
+    <None Include="$(ArtifactsBinDir)\Windows_NT.x86.$(Configuration)\sos.pdb" Pack="true" Visible="false">
       <PackagePath>$(SOSPackagePathPrefix)/win-x86</PackagePath>
     </None>
-    <None Include="$(ArtifactsBinDir)\Windows_NT.arm.$(Configuration)\PDB\sos.pdb" Pack="true" Visible="false">
+    <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)\PDB\sos.pdb" Pack="true" Visible="false">
+    <None Include="$(ArtifactsBinDir)\Windows_NT.arm64.$(Configuration)\sos.pdb" Pack="true" Visible="false">
       <PackagePath>$(SOSPackagePathPrefix)/win-arm64</PackagePath>
     </None>
 
index 87afc4655493c250ab66ea39a93cd3dcd19ec286..663c803d98fd515c576c0cf921a3d577b0520de9 100644 (file)
@@ -71,7 +71,8 @@ public class SOS
                 }
 
                 // Using the dotnet-dump analyze tool if the path exists in the config file.
-                if (information.TestConfiguration.DotNetDumpPath() != null)
+                // TODO: dotnet-dump currently doesn't support macho core dumps that the MacOS createdump generates
+                if (information.TestConfiguration.DotNetDumpPath() != null && OS.Kind != OSKind.OSX)
                 {
                     // Don't test dotnet-dump on triage dumps when running on desktop CLR.
                     if (information.TestConfiguration.IsNETCore || information.DumpType != SOSRunner.DumpType.Triage)
@@ -127,7 +128,7 @@ public class SOS
                 Assert.NotNull(parameters);
                 Assert.NotNull(parameters.ExceptionType);
                 Assert.NotNull(parameters.OSVersion);
-                Assert.Equal("apple", (string)parameters.SystemManufacturer);
+                Assert.Equal(parameters.SystemManufacturer, "apple");
             }
         }
         catch (Exception ex)
index 5f4c6d24d035a8e66d1390523edf54536be1e97b..5f29de0d93c83ce76a7c9dcc52d20b1376abc285 100644 (file)
@@ -6,14 +6,14 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
 # For more information: http://www.cmake.org/Wiki/CMake_RPATH_handling.
 if (CORECLR_SET_RPATH)
   set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-  if(CLR_CMAKE_HOST_OSX)
+  if(CLR_CMAKE_PLATFORM_DARWIN)
     set(CMAKE_INSTALL_RPATH "@loader_path")
   else()
     set(CMAKE_INSTALL_RPATH "\$ORIGIN")
-  endif(CLR_CMAKE_HOST_OSX)
+  endif(CLR_CMAKE_PLATFORM_DARWIN)
 endif (CORECLR_SET_RPATH)
 
-if(CLR_CMAKE_HOST_ARCH_AMD64)
+if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
   add_definitions(-DSOS_TARGET_AMD64=1)
   add_definitions(-D_TARGET_WIN64_=1)
   add_definitions(-DDBG_TARGET_64BIT)
@@ -24,24 +24,24 @@ if(CLR_CMAKE_HOST_ARCH_AMD64)
   remove_definitions(-D_TARGET_ARM64_=1)
   add_definitions(-D_TARGET_AMD64_)
   add_definitions(-DDBG_TARGET_AMD64)
-elseif(CLR_CMAKE_HOST_ARCH_I386)
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
   add_definitions(-DSOS_TARGET_X86=1)
   add_definitions(-D_TARGET_X86_=1)
   add_definitions(-DDBG_TARGET_32BIT)
   if(WIN32)
     add_definitions(-DSOS_TARGET_ARM=1)
   endif(WIN32)
-elseif(CLR_CMAKE_HOST_ARCH_ARM)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
   add_definitions(-DSOS_TARGET_ARM=1)
   add_definitions(-D_TARGET_WIN32_=1)
   add_definitions(-D_TARGET_ARM_=1)
   add_definitions(-DDBG_TARGET_32BIT)
-elseif(CLR_CMAKE_HOST_ARCH_ARM64)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
   add_definitions(-DSOS_TARGET_ARM64=1)
   add_definitions(-D_TARGET_WIN64_=1)
   add_definitions(-DDBG_TARGET_64BIT)
   add_definitions(-DDBG_TARGET_WIN64=1)
-elseif(CLR_CMAKE_HOST_ARCH_MIPS64)
+elseif(CLR_CMAKE_PLATFORM_ARCH_MIPS64)
   add_definitions(-DSOS_TARGET_MIPS64=1)
   add_definitions(-D_TARGET_WIN64_=1)
   add_definitions(-DDBG_TARGET_64BIT)
@@ -90,7 +90,7 @@ if(WIN32)
   add_definitions(-DFX_VER_INTERNALNAME_STR=SOS.dll)
 
   #Preprocess exports definition file
-  preprocess_file(${CMAKE_CURRENT_SOURCE_DIR}/sos.def ${CMAKE_CURRENT_BINARY_DIR}/sos.def)
+  preprocess_def_file(${CMAKE_CURRENT_SOURCE_DIR}/sos.def ${CMAKE_CURRENT_BINARY_DIR}/sos.def)
   list(APPEND SOS_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/sos.def)
 
   set(SOS_LIBRARY
@@ -113,11 +113,11 @@ if(WIN32)
     ntdll.lib
   )
 
-  if(NOT CLR_CMAKE_HOST_ARCH_ARM64)
+  if(NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
     list(APPEND 
       SOS_LIBRARY 
         mscoree.lib)
-  endif(NOT CLR_CMAKE_HOST_ARCH_ARM64)
+  endif(NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
 
 else(WIN32)
   add_definitions(-DFEATURE_ENABLE_HARDWARE_EXCEPTIONS)
@@ -183,7 +183,7 @@ else(WIN32)
 
 endif(WIN32)
 
-if(CLR_CMAKE_HOST_ARCH_AMD64)
+if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
   set(SOS_SOURCES_ARCH
     disasmX86.cpp
   )
@@ -193,7 +193,7 @@ if(CLR_CMAKE_HOST_ARCH_AMD64)
       disasmARM64.cpp
     )
   endif(WIN32)
-elseif(CLR_CMAKE_HOST_ARCH_I386)
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
   set(SOS_SOURCES_ARCH 
     disasmX86.cpp
   )
@@ -203,11 +203,11 @@ elseif(CLR_CMAKE_HOST_ARCH_I386)
       disasmARM.cpp
     )
   endif(WIN32)
-elseif(CLR_CMAKE_HOST_ARCH_ARM)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
   set(SOS_SOURCES_ARCH
     disasmARM.cpp
   )
-elseif(CLR_CMAKE_HOST_ARCH_ARM64)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
   set(SOS_SOURCES_ARCH
     disasmARM64.cpp
   )
@@ -215,30 +215,30 @@ endif()
 
 list(APPEND SOS_SOURCES ${SOS_SOURCES_ARCH})
 
-if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS)
+if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD OR CLR_CMAKE_PLATFORM_NETBSD)
     # Add linker exports file option
     set(EXPORTS_LINKER_OPTION -Wl,--version-script=${EXPORTS_FILE})
-endif(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS)
+endif(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD OR CLR_CMAKE_PLATFORM_NETBSD)
 
-if(CLR_CMAKE_HOST_OSX)
+if(CLR_CMAKE_PLATFORM_DARWIN)
     # Add linker exports file option
     set(EXPORTS_LINKER_OPTION -Wl,-exported_symbols_list,${EXPORTS_FILE})
-endif(CLR_CMAKE_HOST_OSX)
+endif(CLR_CMAKE_PLATFORM_DARWIN)
 
 add_library_clr(sos SHARED ${SOS_SOURCES})
 
-if(CLR_CMAKE_HOST_UNIX)
+if(CLR_CMAKE_PLATFORM_UNIX)
     add_custom_target(sos_exports DEPENDS ${EXPORTS_FILE})
     add_dependencies(sos sos_exports)
 
     set_property(TARGET sos APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION})
     set_property(TARGET sos APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})
-endif(CLR_CMAKE_HOST_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
 
 target_link_libraries(sos ${SOS_LIBRARY})
 
 # add the install targets
-install_clr(TARGETS sos DESTINATIONS .)
+install_clr(sos)
 
 if(NOT WIN32)
   install(FILES sosdocsunix.txt DESTINATION .)
index c0ec1143c4a72eab9dd21d9a14afe4507e58dff7..463b4ef758a4372acadc459f9ccf332e57b61f54 100644 (file)
@@ -700,13 +700,15 @@ void Runtime::DisplayStatus()
     }
 }
 
+extern bool g_symbolStoreInitialized;
+
 /**********************************************************************\
  * Attempt to download the runtime modules (runtime, DAC and DBI)
 \**********************************************************************/
 void Runtime::LoadRuntimeModules()
 {
     HRESULT hr = InitializeSymbolService();
-    if (SUCCEEDED(hr))
+    if (SUCCEEDED(hr) && g_symbolStoreInitialized)
     {
         if (m_runtimeInfo != nullptr)
         {
index 8afcbc4ddcf36151f1c0ca3b93035f32b4c73df5..01c85f55660bf7fd200defffe018d8aa01974361 100644 (file)
@@ -126,9 +126,9 @@ private:
     IXCLRDataProcess* m_clrDataProcess;
     ICorDebugProcess* m_pCorDebugProcess;
 
-    Runtime(ITarget* target, RuntimeConfiguration configuration, ULONG index, ULONG64 address, ULONG64 size, RuntimeInfo* runtimeInfo);
+    Runtime::Runtime(ITarget* target, RuntimeConfiguration configuration, ULONG index, ULONG64 address, ULONG64 size, RuntimeInfo* runtimeInfo);
 
-    virtual ~Runtime();
+    virtual Runtime::~Runtime();
 
     void LoadRuntimeModules();
 
index 649f369b124d06b8ac090251be173d64764e9dac..20e3bd50899e25f76fad8d700bb7cf469f57f0fb 100644 (file)
@@ -34,6 +34,8 @@
 #define IfFailRet(EXPR) do { Status = (EXPR); if(FAILED(Status)) { return (Status); } } while (0)
 #endif
 
+bool g_symbolStoreInitialized = false;
+
 #ifndef FEATURE_PAL
 HMODULE g_hmoduleSymBinder = nullptr;
 ISymUnmanagedBinder3 *g_pSymBinder = nullptr;
@@ -76,16 +78,15 @@ extern "C" void STDMETHODCALLTYPE SOSUninitializeByHost()
 \**********************************************************************/
 HRESULT InitializeSymbolService()
 {
-    static bool initialized = false;
-    if (!initialized)
+    if (!g_symbolStoreInitialized)
     {
         ISymbolService* symbolService = GetSymbolService();
         if (symbolService == nullptr) {
             return E_NOINTERFACE;
         }
-        initialized = true;
+        g_symbolStoreInitialized = symbolService->IsSymbolStoreEnabled();
 #ifndef FEATURE_PAL
-        // When SOS is hosted on dotnet-dump on Windows, the ExtensionApis are not set so 
+        // When SOS is hosted on dotnet-dump, the ExtensionApis are not set so 
         // the expression evaluation function needs to be supplied.
         if (GetExpression == nullptr)
         {
@@ -95,7 +96,6 @@ HRESULT InitializeSymbolService()
         }
 #endif
         OnUnloadTask::Register([]() {
-            initialized = false;
             DisableSymbolStore();
         });
     }
@@ -137,6 +137,7 @@ HRESULT InitializeSymbolStore(
             return E_FAIL;
         }
     }
+    g_symbolStoreInitialized = true;
     return S_OK;
 }
 
@@ -174,13 +175,9 @@ static void LoadNativeSymbolsCallback(void* param, const char* moduleFilePath, U
 \**********************************************************************/
 HRESULT LoadNativeSymbols(bool runtimeOnly)
 {
-    ISymbolService* symbolService = GetSymbolService();
-    if (symbolService != nullptr)
+    if (g_symbolStoreInitialized)
     {
-        if (symbolService->IsSymbolStoreEnabled())
-        {
-            return g_ExtServices2->LoadNativeSymbols(runtimeOnly, LoadNativeSymbolsCallback);
-        }
+        return g_ExtServices2->LoadNativeSymbols(runtimeOnly, LoadNativeSymbolsCallback);
     }
     return E_FAIL;
 }
@@ -192,10 +189,9 @@ HRESULT LoadNativeSymbols(bool runtimeOnly)
 \**********************************************************************/
 void DisplaySymbolStore()
 {
-    ISymbolService* symbolService = GetSymbolService();
-    if (symbolService != nullptr)
+    if (g_symbolStoreInitialized)
     {
-        symbolService->DisplaySymbolStore([] (const char* message) {
+        GetSymbolService()->DisplaySymbolStore([] (const char* message) {
             ExtOut(message);
             ExtOut("\n");
         });
@@ -207,10 +203,10 @@ void DisplaySymbolStore()
 \**********************************************************************/
 void DisableSymbolStore()
 {
-    ISymbolService* symbolService = GetSymbolService();
-    if (symbolService != nullptr)
+    if (g_symbolStoreInitialized)
     {
-        symbolService->DisableSymbolStore();
+        g_symbolStoreInitialized = false;
+        GetSymbolService()->DisableSymbolStore();
     }
 }
 
@@ -230,6 +226,7 @@ HRESULT GetMetadataLocator(
 {
     HRESULT Status = S_OK;
     IfFailRet(InitializeSymbolService());
+
     return GetSymbolService()->GetMetadataLocator(imagePath, imageTimestamp, imageSize, mvid, mdRva, flags, bufferSize, buffer, dataSize);
 }
 
@@ -441,7 +438,7 @@ HRESULT SymbolReader::LoadSymbols(___in IMetaDataImport* pMD, ___in IXCLRDataMod
             ExtOut("LoadSymbols GetClrModuleImages FAILED 0x%08x\n", hr);
             return hr;
         }
-        if (GetSymbolService() == nullptr || !HasPortablePDB(moduleBase))
+        if (!HasPortablePDB(moduleBase))
         {
             hr = LoadSymbolsForWindowsPDB(pMD, moduleBase, pModuleName, FALSE);
             if (SUCCEEDED(hr))
@@ -456,9 +453,9 @@ HRESULT SymbolReader::LoadSymbols(___in IMetaDataImport* pMD, ___in IXCLRDataMod
     }
 
 #ifndef FEATURE_PAL
-    if (GetSymbolService() == nullptr || !HasPortablePDB(moduleData.LoadedPEAddress))
+    // TODO: in-memory windows PDB not supported
+    if (!HasPortablePDB(moduleData.LoadedPEAddress))
     {
-           // TODO: in-memory windows PDB not supported
         hr = LoadSymbolsForWindowsPDB(pMD, moduleData.LoadedPEAddress, pModuleName, moduleData.IsFileLayout);
         if (SUCCEEDED(hr))
         {
index bac8b8ebdb9da8049129398f1ebe755fc5d95999..2fc4b644480bf92ab3de13b25deffdd002af9bb2 100644 (file)
@@ -12,21 +12,21 @@ set(DBGUTIL_SOURCES
     dbgutil.cpp
 )
 
-if(NOT DEFINED CLR_CMAKE_HOST_OSX)
+if(NOT DEFINED CLR_CMAKE_PLATFORM_DARWIN)
     list(APPEND DBGUTIL_SOURCES
         elfreader.cpp
     )
-endif(NOT DEFINED CLR_CMAKE_HOST_OSX)
+endif(NOT DEFINED CLR_CMAKE_PLATFORM_DARWIN)
 
-if(CLR_CMAKE_HOST_ALPINE_LINUX)
+if(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
     add_definitions(-DTARGET_ALPINE_LINUX)
-endif(CLR_CMAKE_HOST_ALPINE_LINUX)
+endif(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
 
-if(CLR_CMAKE_HOST_UNIX)
+if(CLR_CMAKE_PLATFORM_UNIX)
     add_definitions(-DHOST_UNIX)
     add_compile_options(-fPIC)
-else(CLR_CMAKE_HOST_UNIX)
+else(CLR_CMAKE_PLATFORM_UNIX)
     add_definitions(-DHOST_WINDOWS)
-endif(CLR_CMAKE_HOST_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
 
-add_library(dbgutil STATIC ${DBGUTIL_SOURCES})
+_add_library(dbgutil STATIC ${DBGUTIL_SOURCES})
index e200564315502aef22f421c5e32b938a171e30c3..3deae4b9c4df5bb863e43cd6d52b77f7fff75dc9 100644 (file)
@@ -4,12 +4,12 @@ if(WIN32)
   add_definitions(-DHOST_IS_WINDOWS_OS)
 endif(WIN32)
 
-if(CLR_CMAKE_HOST_UNIX)
+if(CLR_CMAKE_PLATFORM_UNIX)
     add_compile_options(-fPIC)
-endif(CLR_CMAKE_HOST_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
 
 set(DEBUGSHIM_SOURCES
   debugshim.cpp
 )
 
-add_library(debugshim STATIC ${DEBUGSHIM_SOURCES})
+_add_library(debugshim STATIC ${DEBUGSHIM_SOURCES})
index b7ab844b067a1d8b87b5fda5804de9d53fd43905..d906f33f8b3de22a3edc2adb79bc0eba9a570c1d 100644 (file)
@@ -15,17 +15,17 @@ set(SOURCES
     extensions.cpp
 )
 
-if(WIN32 AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
+if(WIN32 AND NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
     list(APPEND SOURCES
         hostdesktop.cpp
     )
-endif(WIN32 AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
+endif(WIN32 AND NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
 
-if(CLR_CMAKE_HOST_UNIX)
+if(CLR_CMAKE_PLATFORM_UNIX)
     add_definitions(-DHOST_UNIX)
     add_compile_options(-fPIC)
-else(CLR_CMAKE_HOST_UNIX)
+else(CLR_CMAKE_PLATFORM_UNIX)
     add_definitions(-DHOST_WINDOWS)
-endif(CLR_CMAKE_HOST_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
 
-add_library(extensions STATIC ${SOURCES})
+_add_library(extensions STATIC ${SOURCES})
index 71bc5fd14e3cf1a7e5e2ec7866ed9c71ca10a1c9..9865a6f8a5bcd49ed1dfcd039585011a068fac58 100644 (file)
@@ -6,44 +6,44 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
 # For more information: http://www.cmake.org/Wiki/CMake_RPATH_handling.
 if (CORECLR_SET_RPATH)
   set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-  if(CLR_CMAKE_HOST_OSX)
+  if(CLR_CMAKE_PLATFORM_DARWIN)
     set(CMAKE_INSTALL_RPATH "@loader_path")
   else()
     set(CMAKE_INSTALL_RPATH "\$ORIGIN")
-  endif(CLR_CMAKE_HOST_OSX)
+  endif(CLR_CMAKE_PLATFORM_DARWIN)
 endif (CORECLR_SET_RPATH)
 
 add_definitions(-DPAL_STDCPP_COMPAT)
 
-set(ENABLE_LLDBPLUGIN ${CLR_CMAKE_HOST_UNIX} CACHE BOOL "Enable building the SOS plugin for LLDB.")
-set(REQUIRE_LLDBPLUGIN ${CLR_CMAKE_HOST_LINUX} CACHE BOOL "Require building the SOS plugin for LLDB.")
+set(ENABLE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_UNIX} CACHE BOOL "Enable building the SOS plugin for LLDB.")
+set(REQUIRE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_LINUX} CACHE BOOL "Require building the SOS plugin for LLDB.")
 
 if(SKIP_LLDBPLUGIN)
     set(REQUIRE_LLDBPLUGIN false)
 endif()
 
-if(CLR_CMAKE_HOST_ARCH_AMD64)
+if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
     add_definitions(-D_TARGET_AMD64_=1)
     add_definitions(-DDBG_TARGET_64BIT=1)
     add_definitions(-DDBG_TARGET_AMD64=1)
     add_definitions(-DDBG_TARGET_WIN64=1)
     add_definitions(-DBIT64)
-elseif(CLR_CMAKE_HOST_ARCH_I386)
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
     add_definitions(-D_TARGET_X86_=1)
     add_definitions(-DDBG_TARGET_32BIT=1)
     add_definitions(-DDBG_TARGET_X86=1)
-elseif(CLR_CMAKE_HOST_ARCH_ARM)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
     add_definitions(-D_TARGET_ARM_=1)
     add_definitions(-DDBG_TARGET_32BIT=1)
     add_definitions(-DDBG_TARGET_ARM=1)
-elseif(CLR_CMAKE_HOST_ARCH_ARM64)
+elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
     add_definitions(-D_TARGET_ARM64_=1)
     add_definitions(-DDBG_TARGET_64BIT=1)
     add_definitions(-DDBG_TARGET_ARM64=1)
     add_definitions(-DDBG_TARGET_WIN64=1)
     add_definitions(-DBIT64)
     SET(REQUIRE_LLDBPLUGIN false)
-elseif(CLR_CMAKE_HOST_ARCH_MIPS64)
+elseif(CLR_CMAKE_PLATFORM_ARCH_MIPS64)
     add_definitions(-D_TARGET_MIPS64_=1)
     add_definitions(-DDBG_TARGET_64BIT=1)
     add_definitions(-DDBG_TARGET_MIPS64=1)
@@ -78,7 +78,7 @@ if(NOT $ENV{LLDB_LIB} STREQUAL "")
     set(LLDB_LIB "$ENV{LLDB_LIB}")
 else()
     # Check for LLDB library
-    if(CLR_CMAKE_HOST_OSX)
+    if(CLR_CMAKE_PLATFORM_DARWIN)
         find_library(LLDB_LIB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
         find_library(LLDB_LIB NAMES LLDB lldb lldb-6.0 lldb-5.0 lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
         if(LLDB_LIB STREQUAL LLDB_LIB-NOTFOUND)
@@ -159,4 +159,4 @@ add_library_clr(sosplugin SHARED ${SOURCES})
 target_link_libraries(sosplugin ${LIBRARIES})
 
 # add the install targets
-install_clr(TARGETS sosplugin DESTINATIONS .)
+install_clr(sosplugin)
index fbbf40958f9205d50b86e8eb8c37408c415ad249..f812c076708284668ff1af56e6e6bf72b9285961 100644 (file)
@@ -7,9 +7,6 @@
 #include <string.h>
 #include <string>
 #include <dlfcn.h>
-#if defined(__APPLE__)
-#include <mach-o/loader.h>
-#endif
 #include "sosplugin.h"
 #include "arrayholder.h"
 
@@ -1345,20 +1342,10 @@ LLDBServices::GetModuleBase(
 
 ULONG64
 LLDBServices::GetModuleSize(
-    ULONG64 baseAddress,
     /* const */ lldb::SBModule& module)
 {
     ULONG64 size = 0;
-#if defined(__APPLE__)
-    mach_header_64 header;
-    ULONG read;
-    HRESULT hr = ReadVirtual(baseAddress, &header, sizeof(mach_header_64), &read) == S_OK;
-    if (SUCCEEDED(hr))
-    {
-           // Since MachO segments are not contiguous the image size is just the headers/commands
-           size = sizeof(mach_header_64) + header.sizeofcmds;
-    }
-#else
+
     // Find the first section with an valid base address
     int numSections = module.GetNumSections();
     for (int si = 0; si < numSections; si++)
@@ -1369,7 +1356,6 @@ LLDBServices::GetModuleSize(
             size += section.GetByteSize();
         }
     }
-#endif
     // For core dumps lldb doesn't return the section sizes when it 
     // doesn't have access to the actual module file, but SOS (like 
     // the SymbolReader code) still needs a non-zero module size.
@@ -1758,7 +1744,7 @@ LLDBServices::LoadNativeSymbols(
                 path.append("/");
                 path.append(filename);
 
-                int moduleSize = GetModuleSize(moduleAddress, module);
+                int moduleSize = GetModuleSize(module);
 
                 callback(&module, path.c_str(), moduleAddress, moduleSize);
             }
@@ -1836,9 +1822,9 @@ HRESULT LLDBServices::GetModuleInfo(
     {
         return E_INVALIDARG;
     }
-    ULONG64 moduleBase = GetModuleBase(target, module);
     if (pBase)
     {
+        ULONG64 moduleBase = GetModuleBase(target, module);
         if (moduleBase == UINT64_MAX)
         {
             return E_INVALIDARG;
@@ -1847,7 +1833,7 @@ HRESULT LLDBServices::GetModuleInfo(
     }
     if (pSize)
     {
-        *pSize = GetModuleSize(moduleBase, module);
+        *pSize = GetModuleSize(module);
     }
     if (pTimestamp)
     {
index 03eb4d3088e83192e4b15e70180722dc292ddc91..cabbf9fa00240ec4fa23db1b84c8f921d942b57c 100644 (file)
@@ -28,7 +28,7 @@ private:
     ULONG m_cacheSize;
 
     ULONG64 GetModuleBase(lldb::SBTarget& target, lldb::SBModule& module);
-    ULONG64 GetModuleSize(ULONG64 baseAddress, lldb::SBModule& module);
+    ULONG64 GetModuleSize(lldb::SBModule& module);
     ULONG64 GetExpression(lldb::SBFrame& frame, lldb::SBError& error, PCSTR exp);
     void GetContextFromFrame(lldb::SBFrame& frame, DT_CONTEXT *dtcontext);
     DWORD_PTR GetRegister(lldb::SBFrame& frame, const char *name);
index 469d802405b3e45c8b764d1bf6c956801d546c58..64a82ebe5c489619c48cd64f08f1527b37c19bbc 100644 (file)
@@ -36,4 +36,4 @@ add_library_clr(runcommand SHARED ${RUNCOMMAND_SOURCES})
 target_link_libraries(runcommand ${RUNCOMMAND_LIBRARY})
 
 # add the install targets
-install_clr(TARGETS runcommand DESTINATIONS .)
+install_clr(runcommand)
index 47ac0e2273c76d4bb2e7f4ebd9da8b22d5827193..0a0925bf80cebf259717d72c1c8976be14c2a748 100644 (file)
@@ -5,8 +5,6 @@
     <OutputType>Exe</OutputType>
     <IsShipping>true</IsShipping>
     <GenerateDocumentationFile>false</GenerateDocumentationFile>
-    <!-- Tools always ship with stable versions to allow for seamless CLI upgrade experiences. -->
-    <PreReleaseVersionLabel></PreReleaseVersionLabel>
   </PropertyGroup>
 
   <Choose>
index 5e5d7943118b047a5735c54faed8e331e4d46651..45a2e2f265a13e551bc8b9ffed21a3a7338b3b99 100644 (file)
@@ -42,7 +42,6 @@ namespace Microsoft.Diagnostics.Tools.Counters
         private string _metricsEventSourceSessionId;
         private int _maxTimeSeries;
         private int _maxHistograms;
-        private TimeSpan _duration;
 
         class ProviderEventState
         {
@@ -454,8 +453,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
             string diagnosticPort,
             bool resumeRuntime,
             int maxHistograms,
-            int maxTimeSeries,
-            TimeSpan duration)
+            int maxTimeSeries)
         {
             try
             {
@@ -493,7 +491,6 @@ namespace Microsoft.Diagnostics.Tools.Counters
                         _renderer = new ConsoleWriter(useAnsi);
                         _diagnosticsClient = holder.Client;
                         _resumeRuntime = resumeRuntime;
-                        _duration = duration;
                         int ret = await Start();
                         ProcessLauncher.Launcher.Cleanup();
                         return ret;
@@ -530,8 +527,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
             string diagnosticPort,
             bool resumeRuntime,
             int maxHistograms,
-            int maxTimeSeries,
-            TimeSpan duration)
+            int maxTimeSeries)
         {
             try
             {
@@ -568,7 +564,6 @@ namespace Microsoft.Diagnostics.Tools.Counters
                         _maxTimeSeries = maxTimeSeries;
                         _output = output;
                         _diagnosticsClient = holder.Client;
-                        _duration = duration;
                         if (_output.Length == 0)
                         {
                             _console.Error.WriteLine("Output cannot be an empty string");
@@ -847,13 +842,6 @@ namespace Microsoft.Diagnostics.Tools.Counters
             });
 
             monitorTask.Start();
-            var shouldStopAfterDuration = _duration != default(TimeSpan);
-            Stopwatch durationStopwatch = null;
-
-            if (shouldStopAfterDuration)
-            {
-                durationStopwatch = Stopwatch.StartNew();
-            }
 
             while(!_shouldExit.Task.Wait(250))
             {
@@ -874,14 +862,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
                         _pauseCmdSet = false;
                     }
                 }
-
-                if (shouldStopAfterDuration && durationStopwatch.Elapsed >= _duration)
-                {
-                    durationStopwatch.Stop();
-                    break;
-                }
             }
-
             StopMonitor();
             return _shouldExit.Task;
         }
index 8293a16119b8603fd77b5e0d47c81af6c901bbff..7574dbb52137716473d84324a70db9181d1858fc 100644 (file)
@@ -97,11 +97,6 @@ namespace Microsoft.Diagnostics.Tools.Counters.Exporters
 
         private string JsonEscape(string input)
         {
-            if (input is null)
-            {
-                return string.Empty;
-            }
-
             int offset = input.IndexOfAny(s_escapeChars);
             if(offset == -1)
             {
index 75e425edf1c8c5e0f49f5f9790b83b223c82274a..4269c0cec244a20e1f4d46a8d51a8cf49743ca9d 100644 (file)
@@ -35,8 +35,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
             string port,
             bool resumeRuntime,
             int maxHistograms,
-            int maxTimeSeries,
-            TimeSpan duration);
+            int maxTimeSeries);
         delegate Task<int> MonitorDelegate(
             CancellationToken ct,
             List<string> counter_list,
@@ -48,8 +47,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
             string port,
             bool resumeRuntime,
             int maxHistograms,
-            int maxTimeSeries,
-            TimeSpan duration);
+            int maxTimeSeries);
 
         private static Command MonitorCommand() =>
             new Command(
@@ -67,8 +65,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
                 DiagnosticPortOption(),
                 ResumeRuntimeOption(),
                 MaxHistogramOption(),
-                MaxTimeSeriesOption(),
-                DurationOption()
+                MaxTimeSeriesOption()
             };
         
         private static Command CollectCommand() =>
@@ -89,8 +86,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
                 DiagnosticPortOption(),
                 ResumeRuntimeOption(),
                 MaxHistogramOption(),
-                MaxTimeSeriesOption(),
-                DurationOption()
+                MaxTimeSeriesOption()
             };
 
         private static Option NameOption() =>
@@ -199,14 +195,6 @@ namespace Microsoft.Diagnostics.Tools.Counters
                 Argument = new Argument<int>(name: "maxTimeSeries", getDefaultValue: () => 1000)
             };
 
-        private static Option DurationOption() =>
-            new Option(
-                alias: "--duration",
-                description: @"When specified, will run for the given timespan and then automatically stop. Provided in the form of dd:hh:mm:ss.")
-            {
-                Argument = new Argument<TimeSpan>(name: "duration-timespan", getDefaultValue: () => default)
-            };
-
         private static readonly string[] s_SupportedRuntimeVersions = new[] { "3.0", "3.1", "5.0" };
 
         public static int List(IConsole console, string runtimeVersion)
index 8e0f922ea32c9bf0f6234bf977d4c9410cd3c12f..7b9e08a8ede5473f4e367f4d678e3f5cde528f09 100644 (file)
@@ -146,7 +146,7 @@ namespace Microsoft.Diagnostics.Tools.DiagnosticsServerRouter
 
             var currentColor = Console.ForegroundColor;
             Console.ForegroundColor = ConsoleColor.Yellow;
-            Console.WriteLine("WARNING: dotnet-dsrouter is a development tool not intended for production environments." + Environment.NewLine);
+            Console.WriteLine("WARNING: dotnet-dsrouter is an experimental development tool not intended for production environments." + Environment.NewLine);
             Console.ForegroundColor = currentColor;
 
             var parser = new CommandLineBuilder()
index 73fd6f82e397b1247924a914cadc704535548501..73a3db1203969db2a7553a504927ebc25eba21b8 100644 (file)
@@ -8,6 +8,7 @@
     <Description>.NET Performance Diagnostic Server Router Tool</Description>
     <PackageTags>Diagnostic</PackageTags>
     <PackageReleaseNotes>$(Description)</PackageReleaseNotes>
+    <IsShipping>false</IsShipping>
   </PropertyGroup>
 
   <ItemGroup>
index ce8ec9d5c9161056f0c01431c27d5b9eade8c268..8d9140a96d87af18a1da4f49756eead1645980ee 100644 (file)
@@ -34,7 +34,7 @@ namespace Microsoft.Diagnostics.Tools.Dump
         {
         }
 
-        public int Collect(IConsole console, int processId, string output, bool diag, bool crashreport, DumpTypeOption type, string name)
+        public int Collect(IConsole console, int processId, string output, bool diag, DumpTypeOption type, string name)
         {
             Console.WriteLine(name);
             if (name != null)
@@ -86,12 +86,6 @@ namespace Microsoft.Diagnostics.Tools.Dump
 
                 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 {
-                    if (crashreport)
-                    {
-                        Console.WriteLine("Crash reports not supported on Windows.");
-                        return 0;
-                    }
-
                     // Get the process
                     Process process = Process.GetProcessById(processId);
 
@@ -118,17 +112,8 @@ namespace Microsoft.Diagnostics.Tools.Dump
                             break;
                     }
 
-                    WriteDumpFlags flags = WriteDumpFlags.None;
-                    if (diag)
-                    {
-                        flags |= WriteDumpFlags.LoggingEnabled;
-                    }
-                    if (crashreport)
-                    {
-                        flags |= WriteDumpFlags.CrashReportEnabled;
-                    }
                     // Send the command to the runtime to initiate the core dump
-                    client.WriteDump(dumpType, output, flags);
+                    client.WriteDump(dumpType, output, diag);
                 }
             }
             catch (Exception ex) when 
index aed69c55bc31b0d3b78720a2441459810efc037a..f3b2bafbc3219f69092157358043c085ebd667d7 100644 (file)
@@ -32,9 +32,9 @@ namespace Microsoft.Diagnostics.Tools.Dump
             new Command( name: "collect", description: "Capture dumps from a process")
             {
                 // Handler
-                CommandHandler.Create<IConsole, int, string, bool, bool, Dumper.DumpTypeOption, string>(new Dumper().Collect),
+                CommandHandler.Create<IConsole, int, string, bool, Dumper.DumpTypeOption, string>(new Dumper().Collect),
                 // Options
-                ProcessIdOption(), OutputOption(), DiagnosticLoggingOption(), CrashReportOption(), TypeOption(), ProcessNameOption()
+                ProcessIdOption(), OutputOption(), DiagnosticLoggingOption(), TypeOption(), ProcessNameOption()
             };
 
         private static Option ProcessIdOption() =>
@@ -70,14 +70,6 @@ on Linux where YYYYMMDD is Year/Month/Day and HHMMSS is Hour/Minute/Second. Othe
                 Argument = new Argument<bool>(name: "diag")
             };
 
-        private static Option CrashReportOption() =>
-            new Option(
-                alias: "--crashreport", 
-                description: "Enable crash report generation.") 
-            {
-                Argument = new Argument<bool>(name: "crashreport")
-            };
-
         private static Option TypeOption() =>
             new Option(
                 alias: "--type",
index aef932e99512d3884532b470df9063077d4ba9de..0766ae56856cfed6cbc0ce715e8b01d379e8490a 100644 (file)
@@ -201,21 +201,14 @@ namespace Microsoft.Diagnostics.Tools.Trace
                 }
                 curIdx += 1;
             }
-            if(valStart > valEnd)
-            {
-                valEnd = curIdx;
-            }
-            if (keyStart < keyEnd)
-            {
-                AddKeyValueToArgumentDict(argumentDict, argument, keyStart, keyEnd, valStart, valEnd);
-            }
+            AddKeyValueToArgumentDict(argumentDict, argument, keyStart, keyEnd, valStart, valEnd);
             return argumentDict;
         }
 
         private static void AddKeyValueToArgumentDict(Dictionary<string, string> argumentDict, string argument, int keyStart, int keyEnd, int valStart, int valEnd)
         {
             string key = argument.Substring(keyStart, keyEnd - keyStart);
-            string val = argument.Substring(valStart, valEnd - valStart);
+            string val = argument.Substring(valStart);
             if (val.StartsWith("\"") && val.EndsWith("\""))
             {
                 val = val.Substring(1, val.Length - 2);
index 526eeec15588057a9713a337f5d44db033950640..0671d865dc2121b52ab98bb8c97f112071f71a9d 100644 (file)
@@ -1,7 +1,7 @@
-if(CLR_CMAKE_HOST_UNIX)
+if(CLR_CMAKE_PLATFORM_UNIX)
     include_directories(${ROOT_DIR}/src/pal/inc)
     include_directories(${ROOT_DIR}/src/pal/inc/rt)
-endif(CLR_CMAKE_HOST_UNIX)
+endif(CLR_CMAKE_PLATFORM_UNIX)
 
 set( CORGUIDS_IDL_SOURCES
   cordebug.idl
@@ -70,4 +70,4 @@ if(FEATURE_JIT_PITCHING)
 endif(FEATURE_JIT_PITCHING)
 
 # Compile *_i.cpp to lib
-add_library(corguids ${CORGUIDS_SOURCES})
+_add_library(corguids ${CORGUIDS_SOURCES})
index 7597c3fb1e6f07a971f5fd78949b50dc66c5c837..58eca09916973b17763c4930ffb0a27fc75b9f77 100644 (file)
@@ -284,7 +284,11 @@ PAL_IsDebuggerPresent(VOID);
 
 #ifndef PAL_STDCPP_COMPAT
 
+#if _WIN64 || _MSC_VER >= 1400
 typedef __int64 time_t;
+#else
+typedef long time_t;
+#endif
 #define _TIME_T_DEFINED
 #endif // !PAL_STDCPP_COMPAT
 
index 7326efe99fe5b9a70bbb66c6f97b7bf00d9365ee..442caf349bcc0b3965206ebcce66a449e5c19d9c 100644 (file)
@@ -41,15 +41,15 @@ if(CLR_CROSS_COMPONENTS_BUILD)
         message(FATAL_ERROR "Only AMD64, I386 host for cross-architecture component is supported")
     endif()
 else()
-    if(CLR_CMAKE_HOST_ARCH_AMD64)
+    if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
         set(PAL_CMAKE_PLATFORM_ARCH_AMD64 1)
-    elseif(CLR_CMAKE_HOST_ARCH_ARM)
+    elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
         set(PAL_CMAKE_PLATFORM_ARCH_ARM 1)
-    elseif(CLR_CMAKE_HOST_ARCH_ARM64)
+    elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
         set(PAL_CMAKE_PLATFORM_ARCH_ARM64 1)
-    elseif(CLR_CMAKE_HOST_ARCH_I386)
+    elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
         set(PAL_CMAKE_PLATFORM_ARCH_I386 1)
-    elseif(CLR_CMAKE_HOST_ARCH_MIPS64)
+    elseif(CLR_CMAKE_PLATFORM_ARCH_MIPS64)
         set(PAL_CMAKE_PLATFORM_ARCH_MIPS64 1)
     else()
         message(FATAL_ERROR "Only ARM, AMD64, ARM64, MIPS64 and I386 is supported")
@@ -90,18 +90,18 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
   )
 endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
 
-if(PAL_CMAKE_PLATFORM_ARCH_AMD64 AND CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CLR_CMAKE_HOST_ALPINE_LINUX)
+if(PAL_CMAKE_PLATFORM_ARCH_AMD64 AND CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CLR_CMAKE_PLATFORM_ALPINE_LINUX)
   # Currently the _xstate is not available on Alpine Linux
   add_definitions(-DXSTATE_SUPPORTED)
-endif(PAL_CMAKE_PLATFORM_ARCH_AMD64 AND CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CLR_CMAKE_HOST_ALPINE_LINUX)
+endif(PAL_CMAKE_PLATFORM_ARCH_AMD64 AND CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CLR_CMAKE_PLATFORM_ALPINE_LINUX)
 
-if(CLR_CMAKE_HOST_ALPINE_LINUX)
+if(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
   # Setting RLIMIT_NOFILE breaks debugging of coreclr on Alpine Linux for some reason
   add_definitions(-DDONT_SET_RLIMIT_NOFILE)
   # On Alpine Linux, we need to ensure that the reported stack range for the primary thread is
   # larger than the initial committed stack size.
   add_definitions(-DENSURE_PRIMARY_STACK_SIZE)
-endif(CLR_CMAKE_HOST_ALPINE_LINUX)
+endif(CLR_CMAKE_PLATFORM_ALPINE_LINUX)
 
 # turn off capability to remove unused functions (which was enabled in debug build with sanitizers)
 set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--no-gc-sections")
@@ -198,7 +198,7 @@ set(SOURCES
   thread/thread.cpp
 )
 
-add_library(coreclrpal
+_add_library(coreclrpal
   STATIC
   ${SOURCES}
   ${ARCH_SOURCES}
@@ -227,7 +227,7 @@ endif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
 
 if(CMAKE_SYSTEM_NAME STREQUAL Linux)
   # On Android, we don't need to link with gcc_s, pthread and rt
-  if(NOT CLR_CMAKE_HOST_ANDROID)
+  if(NOT CLR_CMAKE_PLATFORM_ANDROID)
     target_link_libraries(coreclrpal
       gcc_s
       pthread
@@ -235,7 +235,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
     )
   endif()
 
-  if(CLR_CMAKE_HOST_ANDROID)
+  if(CLR_CMAKE_PLATFORM_ANDROID)
     find_library(LZMA NAMES lzma)
 
     if(LZMA STREQUAL LZMA-NOTFOUND)
index 1570b2d2d40a440a9879373d8084897e70120b34..0b9f0e6aa060f85f08a656e66922656d0a3865ac 100644 (file)
@@ -1075,7 +1075,7 @@ int main()
 }" HAVE_FULLY_FEATURED_PTHREAD_MUTEXES)
 set(CMAKE_REQUIRED_LIBRARIES)
 
-if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
+if(NOT CLR_CMAKE_PLATFORM_ARCH_ARM AND NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
   set(CMAKE_REQUIRED_LIBRARIES pthread)
   check_cxx_source_runs("
   // This test case verifies the pthread process-shared robust mutex's cross-process abandon detection. The parent process starts
index b1aad957e215a3f730ed8fa7e21ebf1c38195e5f..b8ccda6ef0198b5bcd829b7325ee59ae840adb76 100644 (file)
@@ -207,12 +207,7 @@ PAL_time(PAL_time_t *tloc)
     PERF_ENTRY(time);
     ENTRY( "time( tloc=%p )\n",tloc );
 
-    time_t t;
-    result = time(&t);
-    if (tloc != NULL)
-    {
-        *tloc = t;
-    }
+    result = time(tloc);
 
     LOGEXIT( "time returning %#lx\n",result );
     PERF_EXIT(time);
index f8cf5eaa29c53b421e71bf03256a797caf744c70..aa11eba906698c4373df52f533a8c98e15346c48 100644 (file)
@@ -25,7 +25,7 @@ set(PALRT_SOURCES
     variant.cpp
 )
 
-add_library(palrt
+_add_library(palrt
     STATIC
     ${PALRT_SOURCES}
 )
index 2b3b1b78a8538c71e4117e4853b17a27d6cf6fac..b744b86dfc6fc0f6e96ebf461426d915cd133579 100644 (file)
@@ -65,10 +65,6 @@ namespace Microsoft.Diagnostics.DebugServices.UnitTests
         [SkippableTheory, MemberData(nameof(GetConfigurations))]
         public void ModuleTests(TestHost host)
         {
-            if (OS.Kind == OSKind.Windows)
-            {
-                throw new SkipTestException("Test unstable on Windows. Issue: https://github.com/dotnet/diagnostics/issues/2709");
-            }
             var moduleService = host.Target.Services.GetService<IModuleService>();
             Assert.NotNull(moduleService);
 
@@ -241,10 +237,6 @@ namespace Microsoft.Diagnostics.DebugServices.UnitTests
         [SkippableTheory, MemberData(nameof(GetConfigurations))]
         public void RuntimeTests(TestHost host)
         {
-            if (OS.Kind == OSKind.Windows)
-            {
-                throw new SkipTestException("Test unstable on Windows. Issue: https://github.com/dotnet/diagnostics/issues/2709");
-            }
             // The current Linux test assets are not alpine/musl
             if (OS.IsAlpine)
             {
index f7af9dd2df395b92248b8f8453b8ad6737905be5..99f49d6ddce1252ed5237965a946677deb97ad43 100644 (file)
@@ -71,7 +71,6 @@ namespace Microsoft.Diagnostics.DebugServices.UnitTests
             /// <param name="result">resulting object</param>
             public static void GetValue(Type type, string valueString, ref object result)
             {
-                valueString = valueString.Trim();
                 if (type == typeof(string))
                 {
                     result = valueString ?? "";
@@ -288,24 +287,24 @@ namespace Microsoft.Diagnostics.DebugServices.UnitTests
 
                             if (nullableType != null && memberValue == null)
                             {
-                                memberValue = string.Empty;
+                                memberValue = "";
                             }
                             else if (memberType == typeof(string))
                             {
-                                memberValue ??= string.Empty;
+                                memberValue ??= "";
                             }
                             else if (memberValue is ImmutableArray<byte> buildId)
                             {
                                 memberType = typeof(string);
-                                memberValue = !buildId.IsDefaultOrEmpty ? string.Concat(buildId.Select((b) => b.ToString("x2"))) : string.Empty;
+                                memberValue = !buildId.IsDefaultOrEmpty ? string.Concat(buildId.Select((b) => b.ToString("x2"))) : "";
                             }
                             else if (!memberType.IsPrimitive && !memberType.IsEnum)
                             {
                                 memberType = typeof(string);
-                                memberValue = memberValue?.ToString() ?? string.Empty;
+                                memberValue = memberValue?.ToString() ?? "";
                             }
                             object testDataValue = testData.Value.GetValue(memberType);
-                            Trace.TraceInformation($"CompareMembers {testData.Key}: '{memberValue}' == '{testDataValue}'");
+                            Trace.TraceInformation($"CompareMembers {testData.Key}: {memberValue} == {testDataValue}");
                             Assert.Equal(memberValue, testDataValue);
                         }
                     }
index 110cd2839f6c15a7d01228d64b7feb8304b778a7..9fba018a7d77d81588be06b962bf18102aebce02 100644 (file)
@@ -188,47 +188,6 @@ namespace Microsoft.Diagnostics.Tools.Trace
             Assert.True(providerThree.Arguments["FilterAndPayloadSpecs"] == "QuotedValue:-\r\nQuoted/Value:-A=B;C=D;");
         }
 
-        [Fact]
-        public void ProvidersWithComplexFilters_CorrectlyParse()
-        {
-            string providersToParse = @"MyProvider:::A=B;C=D";
-            List<EventPipeProvider> parsedProviders = Extensions.ToProviders(providersToParse);
-            Assert.Single(parsedProviders);
-            EventPipeProvider providerOne = parsedProviders[0];
-            Assert.Equal("MyProvider", providerOne.Name);
-            Assert.Equal(2, providerOne.Arguments.Count);
-            Assert.Equal("B", providerOne.Arguments["A"]);
-            Assert.Equal("D", providerOne.Arguments["C"]);
-
-            providersToParse = @"MyProvider:::A=B;C=""D"",MyProvider2:::A=1;B=2;";
-            parsedProviders = Extensions.ToProviders(providersToParse);
-            Assert.Equal(2, parsedProviders.Count);
-            providerOne = parsedProviders[0];
-            EventPipeProvider providerTwo = parsedProviders[1];
-            Assert.Equal("MyProvider", providerOne.Name);
-            Assert.Equal("MyProvider2", providerTwo.Name);
-            Assert.Equal(2, providerOne.Arguments.Count);
-            Assert.Equal("B", providerOne.Arguments["A"]);
-            Assert.Equal("D", providerOne.Arguments["C"]);
-            Assert.Equal(2, providerTwo.Arguments.Count);
-            Assert.Equal("1", providerTwo.Arguments["A"]);
-            Assert.Equal("2", providerTwo.Arguments["B"]);
-
-            providersToParse = @"MyProvider:::A=""B;C=D"",MyProvider2:::A=""spaced words"";C=1285;D=Spaced Words 2";
-            parsedProviders = Extensions.ToProviders(providersToParse);
-            Assert.Equal(2, parsedProviders.Count);
-            providerOne = parsedProviders[0];
-            providerTwo = parsedProviders[1];
-            Assert.Equal("MyProvider", providerOne.Name);
-            Assert.Equal("MyProvider2", providerTwo.Name);
-            Assert.Equal(1, providerOne.Arguments.Count);
-            Assert.Equal(3, providerTwo.Arguments.Count);
-            Assert.Equal("B;C=D", providerOne.Arguments["A"]);
-            Assert.Equal("spaced words", providerTwo.Arguments["A"]);
-            Assert.Equal("Spaced Words 2", providerTwo.Arguments["D"]);
-            Assert.Equal("1285", providerTwo.Arguments["C"]);
-        }
-
         [Theory]
         [InlineData("ProviderOne:0x1:Verbose")]
         [InlineData("ProviderOne:0x1:verbose")]