From 6b7f9eb634def20ea90faefa1c160f9f852237fe Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 02:45:03 -0600 Subject: [PATCH 01/38] WIP FreeBSD NativeAOT --- eng/Subsets.props | 4 ++-- eng/Versions.props | 2 ++ eng/targetingpacks.targets | 8 ++++---- src/coreclr/CMakeLists.txt | 2 +- ...rosoft.DotNet.ILCompiler.SingleEntry.targets | 1 + .../Microsoft.NETCore.Native.Unix.targets | 4 ++++ src/coreclr/tools/Common/CommandLineHelpers.cs | 2 ++ .../tools/SuperFileCheck/SuperFileCheck.csproj | 5 +++-- .../tools/aot/ILCompiler/ILCompiler.props | 5 +++-- .../aot/ILCompiler/ILCompilerRootCommand.cs | 2 +- .../tools/aot/ILCompiler/repro/repro.csproj | 2 +- .../tools/aot/crossgen2/Crossgen2RootCommand.cs | 2 +- .../tools/aot/crossgen2/crossgen2.csproj | 3 +++ src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj | 4 ++-- .../Bundle/TargetInfo.cs | 9 +++++---- .../ILCompilerRIDs.props | 1 + .../Microsoft.NETCore.App.Crossgen2.sfxproj | 2 +- .../Microsoft.NETCore.App.Bundle.bundleproj | 2 +- src/mono/cmake/configure.cmake | 2 +- .../ResolveReadyToRunCompilers.cs | 17 +++++++++++++++++ 20 files changed, 56 insertions(+), 23 deletions(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index 9e666f71fe0a6..0059d21ec9c90 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -99,7 +99,7 @@ - true + true true @@ -314,7 +314,7 @@ - + diff --git a/eng/Versions.props b/eng/Versions.props index 7882b339f24e7..ba92c758273b6 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -110,6 +110,7 @@ 1.0.0-alpha.1.22517.1 1.0.0-alpha.1.22517.1 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22478.1 6.0.0 1.1.1 @@ -237,5 +238,6 @@ 1.0.0-alpha.1.22517.1 1.0.0-alpha.1.22517.1 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22478.1 diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets index 744a0cd20b469..b9938394f3a3e 100644 --- a/eng/targetingpacks.targets +++ b/eng/targetingpacks.targets @@ -31,7 +31,7 @@ LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimeFrameworkName="$(LocalFrameworkOverrideName)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64" + RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;freebsd-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64" TargetFramework="$(NetCoreAppCurrent)" TargetingPackName="$(LocalFrameworkOverrideName).Ref" TargetingPackVersion="$(ProductVersion)" @@ -41,20 +41,20 @@ RuntimeFrameworkName="$(LocalFrameworkOverrideName)" LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-armv6;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" + RuntimePackRuntimeIdentifiers="linux-arm;linux-armv6;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;freebsd-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" RuntimePackLabels="Mono" Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/> diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index c28c30514832d..253ac0a491712 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -139,7 +139,7 @@ add_subdirectory(tools/aot/jitinterface) if(NOT CLR_CROSS_COMPONENTS_BUILD) # NativeAOT only buildable for a subset of CoreCLR-supported configurations - if((CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_WIN32) AND (CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_AMD64)) + if((CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_WIN32 OR CLR_CMAKE_HOST_FREEBSD) AND (CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_AMD64)) add_subdirectory(nativeaot) endif() endif(NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index 1b3d56e863c3f..763d59b4d6a99 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -4,6 +4,7 @@ win osx + freebsd linux-musl linux diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 7710daf3a00d3..e34fbdba33bdb 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -143,6 +143,10 @@ The .NET Foundation licenses this file to you under the MIT license. objcopy + + llvm-objcopy11 + + diff --git a/src/coreclr/tools/Common/CommandLineHelpers.cs b/src/coreclr/tools/Common/CommandLineHelpers.cs index d4f4b002aa429..831b9b14b0cad 100644 --- a/src/coreclr/tools/Common/CommandLineHelpers.cs +++ b/src/coreclr/tools/Common/CommandLineHelpers.cs @@ -76,6 +76,8 @@ public static TargetOS GetTargetOS(string token) return TargetOS.Linux; else if (token.Equals("osx", StringComparison.OrdinalIgnoreCase)) return TargetOS.OSX; + else if (token.Equals("freebsd", StringComparison.OrdinalIgnoreCase)) + return TargetOS.FreeBSD; throw new CommandLineException($"Target OS '{token}' is not supported"); } diff --git a/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj b/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj index f4825414ceec6..9c7e483637ec6 100644 --- a/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj +++ b/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj @@ -19,8 +19,8 @@ $(OutputRid.Substring(0, $(_jitToolsRidPlatformIndex))) $(OutputRid.Substring($(_jitToolsRidPlatformIndex)).TrimStart('-')) - - linux + + linux osx.10.12 @@ -39,6 +39,7 @@ $(runtimewinx64MicrosoftNETCoreRuntimeJITToolsVersion) $(runtimeosx110arm64MicrosoftNETCoreRuntimeJITToolsVersion) $(runtimeosx1012x64MicrosoftNETCoreRuntimeJITToolsVersion) + $(runtimefreebsdx64MicrosoftNETCoreRuntimeJITToolsVersion) diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props index e6fbee0a3a8ce..3b790fc37526a 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props @@ -28,8 +28,8 @@ $(RuntimeIdentifier.Substring(0, $(_objWriterRidPlatformIndex))) $(RuntimeIdentifier.Substring($(_objWriterRidPlatformIndex)).TrimStart('-')) - - linux + + linux osx.10.12 @@ -45,6 +45,7 @@ $(runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion) $(runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion) $(runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion) + $(runtimefreebsdx64MicrosoftNETCoreRuntimeObjWriterVersion) true diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs index 483e94552f687..c95d5fab1112f 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs +++ b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs @@ -303,7 +303,7 @@ public static IEnumerable GetExtendedHelp(HelpContext _) "considered to be input files. If no input files begin with '--' then this option is not necessary.\n"); string[] ValidArchitectures = new string[] { "arm", "arm64", "x86", "x64" }; - string[] ValidOS = new string[] { "windows", "linux", "osx" }; + string[] ValidOS = new string[] { "windows", "linux", "osx", "freebsd" }; Console.WriteLine("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetos", string.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant()); diff --git a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj index e18578f349ccb..f8afb2433a722 100644 --- a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj +++ b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj @@ -6,7 +6,7 @@ AnyCPU false false - linux-x64;win-x64;osx-x64 + linux-x64;win-x64;osx-x64;freebsd-x64 Debug;Release;Checked true false diff --git a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs index 6d9a0b80caab1..4443905b37d54 100644 --- a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs +++ b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs @@ -321,7 +321,7 @@ public static IEnumerable GetExtendedHelp(HelpContext _) Console.WriteLine(); string[] ValidArchitectures = new string[] {"arm", "armel", "arm64", "x86", "x64"}; - string[] ValidOS = new string[] {"windows", "linux", "osx"}; + string[] ValidOS = new string[] {"windows", "linux", "osx", "freebsd" }; Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant())); Console.WriteLine(); diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj index 9ce085ee29832..abbc77eb0596a 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj @@ -33,6 +33,9 @@ $(CoreCLRCrossILCompilerDir) clang-15 clang-9 + + + clang11 $(ROOTFS_DIR) $(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll $(CoreCLRAotSdkDir) diff --git a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj index b959b09a52179..d54081802a1c3 100644 --- a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj +++ b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj @@ -9,11 +9,11 @@ $(RuntimeBinDir)/dotnet-pgo true false - linux-x64;linux-musl-x64;win-x64 + linux-x64;linux-musl-x64;win-x64;freebsd-x64 true true dotnet-pgo - win-x64;win-x86;win-arm;osx-x64 + win-x64;win-x86;win-arm;osx-x64;freebsd-x64 $(OutputPath) false .NET Performance Guided Optimization Tool diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index b29a102bf6e59..ecd31f9570788 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -35,7 +35,7 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer Arch = arch ?? RuntimeInformation.OSArchitecture; FrameworkVersion = targetFrameworkVersion ?? net60; - Debug.Assert(IsLinux || IsOSX || IsWindows); + Debug.Assert(IsLinux || IsOSX || IsWindows || IsFreeBSD); if (FrameworkVersion.CompareTo(net60) >= 0) { @@ -79,7 +79,7 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer public bool IsNativeBinary(string filePath) { - return IsLinux ? ElfUtils.IsElfImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : PEUtils.IsPEImage(filePath); + return IsLinux ? ElfUtils.IsElfImage(filePath) : IsFreeBSD ? ElfUtils.IsElfImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : PEUtils.IsPEImage(filePath); } public string GetAssemblyName(string hostName) @@ -91,17 +91,18 @@ public string GetAssemblyName(string hostName) public override string ToString() { - string os = IsWindows ? "win" : IsLinux ? "linux" : "osx"; + string os = IsWindows ? "win" : IsLinux ? "linux" : IsFreeBSD ? "freebsd" : "osx"; string arch = Arch.ToString().ToLowerInvariant(); return $"OS: {os} Arch: {arch} FrameworkVersion: {FrameworkVersion}"; } private static OSPlatform HostOS => RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? OSPlatform.Linux : - RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : OSPlatform.Windows; + RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD) ? OSPlatform.FreeBSD : OSPlatform.Windows; public bool IsLinux => OS.Equals(OSPlatform.Linux); public bool IsOSX => OS.Equals(OSPlatform.OSX); public bool IsWindows => OS.Equals(OSPlatform.Windows); + public bool IsFreeBSD => OS.Equals(OSPlatform.FreeBSD); // The .net core 3 apphost doesn't care about semantics of FileType -- all files are extracted at startup. // However, the apphost checks that the FileType value is within expected bounds, so set it to the first enumeration. diff --git a/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props b/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props index 70e13f311b74a..8cd82c085c1a6 100644 --- a/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props +++ b/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props @@ -9,5 +9,6 @@ + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj index 2e0ef08ec3469..ef8f7c3899d5b 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj @@ -4,7 +4,7 @@ - true + true ToolPack $(SharedFrameworkName).Crossgen2 .PGO diff --git a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj index 90f8d4ad2a28f..33f2c2652efac 100644 --- a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj +++ b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj @@ -11,7 +11,7 @@ $(MSBuildProjectDirectory) dotnet-runtime dotnet-runtime - win-x86;win-x64;win-arm64;osx-x64;osx-arm64 + win-x86;win-x64;win-arm64;osx-x64;osx-arm64;freebsd-x64 Runtime $(MSBuildProjectDirectory)/shared-framework-distribution-template-$(TargetArchitecture).xml com.microsoft.dotnet.Microsoft.NETCore.App.$(ProductVersion).osx.$(TargetArchitecture) diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake index ae55fd112b321..90ac8a543e27d 100644 --- a/src/mono/cmake/configure.cmake +++ b/src/mono/cmake/configure.cmake @@ -160,7 +160,7 @@ check_c_source_compiles( #include int main(void) { - CPU_COUNT((void *) 0); + CPU_COUNT((cpuset_t *) 0); return 0; } " diff --git a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs index aac7b19ab7081..3900b4a94ed95 100644 --- a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs +++ b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs @@ -149,6 +149,7 @@ private bool ValidateCrossgen2Support() "linux-musl" => "linux", "osx" => "osx", "win" => "windows", + "freebsd" => "freebsd", _ => null }; @@ -334,6 +335,17 @@ private bool GetCrossgenComponentsPaths() _crossgenTool.ToolPath = Path.Combine(_crossgenTool.PackagePath, "tools", "crossgen"); _crossgenTool.ClrJitPath = Path.Combine(_crossgenTool.PackagePath, "runtimes", _targetRuntimeIdentifier, "native", "libclrjit.dylib"); } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) + { + // Only x64 supported for FreeBSD + if (_targetArchitecture != Architecture.X64 || RuntimeInformation.OSArchitecture != Architecture.X64) + { + return false; + } + + _crossgenTool.ToolPath = Path.Combine(_crossgenTool.PackagePath, "tools", "crossgen"); + _crossgenTool.ClrJitPath = Path.Combine(_crossgenTool.PackagePath, "runtimes", _targetRuntimeIdentifier, "native", "libclrjit.so"); + } else { // Unknown platform @@ -362,6 +374,11 @@ private bool GetCrossgen2ComponentsPaths(bool version5) toolFileName = "crossgen2"; v5_clrJitFileNamePattern = "libclrjit-{0}.dylib"; } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) + { + toolFileName = "crossgen2"; + v5_clrJitFileNamePattern = "libclrjit-{0}.so"; + } else { // Unknown platform From f5ec5ff8f93bd9410a28b7c4add157b91047099f Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 11:22:55 -0700 Subject: [PATCH 02/38] add inotify for FreeBSD during linking --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index e34fbdba33bdb..1b708d599f0e3 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -118,6 +118,8 @@ The .NET Foundation licenses this file to you under the MIT license. + + From c963dcfb47bd7e4feaa6bd207fae7aff0365ca12 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 12:26:54 -0700 Subject: [PATCH 03/38] remove FreeBSD for now --- .../pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj index 33f2c2652efac..90f8d4ad2a28f 100644 --- a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj +++ b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj @@ -11,7 +11,7 @@ $(MSBuildProjectDirectory) dotnet-runtime dotnet-runtime - win-x86;win-x64;win-arm64;osx-x64;osx-arm64;freebsd-x64 + win-x86;win-x64;win-arm64;osx-x64;osx-arm64 Runtime $(MSBuildProjectDirectory)/shared-framework-distribution-template-$(TargetArchitecture).xml com.microsoft.dotnet.Microsoft.NETCore.App.$(ProductVersion).osx.$(TargetArchitecture) From cb52a2c3b3e0ec1364ca3e02d9ae9d799058a51b Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:31:20 -0700 Subject: [PATCH 04/38] netstandard does not understand FreeBSD --- .../Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj index 679289bca37a4..ceebcf4699935 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj +++ b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0 Abstractions for modifying .NET host binaries false true From 74b5546f64aa84640ac6e85b3f7e132a27222f85 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:35:59 -0700 Subject: [PATCH 05/38] add FreeBSD platform to HostModel Tests --- .../tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs index 22647a92f37a2..a559f73d72fc2 100644 --- a/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs +++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs @@ -129,6 +129,7 @@ public static OSPlatform GetTargetOS(string runtimeIdentifier) "win" => OSPlatform.Windows, "osx" => OSPlatform.OSX, "linux" => OSPlatform.Linux, + "freebsd" => OSPlatform.FreeBSD, _ => throw new ArgumentException(nameof(runtimeIdentifier)) }; } From 1be1473edeca8faea65bd8994a2702b222f10e57 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 02:45:03 -0600 Subject: [PATCH 06/38] WIP FreeBSD NativeAOT --- eng/Subsets.props | 4 ++-- eng/Versions.props | 14 ++++++++++++++ eng/targetingpacks.targets | 8 ++++---- src/coreclr/CMakeLists.txt | 2 +- ...rosoft.DotNet.ILCompiler.SingleEntry.targets | 1 + .../Microsoft.NETCore.Native.Unix.targets | 4 ++++ src/coreclr/tools/Common/CommandLineHelpers.cs | 2 ++ .../tools/SuperFileCheck/SuperFileCheck.csproj | 5 +++-- .../tools/aot/ILCompiler/ILCompiler.props | 5 +++-- .../aot/ILCompiler/ILCompilerRootCommand.cs | 2 +- .../tools/aot/ILCompiler/repro/repro.csproj | 2 +- .../tools/aot/crossgen2/Crossgen2RootCommand.cs | 2 +- .../tools/aot/crossgen2/crossgen2.csproj | 3 +++ src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj | 4 ++-- .../Bundle/TargetInfo.cs | 9 +++++---- .../ILCompilerRIDs.props | 1 + .../Microsoft.NETCore.App.Crossgen2.sfxproj | 2 +- .../Microsoft.NETCore.App.Bundle.bundleproj | 2 +- src/mono/cmake/configure.cmake | 2 +- .../ResolveReadyToRunCompilers.cs | 17 +++++++++++++++++ 20 files changed, 68 insertions(+), 23 deletions(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index 19a2c9da9e5d5..0c47d704b1dbc 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -100,7 +100,7 @@ - true + true true @@ -318,7 +318,7 @@ - + diff --git a/eng/Versions.props b/eng/Versions.props index 82eb2bbd6dd5c..0d84ad9e3620d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -103,6 +103,7 @@ 8.0.0-alpha.1.22559.2 6.0.0 +<<<<<<< HEAD 8.0.0-alpha.1.22559.2 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 @@ -112,6 +113,18 @@ 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 +======= + 8.0.0-alpha.1.22530.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22478.1 +>>>>>>> 0822d9be8b5 (WIP FreeBSD NativeAOT) 6.0.0 1.1.1 @@ -244,5 +257,6 @@ 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 + 1.0.0-alpha.1.22478.1 diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets index 744a0cd20b469..b9938394f3a3e 100644 --- a/eng/targetingpacks.targets +++ b/eng/targetingpacks.targets @@ -31,7 +31,7 @@ LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimeFrameworkName="$(LocalFrameworkOverrideName)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64" + RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;freebsd-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64" TargetFramework="$(NetCoreAppCurrent)" TargetingPackName="$(LocalFrameworkOverrideName).Ref" TargetingPackVersion="$(ProductVersion)" @@ -41,20 +41,20 @@ RuntimeFrameworkName="$(LocalFrameworkOverrideName)" LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-armv6;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" + RuntimePackRuntimeIdentifiers="linux-arm;linux-armv6;linux-arm64;linux-musl-arm64;linux-bionic-arm64;linux-loongarch64;linux-musl-x64;linux-bionic-x64;linux-x64;osx-x64;freebsd-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" RuntimePackLabels="Mono" Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/> diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index c28c30514832d..253ac0a491712 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -139,7 +139,7 @@ add_subdirectory(tools/aot/jitinterface) if(NOT CLR_CROSS_COMPONENTS_BUILD) # NativeAOT only buildable for a subset of CoreCLR-supported configurations - if((CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_WIN32) AND (CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_AMD64)) + if((CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_WIN32 OR CLR_CMAKE_HOST_FREEBSD) AND (CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_AMD64)) add_subdirectory(nativeaot) endif() endif(NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index 1b3d56e863c3f..763d59b4d6a99 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -4,6 +4,7 @@ win osx + freebsd linux-musl linux diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 7710daf3a00d3..e34fbdba33bdb 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -143,6 +143,10 @@ The .NET Foundation licenses this file to you under the MIT license. objcopy + + llvm-objcopy11 + + diff --git a/src/coreclr/tools/Common/CommandLineHelpers.cs b/src/coreclr/tools/Common/CommandLineHelpers.cs index 6e5187facfffe..4cf7fd4e35c28 100644 --- a/src/coreclr/tools/Common/CommandLineHelpers.cs +++ b/src/coreclr/tools/Common/CommandLineHelpers.cs @@ -76,6 +76,8 @@ public static TargetOS GetTargetOS(string token) return TargetOS.Linux; else if (token.Equals("osx", StringComparison.OrdinalIgnoreCase)) return TargetOS.OSX; + else if (token.Equals("freebsd", StringComparison.OrdinalIgnoreCase)) + return TargetOS.FreeBSD; throw new CommandLineException($"Target OS '{token}' is not supported"); } diff --git a/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj b/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj index 793d6690074e4..753543f44e2c7 100644 --- a/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj +++ b/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj @@ -20,8 +20,8 @@ $(OutputRid.Substring(0, $(_jitToolsRidPlatformIndex))) $(OutputRid.Substring($(_jitToolsRidPlatformIndex)).TrimStart('-')) - - linux + + linux osx.10.12 @@ -40,6 +40,7 @@ $(runtimewinx64MicrosoftNETCoreRuntimeJITToolsVersion) $(runtimeosx110arm64MicrosoftNETCoreRuntimeJITToolsVersion) $(runtimeosx1012x64MicrosoftNETCoreRuntimeJITToolsVersion) + $(runtimefreebsdx64MicrosoftNETCoreRuntimeJITToolsVersion) diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props index 98f5a12a4362f..347ead37e8ba2 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props @@ -28,8 +28,8 @@ $(RuntimeIdentifier.Substring(0, $(_objWriterRidPlatformIndex))) $(RuntimeIdentifier.Substring($(_objWriterRidPlatformIndex)).TrimStart('-')) - - linux + + linux osx.10.12 @@ -45,6 +45,7 @@ $(runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion) $(runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion) $(runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion) + $(runtimefreebsdx64MicrosoftNETCoreRuntimeObjWriterVersion) true diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs index d85c275c791da..3eac0a55f5825 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs +++ b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs @@ -306,7 +306,7 @@ public static IEnumerable> GetExtendedHelp(HelpContext _) "considered to be input files. If no input files begin with '--' then this option is not necessary.\n"); string[] ValidArchitectures = new string[] { "arm", "arm64", "x86", "x64" }; - string[] ValidOS = new string[] { "windows", "linux", "osx" }; + string[] ValidOS = new string[] { "windows", "linux", "osx", "freebsd" }; Console.WriteLine("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetos", string.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant()); diff --git a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj index b3a490ed6c078..f2d7f5c109a05 100644 --- a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj +++ b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj @@ -6,7 +6,7 @@ AnyCPU false false - linux-x64;win-x64;osx-x64 + linux-x64;win-x64;osx-x64;freebsd-x64 Debug;Release;Checked true false diff --git a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs index e3918372e42dc..b9b758280096b 100644 --- a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs +++ b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs @@ -327,7 +327,7 @@ public static IEnumerable> GetExtendedHelp(HelpContext _) Console.WriteLine(); string[] ValidArchitectures = new string[] {"arm", "armel", "arm64", "x86", "x64"}; - string[] ValidOS = new string[] {"windows", "linux", "osx"}; + string[] ValidOS = new string[] {"windows", "linux", "osx", "freebsd" }; Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant())); Console.WriteLine(); diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj index 9ce085ee29832..abbc77eb0596a 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj @@ -33,6 +33,9 @@ $(CoreCLRCrossILCompilerDir) clang-15 clang-9 + + + clang11 $(ROOTFS_DIR) $(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll $(CoreCLRAotSdkDir) diff --git a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj index c3d3fc0376671..753801e55d529 100644 --- a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj +++ b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj @@ -9,11 +9,11 @@ $(RuntimeBinDir)/dotnet-pgo true false - linux-x64;linux-musl-x64;win-x64 + linux-x64;linux-musl-x64;win-x64;freebsd-x64 true true dotnet-pgo - win-x64;win-x86;win-arm;osx-x64 + win-x64;win-x86;win-arm;osx-x64;freebsd-x64 $(OutputPath) false .NET Performance Guided Optimization Tool diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index 5a1c0c4fd66a5..2ee67bd211f12 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -35,7 +35,7 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer Arch = arch ?? RuntimeInformation.OSArchitecture; FrameworkVersion = targetFrameworkVersion ?? Environment.Version; - Debug.Assert(IsLinux || IsOSX || IsWindows); + Debug.Assert(IsLinux || IsOSX || IsWindows || IsFreeBSD); if (FrameworkVersion.Major >= 6) { @@ -79,7 +79,7 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer public bool IsNativeBinary(string filePath) { - return IsLinux ? ElfUtils.IsElfImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : PEUtils.IsPEImage(filePath); + return IsLinux ? ElfUtils.IsElfImage(filePath) : IsFreeBSD ? ElfUtils.IsElfImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : PEUtils.IsPEImage(filePath); } public string GetAssemblyName(string hostName) @@ -91,17 +91,18 @@ public string GetAssemblyName(string hostName) public override string ToString() { - string os = IsWindows ? "win" : IsLinux ? "linux" : "osx"; + string os = IsWindows ? "win" : IsLinux ? "linux" : IsFreeBSD ? "freebsd" : "osx"; string arch = Arch.ToString().ToLowerInvariant(); return $"OS: {os} Arch: {arch} FrameworkVersion: {FrameworkVersion}"; } private static OSPlatform HostOS => RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? OSPlatform.Linux : - RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : OSPlatform.Windows; + RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD) ? OSPlatform.FreeBSD : OSPlatform.Windows; public bool IsLinux => OS.Equals(OSPlatform.Linux); public bool IsOSX => OS.Equals(OSPlatform.OSX); public bool IsWindows => OS.Equals(OSPlatform.Windows); + public bool IsFreeBSD => OS.Equals(OSPlatform.FreeBSD); // The .net core 3 apphost doesn't care about semantics of FileType -- all files are extracted at startup. // However, the apphost checks that the FileType value is within expected bounds, so set it to the first enumeration. diff --git a/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props b/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props index 70e13f311b74a..8cd82c085c1a6 100644 --- a/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props +++ b/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props @@ -9,5 +9,6 @@ + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj index 2e0ef08ec3469..ef8f7c3899d5b 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj @@ -4,7 +4,7 @@ - true + true ToolPack $(SharedFrameworkName).Crossgen2 .PGO diff --git a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj index 90f8d4ad2a28f..33f2c2652efac 100644 --- a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj +++ b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj @@ -11,7 +11,7 @@ $(MSBuildProjectDirectory) dotnet-runtime dotnet-runtime - win-x86;win-x64;win-arm64;osx-x64;osx-arm64 + win-x86;win-x64;win-arm64;osx-x64;osx-arm64;freebsd-x64 Runtime $(MSBuildProjectDirectory)/shared-framework-distribution-template-$(TargetArchitecture).xml com.microsoft.dotnet.Microsoft.NETCore.App.$(ProductVersion).osx.$(TargetArchitecture) diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake index ae55fd112b321..90ac8a543e27d 100644 --- a/src/mono/cmake/configure.cmake +++ b/src/mono/cmake/configure.cmake @@ -160,7 +160,7 @@ check_c_source_compiles( #include int main(void) { - CPU_COUNT((void *) 0); + CPU_COUNT((cpuset_t *) 0); return 0; } " diff --git a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs index aac7b19ab7081..3900b4a94ed95 100644 --- a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs +++ b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs @@ -149,6 +149,7 @@ private bool ValidateCrossgen2Support() "linux-musl" => "linux", "osx" => "osx", "win" => "windows", + "freebsd" => "freebsd", _ => null }; @@ -334,6 +335,17 @@ private bool GetCrossgenComponentsPaths() _crossgenTool.ToolPath = Path.Combine(_crossgenTool.PackagePath, "tools", "crossgen"); _crossgenTool.ClrJitPath = Path.Combine(_crossgenTool.PackagePath, "runtimes", _targetRuntimeIdentifier, "native", "libclrjit.dylib"); } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) + { + // Only x64 supported for FreeBSD + if (_targetArchitecture != Architecture.X64 || RuntimeInformation.OSArchitecture != Architecture.X64) + { + return false; + } + + _crossgenTool.ToolPath = Path.Combine(_crossgenTool.PackagePath, "tools", "crossgen"); + _crossgenTool.ClrJitPath = Path.Combine(_crossgenTool.PackagePath, "runtimes", _targetRuntimeIdentifier, "native", "libclrjit.so"); + } else { // Unknown platform @@ -362,6 +374,11 @@ private bool GetCrossgen2ComponentsPaths(bool version5) toolFileName = "crossgen2"; v5_clrJitFileNamePattern = "libclrjit-{0}.dylib"; } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) + { + toolFileName = "crossgen2"; + v5_clrJitFileNamePattern = "libclrjit-{0}.so"; + } else { // Unknown platform From 3415075314ced6e7c9d070f5327f324cba81a2c5 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 11:22:55 -0700 Subject: [PATCH 07/38] add inotify for FreeBSD during linking --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index e34fbdba33bdb..1b708d599f0e3 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -118,6 +118,8 @@ The .NET Foundation licenses this file to you under the MIT license. + + From 685ceabaedf52a8fdb81837ee82c9678079e83d9 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 12:26:54 -0700 Subject: [PATCH 08/38] remove FreeBSD for now --- .../pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj index 33f2c2652efac..90f8d4ad2a28f 100644 --- a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj +++ b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj @@ -11,7 +11,7 @@ $(MSBuildProjectDirectory) dotnet-runtime dotnet-runtime - win-x86;win-x64;win-arm64;osx-x64;osx-arm64;freebsd-x64 + win-x86;win-x64;win-arm64;osx-x64;osx-arm64 Runtime $(MSBuildProjectDirectory)/shared-framework-distribution-template-$(TargetArchitecture).xml com.microsoft.dotnet.Microsoft.NETCore.App.$(ProductVersion).osx.$(TargetArchitecture) From 845330ad64f4eadaf68e0cb2a0f6ffaeae5e58c2 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:31:20 -0700 Subject: [PATCH 09/38] netstandard does not understand FreeBSD --- .../Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj index 679289bca37a4..ceebcf4699935 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj +++ b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0 Abstractions for modifying .NET host binaries false true From 0f59e5182af5e455ba25be1499f5a486088e8182 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:35:59 -0700 Subject: [PATCH 10/38] add FreeBSD platform to HostModel Tests --- .../tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs index 22647a92f37a2..a559f73d72fc2 100644 --- a/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs +++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs @@ -129,6 +129,7 @@ public static OSPlatform GetTargetOS(string runtimeIdentifier) "win" => OSPlatform.Windows, "osx" => OSPlatform.OSX, "linux" => OSPlatform.Linux, + "freebsd" => OSPlatform.FreeBSD, _ => throw new ArgumentException(nameof(runtimeIdentifier)) }; } From 61ea76358a5521f9181b86e9dfdd1178756a8eae Mon Sep 17 00:00:00 2001 From: TheFrank <1910378+Thefrank@users.noreply.github.com> Date: Mon, 28 Nov 2022 22:42:17 -0700 Subject: [PATCH 11/38] Use Clang12, update LinkerArg --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 4 +++- src/coreclr/tools/aot/crossgen2/crossgen2.csproj | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 1b708d599f0e3..b6be13de554c2 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -118,6 +118,8 @@ The .NET Foundation licenses this file to you under the MIT license. + + @@ -146,7 +148,7 @@ The .NET Foundation licenses this file to you under the MIT license. - llvm-objcopy11 + llvm-objcopy12 diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj index abbc77eb0596a..a76f9d7f0fc16 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj @@ -35,7 +35,7 @@ clang-9 - clang11 + clang12 $(ROOTFS_DIR) $(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll $(CoreCLRAotSdkDir) From d304557ad398554c32776c54d08ff917ddb98e02 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 02:45:03 -0600 Subject: [PATCH 12/38] WIP FreeBSD NativeAOT --- eng/Subsets.props | 4 ++-- eng/Versions.props | 14 ++++++++++++++ eng/targetingpacks.targets | 4 ++-- src/coreclr/CMakeLists.txt | 2 +- ...rosoft.DotNet.ILCompiler.SingleEntry.targets | 1 + .../Microsoft.NETCore.Native.Unix.targets | 4 ++++ src/coreclr/tools/Common/CommandLineHelpers.cs | 2 ++ .../tools/SuperFileCheck/SuperFileCheck.csproj | 5 +++-- .../tools/aot/ILCompiler/ILCompiler.props | 5 +++-- .../aot/ILCompiler/ILCompilerRootCommand.cs | 2 +- .../tools/aot/ILCompiler/repro/repro.csproj | 2 +- .../tools/aot/crossgen2/Crossgen2RootCommand.cs | 2 +- .../tools/aot/crossgen2/crossgen2.csproj | 3 +++ src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj | 4 ++-- .../Bundle/TargetInfo.cs | 9 +++++---- .../ILCompilerRIDs.props | 1 + .../Microsoft.NETCore.App.Crossgen2.sfxproj | 2 +- .../Microsoft.NETCore.App.Bundle.bundleproj | 2 +- src/mono/cmake/configure.cmake | 2 +- .../ResolveReadyToRunCompilers.cs | 17 +++++++++++++++++ 20 files changed, 66 insertions(+), 21 deletions(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index 19a2c9da9e5d5..0c47d704b1dbc 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -100,7 +100,7 @@ - true + true true @@ -318,7 +318,7 @@ - + diff --git a/eng/Versions.props b/eng/Versions.props index 129a2ddcaf618..0f041e2bdd203 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -102,6 +102,7 @@ 8.0.0-alpha.1.22559.2 6.0.0 +<<<<<<< HEAD 8.0.0-alpha.1.22559.2 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 @@ -111,6 +112,18 @@ 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 +======= + 8.0.0-alpha.1.22530.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22478.1 +>>>>>>> 0822d9be8b5 (WIP FreeBSD NativeAOT) 6.0.0 1.1.1 @@ -243,5 +256,6 @@ 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 + 1.0.0-alpha.1.22478.1 diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets index 2d7d89bde1c6e..76f004e0bf870 100644 --- a/eng/targetingpacks.targets +++ b/eng/targetingpacks.targets @@ -35,7 +35,7 @@ LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimeFrameworkName="$(LocalFrameworkOverrideName)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86" + RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;freebsd-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86" TargetFramework="$(NetCoreAppCurrent)" TargetingPackName="$(LocalFrameworkOverrideName).Ref" TargetingPackVersion="$(ProductVersion)" @@ -45,7 +45,7 @@ RuntimeFrameworkName="$(LocalFrameworkOverrideName)" LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" + RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;freebsd-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86" RuntimePackLabels="Mono" Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/> win osx + freebsd linux-musl linux diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 3566ed81025f8..d38efe43b991d 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -146,6 +146,10 @@ The .NET Foundation licenses this file to you under the MIT license. objcopy + + llvm-objcopy11 + + diff --git a/src/coreclr/tools/Common/CommandLineHelpers.cs b/src/coreclr/tools/Common/CommandLineHelpers.cs index 03b20597bb39c..0dd98b220c252 100644 --- a/src/coreclr/tools/Common/CommandLineHelpers.cs +++ b/src/coreclr/tools/Common/CommandLineHelpers.cs @@ -76,6 +76,8 @@ public static TargetOS GetTargetOS(string token) return TargetOS.Linux; else if (token.Equals("osx", StringComparison.OrdinalIgnoreCase)) return TargetOS.OSX; + else if (token.Equals("freebsd", StringComparison.OrdinalIgnoreCase)) + return TargetOS.FreeBSD; throw new CommandLineException($"Target OS '{token}' is not supported"); } diff --git a/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj b/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj index 793d6690074e4..753543f44e2c7 100644 --- a/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj +++ b/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj @@ -20,8 +20,8 @@ $(OutputRid.Substring(0, $(_jitToolsRidPlatformIndex))) $(OutputRid.Substring($(_jitToolsRidPlatformIndex)).TrimStart('-')) - - linux + + linux osx.10.12 @@ -40,6 +40,7 @@ $(runtimewinx64MicrosoftNETCoreRuntimeJITToolsVersion) $(runtimeosx110arm64MicrosoftNETCoreRuntimeJITToolsVersion) $(runtimeosx1012x64MicrosoftNETCoreRuntimeJITToolsVersion) + $(runtimefreebsdx64MicrosoftNETCoreRuntimeJITToolsVersion) diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props index 98f5a12a4362f..347ead37e8ba2 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompiler.props +++ b/src/coreclr/tools/aot/ILCompiler/ILCompiler.props @@ -28,8 +28,8 @@ $(RuntimeIdentifier.Substring(0, $(_objWriterRidPlatformIndex))) $(RuntimeIdentifier.Substring($(_objWriterRidPlatformIndex)).TrimStart('-')) - - linux + + linux osx.10.12 @@ -45,6 +45,7 @@ $(runtimewinx64MicrosoftNETCoreRuntimeObjWriterVersion) $(runtimeosx110arm64MicrosoftNETCoreRuntimeObjWriterVersion) $(runtimeosx1012x64MicrosoftNETCoreRuntimeObjWriterVersion) + $(runtimefreebsdx64MicrosoftNETCoreRuntimeObjWriterVersion) true diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs index 6795f7f47d941..bfbb1fed9c509 100644 --- a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs +++ b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs @@ -306,7 +306,7 @@ public static IEnumerable> GetExtendedHelp(HelpContext _) "considered to be input files. If no input files begin with '--' then this option is not necessary.\n"); string[] ValidArchitectures = new string[] { "arm", "arm64", "x86", "x64" }; - string[] ValidOS = new string[] { "windows", "linux", "osx" }; + string[] ValidOS = new string[] { "windows", "linux", "osx", "freebsd" }; Console.WriteLine("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetos", string.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant()); diff --git a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj index b3a490ed6c078..f2d7f5c109a05 100644 --- a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj +++ b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj @@ -6,7 +6,7 @@ AnyCPU false false - linux-x64;win-x64;osx-x64 + linux-x64;win-x64;osx-x64;freebsd-x64 Debug;Release;Checked true false diff --git a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs index e3918372e42dc..b9b758280096b 100644 --- a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs +++ b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs @@ -327,7 +327,7 @@ public static IEnumerable> GetExtendedHelp(HelpContext _) Console.WriteLine(); string[] ValidArchitectures = new string[] {"arm", "armel", "arm64", "x86", "x64"}; - string[] ValidOS = new string[] {"windows", "linux", "osx"}; + string[] ValidOS = new string[] {"windows", "linux", "osx", "freebsd" }; Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant())); Console.WriteLine(); diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj index 9ce085ee29832..abbc77eb0596a 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj @@ -33,6 +33,9 @@ $(CoreCLRCrossILCompilerDir) clang-15 clang-9 + + + clang11 $(ROOTFS_DIR) $(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll $(CoreCLRAotSdkDir) diff --git a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj index c3d3fc0376671..753801e55d529 100644 --- a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj +++ b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj @@ -9,11 +9,11 @@ $(RuntimeBinDir)/dotnet-pgo true false - linux-x64;linux-musl-x64;win-x64 + linux-x64;linux-musl-x64;win-x64;freebsd-x64 true true dotnet-pgo - win-x64;win-x86;win-arm;osx-x64 + win-x64;win-x86;win-arm;osx-x64;freebsd-x64 $(OutputPath) false .NET Performance Guided Optimization Tool diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index 5a1c0c4fd66a5..2ee67bd211f12 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -35,7 +35,7 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer Arch = arch ?? RuntimeInformation.OSArchitecture; FrameworkVersion = targetFrameworkVersion ?? Environment.Version; - Debug.Assert(IsLinux || IsOSX || IsWindows); + Debug.Assert(IsLinux || IsOSX || IsWindows || IsFreeBSD); if (FrameworkVersion.Major >= 6) { @@ -79,7 +79,7 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer public bool IsNativeBinary(string filePath) { - return IsLinux ? ElfUtils.IsElfImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : PEUtils.IsPEImage(filePath); + return IsLinux ? ElfUtils.IsElfImage(filePath) : IsFreeBSD ? ElfUtils.IsElfImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : PEUtils.IsPEImage(filePath); } public string GetAssemblyName(string hostName) @@ -91,17 +91,18 @@ public string GetAssemblyName(string hostName) public override string ToString() { - string os = IsWindows ? "win" : IsLinux ? "linux" : "osx"; + string os = IsWindows ? "win" : IsLinux ? "linux" : IsFreeBSD ? "freebsd" : "osx"; string arch = Arch.ToString().ToLowerInvariant(); return $"OS: {os} Arch: {arch} FrameworkVersion: {FrameworkVersion}"; } private static OSPlatform HostOS => RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? OSPlatform.Linux : - RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : OSPlatform.Windows; + RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD) ? OSPlatform.FreeBSD : OSPlatform.Windows; public bool IsLinux => OS.Equals(OSPlatform.Linux); public bool IsOSX => OS.Equals(OSPlatform.OSX); public bool IsWindows => OS.Equals(OSPlatform.Windows); + public bool IsFreeBSD => OS.Equals(OSPlatform.FreeBSD); // The .net core 3 apphost doesn't care about semantics of FileType -- all files are extracted at startup. // However, the apphost checks that the FileType value is within expected bounds, so set it to the first enumeration. diff --git a/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props b/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props index 70e13f311b74a..8cd82c085c1a6 100644 --- a/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props +++ b/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props @@ -9,5 +9,6 @@ + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj index 2e0ef08ec3469..ef8f7c3899d5b 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj @@ -4,7 +4,7 @@ - true + true ToolPack $(SharedFrameworkName).Crossgen2 .PGO diff --git a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj index 90f8d4ad2a28f..33f2c2652efac 100644 --- a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj +++ b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj @@ -11,7 +11,7 @@ $(MSBuildProjectDirectory) dotnet-runtime dotnet-runtime - win-x86;win-x64;win-arm64;osx-x64;osx-arm64 + win-x86;win-x64;win-arm64;osx-x64;osx-arm64;freebsd-x64 Runtime $(MSBuildProjectDirectory)/shared-framework-distribution-template-$(TargetArchitecture).xml com.microsoft.dotnet.Microsoft.NETCore.App.$(ProductVersion).osx.$(TargetArchitecture) diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake index ae55fd112b321..90ac8a543e27d 100644 --- a/src/mono/cmake/configure.cmake +++ b/src/mono/cmake/configure.cmake @@ -160,7 +160,7 @@ check_c_source_compiles( #include int main(void) { - CPU_COUNT((void *) 0); + CPU_COUNT((cpuset_t *) 0); return 0; } " diff --git a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs index aac7b19ab7081..3900b4a94ed95 100644 --- a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs +++ b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs @@ -149,6 +149,7 @@ private bool ValidateCrossgen2Support() "linux-musl" => "linux", "osx" => "osx", "win" => "windows", + "freebsd" => "freebsd", _ => null }; @@ -334,6 +335,17 @@ private bool GetCrossgenComponentsPaths() _crossgenTool.ToolPath = Path.Combine(_crossgenTool.PackagePath, "tools", "crossgen"); _crossgenTool.ClrJitPath = Path.Combine(_crossgenTool.PackagePath, "runtimes", _targetRuntimeIdentifier, "native", "libclrjit.dylib"); } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) + { + // Only x64 supported for FreeBSD + if (_targetArchitecture != Architecture.X64 || RuntimeInformation.OSArchitecture != Architecture.X64) + { + return false; + } + + _crossgenTool.ToolPath = Path.Combine(_crossgenTool.PackagePath, "tools", "crossgen"); + _crossgenTool.ClrJitPath = Path.Combine(_crossgenTool.PackagePath, "runtimes", _targetRuntimeIdentifier, "native", "libclrjit.so"); + } else { // Unknown platform @@ -362,6 +374,11 @@ private bool GetCrossgen2ComponentsPaths(bool version5) toolFileName = "crossgen2"; v5_clrJitFileNamePattern = "libclrjit-{0}.dylib"; } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) + { + toolFileName = "crossgen2"; + v5_clrJitFileNamePattern = "libclrjit-{0}.so"; + } else { // Unknown platform From 016c837b6e03decc477a2619f02e7259829ea325 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 11:22:55 -0700 Subject: [PATCH 13/38] add inotify for FreeBSD during linking --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index d38efe43b991d..1edf2793915e4 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -121,6 +121,8 @@ The .NET Foundation licenses this file to you under the MIT license. + + From 2b39b09286e621391c00d8a611a22f94d97e3182 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 12:26:54 -0700 Subject: [PATCH 14/38] remove FreeBSD for now --- .../pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj index 33f2c2652efac..90f8d4ad2a28f 100644 --- a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj +++ b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj @@ -11,7 +11,7 @@ $(MSBuildProjectDirectory) dotnet-runtime dotnet-runtime - win-x86;win-x64;win-arm64;osx-x64;osx-arm64;freebsd-x64 + win-x86;win-x64;win-arm64;osx-x64;osx-arm64 Runtime $(MSBuildProjectDirectory)/shared-framework-distribution-template-$(TargetArchitecture).xml com.microsoft.dotnet.Microsoft.NETCore.App.$(ProductVersion).osx.$(TargetArchitecture) From fbfe2878ff3433e5c2a827732dd1e1c98a4cdf41 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:31:20 -0700 Subject: [PATCH 15/38] netstandard does not understand FreeBSD --- .../Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj index 679289bca37a4..ceebcf4699935 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj +++ b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0 Abstractions for modifying .NET host binaries false true From 23d010714b3a21dd25731f553e8ec5cf3b4741ba Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:35:59 -0700 Subject: [PATCH 16/38] add FreeBSD platform to HostModel Tests --- .../tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs b/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs index 22647a92f37a2..a559f73d72fc2 100644 --- a/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs +++ b/src/installer/tests/Microsoft.NET.HostModel.Tests/Helpers/BundleHelper.cs @@ -129,6 +129,7 @@ public static OSPlatform GetTargetOS(string runtimeIdentifier) "win" => OSPlatform.Windows, "osx" => OSPlatform.OSX, "linux" => OSPlatform.Linux, + "freebsd" => OSPlatform.FreeBSD, _ => throw new ArgumentException(nameof(runtimeIdentifier)) }; } From 84b3ed44ec71988458c0f689162bece004b52ab9 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 02:45:03 -0600 Subject: [PATCH 17/38] WIP FreeBSD NativeAOT --- eng/Versions.props | 29 +++++-------------- eng/targetingpacks.targets | 2 +- .../Microsoft.NETCore.App.Bundle.bundleproj | 2 +- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 0f041e2bdd203..6b432e752836a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -102,7 +102,6 @@ 8.0.0-alpha.1.22559.2 6.0.0 -<<<<<<< HEAD 8.0.0-alpha.1.22559.2 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 @@ -112,18 +111,7 @@ 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 -======= - 8.0.0-alpha.1.22530.1 - 1.0.0-alpha.1.22517.1 - 1.0.0-alpha.1.22517.1 - 1.0.0-alpha.1.22517.1 - 1.0.0-alpha.1.22517.1 - 1.0.0-alpha.1.22517.1 - 1.0.0-alpha.1.22517.1 - 1.0.0-alpha.1.22517.1 - 1.0.0-alpha.1.22517.1 1.0.0-alpha.1.22478.1 ->>>>>>> 0822d9be8b5 (WIP FreeBSD NativeAOT) 6.0.0 1.1.1 @@ -248,14 +236,13 @@ 1.0.0-v3.14.0.5722 6.0.0-preview.5.21275.7 - 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 + 1.0.0-alpha.1.22517.1 diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets index 76f004e0bf870..438f8264d960c 100644 --- a/eng/targetingpacks.targets +++ b/eng/targetingpacks.targets @@ -52,7 +52,7 @@ TargetFramework="$(NetCoreAppCurrent)" Crossgen2PackNamePattern="$(LocalFrameworkOverrideName).Crossgen2.**RID**" Crossgen2PackVersion="$(ProductVersion)" - Crossgen2RuntimeIdentifiers="linux-musl-x64;linux-x64;win-x64;linux-arm;linux-arm64;linux-musl-arm;linux-musl-arm64;osx-arm64;osx-x64;win-arm;win-arm64;win-x86" + Crossgen2RuntimeIdentifiers="linux-musl-x64;linux-x64;win-x64;freebsd-x64;linux-arm;linux-arm64;linux-musl-arm;linux-musl-arm64;osx-arm64;osx-x64;win-arm;win-arm64;win-x86" Condition="'@(KnownCrossgen2Pack)' == '' or !@(KnownCrossgen2Pack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))" /> $(MSBuildProjectDirectory) dotnet-runtime dotnet-runtime - win-x86;win-x64;win-arm64;osx-x64;osx-arm64 + win-x86;win-x64;win-arm64;osx-x64;osx-arm64;freebsd-x64 Runtime $(MSBuildProjectDirectory)/shared-framework-distribution-template-$(TargetArchitecture).xml com.microsoft.dotnet.Microsoft.NETCore.App.$(ProductVersion).osx.$(TargetArchitecture) From 09789ab9685f86a2ad8d5a9d3c58827c5e8a76af Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 12:26:54 -0700 Subject: [PATCH 18/38] remove FreeBSD for now --- .../pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj index 33f2c2652efac..90f8d4ad2a28f 100644 --- a/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj +++ b/src/installer/pkg/sfx/bundle/Microsoft.NETCore.App.Bundle.bundleproj @@ -11,7 +11,7 @@ $(MSBuildProjectDirectory) dotnet-runtime dotnet-runtime - win-x86;win-x64;win-arm64;osx-x64;osx-arm64;freebsd-x64 + win-x86;win-x64;win-arm64;osx-x64;osx-arm64 Runtime $(MSBuildProjectDirectory)/shared-framework-distribution-template-$(TargetArchitecture).xml com.microsoft.dotnet.Microsoft.NETCore.App.$(ProductVersion).osx.$(TargetArchitecture) From 2b3ccf9c1d7aa93e717aa1b4c84a1d9b4aeb2195 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:35:59 -0700 Subject: [PATCH 19/38] add FreeBSD platform to HostModel Tests From cd7bb03a60dd2d247822420c31a56455a7de6a7b Mon Sep 17 00:00:00 2001 From: TheFrank <1910378+Thefrank@users.noreply.github.com> Date: Mon, 28 Nov 2022 22:42:17 -0700 Subject: [PATCH 20/38] Use Clang12, update LinkerArg --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 4 +++- src/coreclr/tools/aot/crossgen2/crossgen2.csproj | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 1edf2793915e4..e713f4a7a33c1 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -121,6 +121,8 @@ The .NET Foundation licenses this file to you under the MIT license. + + @@ -149,7 +151,7 @@ The .NET Foundation licenses this file to you under the MIT license. - llvm-objcopy11 + llvm-objcopy12 diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj index abbc77eb0596a..a76f9d7f0fc16 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj @@ -35,7 +35,7 @@ clang-9 - clang11 + clang12 $(ROOTFS_DIR) $(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll $(CoreCLRAotSdkDir) From b9967f28149c9292b04f3a5d5794279d521e360f Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Tue, 13 Dec 2022 16:56:58 -0700 Subject: [PATCH 21/38] Update JITTools and ObjWriter for FreeBSD-x64 --- eng/Versions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index bb1c122c57577..5e541f1b91b7d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -111,7 +111,7 @@ 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22566.1 6.0.0 1.1.1 @@ -244,6 +244,6 @@ 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 1.0.0-alpha.1.22566.1 - 1.0.0-alpha.1.22478.1 + 1.0.0-alpha.1.22566.1 From e1eb2b96745b145a0b952198fa3391c2d5779b06 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Tue, 27 Dec 2022 21:19:45 -0700 Subject: [PATCH 22/38] fixes for tests --- .../Microsoft.NETCore.Native.Unix.targets | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index e713f4a7a33c1..0ddde447b190f 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -119,11 +119,11 @@ The .NET Foundation licenses this file to you under the MIT license. - - + + - + @@ -150,8 +150,13 @@ The .NET Foundation licenses this file to you under the MIT license. objcopy - - llvm-objcopy12 + + + objcopy + llvm-objcopy12 + + objcopy From c6264e418ab6e7d4a8b1743a0e855b65e107ad69 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Tue, 27 Dec 2022 21:19:45 -0700 Subject: [PATCH 23/38] fixes for tests --- .../Microsoft.NETCore.Native.Unix.targets | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index e713f4a7a33c1..4564432bcb55f 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -119,11 +119,11 @@ The .NET Foundation licenses this file to you under the MIT license. - - + + - + @@ -150,8 +150,13 @@ The .NET Foundation licenses this file to you under the MIT license. objcopy - - llvm-objcopy12 + + + objcopy + llvm-objcopy12 + + objcopy From ae4a139aae913d5d251470cd160a668ba6585008 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 6 Jan 2023 20:20:35 -0700 Subject: [PATCH 24/38] add TargetTriple for FreeBSD --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index eff79bd27ab58..99108bb4fdd88 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -39,6 +39,7 @@ The .NET Foundation licenses this file to you under the MIT license. $(CrossCompileArch)-linux-gnu $(CrossCompileArch)-alpine-linux-musl + $(CrossCompileArch)-unknown-freebsd12 $ORIGIN @executable_path From 725fae505bd3126f295a03c9aaf2b54a28824e95 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Mon, 9 Jan 2023 20:14:09 -0700 Subject: [PATCH 25/38] Some changes from feedback, remove out of scope --- eng/Subsets.props | 2 +- eng/targetingpacks.targets | 4 ++-- .../Microsoft.NETCore.Native.Unix.targets | 11 +---------- .../tools/SuperFileCheck/SuperFileCheck.csproj | 5 ++--- .../tools/aot/crossgen2/Crossgen2RootCommand.cs | 2 +- .../tools/aot/crossgen2/crossgen2.csproj | 2 -- src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj | 4 ++-- .../Microsoft.NETCore.App.Crossgen2.sfxproj | 2 +- src/mono/cmake/configure.cmake | 2 +- .../ResolveReadyToRunCompilers.cs | 17 ----------------- 10 files changed, 11 insertions(+), 40 deletions(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index a073284de5c4e..07cfc9a1c46ce 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -324,7 +324,7 @@ - + diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets index be1d10ce05001..7474ec60b5569 100644 --- a/eng/targetingpacks.targets +++ b/eng/targetingpacks.targets @@ -35,7 +35,7 @@ LatestRuntimeFrameworkVersion="$(ProductVersion)" RuntimeFrameworkName="$(LocalFrameworkOverrideName)" RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.**RID**" - RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;freebsd-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86" + RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;linux-s390x;linux-bionic-arm;linux-bionic-arm64;linux-bionic-x64;linux-bionic-x86" TargetFramework="$(NetCoreAppCurrent)" TargetingPackName="$(LocalFrameworkOverrideName).Ref" TargetingPackVersion="$(ProductVersion)" @@ -52,7 +52,7 @@ TargetFramework="$(NetCoreAppCurrent)" Crossgen2PackNamePattern="$(LocalFrameworkOverrideName).Crossgen2.**RID**" Crossgen2PackVersion="$(ProductVersion)" - Crossgen2RuntimeIdentifiers="linux-musl-x64;linux-x64;win-x64;freebsd-x64" + Crossgen2RuntimeIdentifiers="linux-musl-x64;linux-x64;win-x64;linux-arm;linux-arm64;linux-musl-arm;linux-musl-arm64;osx-arm64;osx-x64;win-arm;win-arm64;win-x86" Condition="'@(KnownCrossgen2Pack)' == '' or !@(KnownCrossgen2Pack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))" /> - + @@ -151,15 +151,6 @@ The .NET Foundation licenses this file to you under the MIT license. objcopy - - - objcopy - llvm-objcopy12 - - objcopy - - diff --git a/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj b/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj index 753543f44e2c7..793d6690074e4 100644 --- a/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj +++ b/src/coreclr/tools/SuperFileCheck/SuperFileCheck.csproj @@ -20,8 +20,8 @@ $(OutputRid.Substring(0, $(_jitToolsRidPlatformIndex))) $(OutputRid.Substring($(_jitToolsRidPlatformIndex)).TrimStart('-')) - - linux + + linux osx.10.12 @@ -40,7 +40,6 @@ $(runtimewinx64MicrosoftNETCoreRuntimeJITToolsVersion) $(runtimeosx110arm64MicrosoftNETCoreRuntimeJITToolsVersion) $(runtimeosx1012x64MicrosoftNETCoreRuntimeJITToolsVersion) - $(runtimefreebsdx64MicrosoftNETCoreRuntimeJITToolsVersion) diff --git a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs index b9b758280096b..0b0af8b3dfcc7 100644 --- a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs +++ b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs @@ -327,7 +327,7 @@ public static IEnumerable> GetExtendedHelp(HelpContext _) Console.WriteLine(); string[] ValidArchitectures = new string[] {"arm", "armel", "arm64", "x86", "x64"}; - string[] ValidOS = new string[] {"windows", "linux", "osx", "freebsd" }; + string[] ValidOS = new string[] {"windows", "linux", "osx" }; Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant())); Console.WriteLine(); diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj index e5dc3160815c7..8fd6160484e43 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj @@ -31,8 +31,6 @@ $(CoreCLRILCompilerDir) $(CoreCLRCrossILCompilerDir) - clang-15 - clang-9 $(ROOTFS_DIR) $(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll $(CoreCLRAotSdkDir) diff --git a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj index 753801e55d529..c3d3fc0376671 100644 --- a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj +++ b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj @@ -9,11 +9,11 @@ $(RuntimeBinDir)/dotnet-pgo true false - linux-x64;linux-musl-x64;win-x64;freebsd-x64 + linux-x64;linux-musl-x64;win-x64 true true dotnet-pgo - win-x64;win-x86;win-arm;osx-x64;freebsd-x64 + win-x64;win-x86;win-arm;osx-x64 $(OutputPath) false .NET Performance Guided Optimization Tool diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj index 7e65062ee78ab..fe32e81ec4644 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj @@ -4,7 +4,7 @@ - true + true ToolPack $(SharedFrameworkName).Crossgen2 .PGO diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake index 53aa9321493ec..db78672ce6892 100644 --- a/src/mono/cmake/configure.cmake +++ b/src/mono/cmake/configure.cmake @@ -167,7 +167,7 @@ check_c_source_compiles( #include int main(void) { - CPU_COUNT((cpuset_t *) 0); + CPU_COUNT((void *) 0); return 0; } " diff --git a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs index 3900b4a94ed95..aac7b19ab7081 100644 --- a/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs +++ b/src/tasks/Crossgen2Tasks/ResolveReadyToRunCompilers.cs @@ -149,7 +149,6 @@ private bool ValidateCrossgen2Support() "linux-musl" => "linux", "osx" => "osx", "win" => "windows", - "freebsd" => "freebsd", _ => null }; @@ -335,17 +334,6 @@ private bool GetCrossgenComponentsPaths() _crossgenTool.ToolPath = Path.Combine(_crossgenTool.PackagePath, "tools", "crossgen"); _crossgenTool.ClrJitPath = Path.Combine(_crossgenTool.PackagePath, "runtimes", _targetRuntimeIdentifier, "native", "libclrjit.dylib"); } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) - { - // Only x64 supported for FreeBSD - if (_targetArchitecture != Architecture.X64 || RuntimeInformation.OSArchitecture != Architecture.X64) - { - return false; - } - - _crossgenTool.ToolPath = Path.Combine(_crossgenTool.PackagePath, "tools", "crossgen"); - _crossgenTool.ClrJitPath = Path.Combine(_crossgenTool.PackagePath, "runtimes", _targetRuntimeIdentifier, "native", "libclrjit.so"); - } else { // Unknown platform @@ -374,11 +362,6 @@ private bool GetCrossgen2ComponentsPaths(bool version5) toolFileName = "crossgen2"; v5_clrJitFileNamePattern = "libclrjit-{0}.dylib"; } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD)) - { - toolFileName = "crossgen2"; - v5_clrJitFileNamePattern = "libclrjit-{0}.so"; - } else { // Unknown platform From c5bafd71f8fc78e7b5c100597984e6b7bc2e0d34 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:10:30 -0800 Subject: [PATCH 26/38] Apply suggestions from code review Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com> --- .../managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index 2ee67bd211f12..b3ba9ce1c81e4 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -96,13 +96,15 @@ public override string ToString() return $"OS: {os} Arch: {arch} FrameworkVersion: {FrameworkVersion}"; } + private static OSPlatform _freebsdOSPlatform = OSPlatform.Create("FREEBSD"); + private static OSPlatform HostOS => RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? OSPlatform.Linux : - RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD) ? OSPlatform.FreeBSD : OSPlatform.Windows; + RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : RuntimeInformation.IsOSPlatform(_freebsdOSPlatform) ? _freebsdOSPlatform : OSPlatform.Windows; public bool IsLinux => OS.Equals(OSPlatform.Linux); public bool IsOSX => OS.Equals(OSPlatform.OSX); public bool IsWindows => OS.Equals(OSPlatform.Windows); - public bool IsFreeBSD => OS.Equals(OSPlatform.FreeBSD); + public bool IsFreeBSD => OS.Equals(_freebsdOSPlatform); // The .net core 3 apphost doesn't care about semantics of FileType -- all files are extracted at startup. // However, the apphost checks that the FileType value is within expected bounds, so set it to the first enumeration. From 40d15dd60d9f4b4aeb355b1e7177b2b63f263909 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Tue, 10 Jan 2023 13:17:29 -0700 Subject: [PATCH 27/38] HostModel back to netstandard2.0 --- src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs | 2 +- .../Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs index 0b0af8b3dfcc7..e3918372e42dc 100644 --- a/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs +++ b/src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs @@ -327,7 +327,7 @@ public static IEnumerable> GetExtendedHelp(HelpContext _) Console.WriteLine(); string[] ValidArchitectures = new string[] {"arm", "armel", "arm64", "x86", "x64"}; - string[] ValidOS = new string[] {"windows", "linux", "osx" }; + string[] ValidOS = new string[] {"windows", "linux", "osx"}; Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant())); Console.WriteLine(); diff --git a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj index ceebcf4699935..679289bca37a4 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj +++ b/src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj @@ -1,7 +1,7 @@ - net6.0 + netstandard2.0 Abstractions for modifying .NET host binaries false true From 1f07f85ab7b536a94b235c157d48ca7d604f8f19 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Wed, 11 Jan 2023 13:21:03 -0800 Subject: [PATCH 28/38] Update src/coreclr/CMakeLists.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michal Strehovský --- src/coreclr/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 253ac0a491712..9f632a5194eba 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -139,7 +139,7 @@ add_subdirectory(tools/aot/jitinterface) if(NOT CLR_CROSS_COMPONENTS_BUILD) # NativeAOT only buildable for a subset of CoreCLR-supported configurations - if((CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_WIN32 OR CLR_CMAKE_HOST_FREEBSD) AND (CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_AMD64)) + if(CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_AMD64) add_subdirectory(nativeaot) endif() endif(NOT CLR_CROSS_COMPONENTS_BUILD) From 53f0faee1ff305fdc9df74092285037f4f602c3a Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Fri, 13 Jan 2023 11:39:30 -0700 Subject: [PATCH 29/38] Publish crossgen2 as single-file on cross-os --- .../Microsoft.NETCore.App.Crossgen2.sfxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj index 7ea5e438f02ed..483d39c66ab4f 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj @@ -18,6 +18,8 @@ true false + + false Date: Fri, 13 Jan 2023 18:56:18 -0700 Subject: [PATCH 30/38] pass NativeAotSupported to MSBuild crossgen2 tasks --- .../Microsoft.NETCore.App.Crossgen2.sfxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj index 483d39c66ab4f..7301dce33d61a 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj @@ -36,6 +36,7 @@ Properties="MSBuildRestoreSessionId=$([System.Guid]::NewGuid()) ;_IsPublishing=true ;RuntimeIdentifier=$(PackageRID) + ;NativeAotSupported=$(NativeAotSupported) ;CoreCLRArtifactsPath=$(CoreCLRArtifactsPath) ;R2ROverridePath=$(MSBuildThisFileDirectory)ReadyToRun.targets" /> @@ -43,6 +44,7 @@ Targets="Publish;PublishItemsOutputGroup" Properties="_IsPublishing=true ;RuntimeIdentifier=$(PackageRID) + ;NativeAotSupported=$(NativeAotSupported) ;CoreCLRArtifactsPath=$(CoreCLRArtifactsPath) ;R2ROverridePath=$(MSBuildThisFileDirectory)ReadyToRun.targets"> Date: Sat, 14 Jan 2023 12:54:28 -0800 Subject: [PATCH 31/38] Can't use NativeAOT in source build yet Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com> --- .../Microsoft.NETCore.App.Crossgen2.sfxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj index 7301dce33d61a..81aa510c27b91 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj @@ -20,6 +20,8 @@ false false + + false Date: Mon, 16 Jan 2023 09:00:25 -0800 Subject: [PATCH 32/38] Update src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs Co-authored-by: Robin Sue --- .../managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index b3ba9ce1c81e4..e8dcefd337776 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -79,7 +79,7 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer public bool IsNativeBinary(string filePath) { - return IsLinux ? ElfUtils.IsElfImage(filePath) : IsFreeBSD ? ElfUtils.IsElfImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : PEUtils.IsPEImage(filePath); + return IsLinux || IsFreeBSD ? ElfUtils.IsElfImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : PEUtils.IsPEImage(filePath); } public string GetAssemblyName(string hostName) From c6e375bb174c94a95e425fadbcd822f52ba40b8a Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Mon, 16 Jan 2023 13:24:03 -0800 Subject: [PATCH 33/38] Apply suggestions from code review Co-authored-by: Jan Kotas --- .../managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index e8dcefd337776..ab691432e9ead 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -35,8 +35,6 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer Arch = arch ?? RuntimeInformation.OSArchitecture; FrameworkVersion = targetFrameworkVersion ?? Environment.Version; - Debug.Assert(IsLinux || IsOSX || IsWindows || IsFreeBSD); - if (FrameworkVersion.Major >= 6) { BundleMajorVersion = 6u; @@ -79,7 +77,7 @@ public TargetInfo(OSPlatform? os, Architecture? arch, Version targetFrameworkVer public bool IsNativeBinary(string filePath) { - return IsLinux || IsFreeBSD ? ElfUtils.IsElfImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : PEUtils.IsPEImage(filePath); + return IsWindows ? PEUtils.IsPEImage(filePath) : IsOSX ? MachOUtils.IsMachOImage(filePath) : ElfUtils.IsElfImage(filePath); } public string GetAssemblyName(string hostName) From 4629b168c10109b87fdc667e3861cd7b6521f534 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Tue, 17 Jan 2023 13:18:41 -0800 Subject: [PATCH 34/38] Apply suggestions from code review Co-authored-by: Jan Kotas --- .../BuildIntegration/Microsoft.NETCore.Native.Unix.targets | 2 +- .../managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 2df5e57763a64..2cb1d2bb3e23f 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -121,7 +121,7 @@ The .NET Foundation licenses this file to you under the MIT license. - + diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index ab691432e9ead..a9a76babcc45c 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -89,7 +89,7 @@ public string GetAssemblyName(string hostName) public override string ToString() { - string os = IsWindows ? "win" : IsLinux ? "linux" : IsFreeBSD ? "freebsd" : "osx"; + string os = IsWindows ? "win" : OS.ToString().ToLowerInvariant(); string arch = Arch.ToString().ToLowerInvariant(); return $"OS: {os} Arch: {arch} FrameworkVersion: {FrameworkVersion}"; } From 1f4ae43ea60e97ed6588be3065a5a94b6649d03b Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Tue, 17 Jan 2023 14:20:16 -0700 Subject: [PATCH 35/38] Update private string HostFxr and HostPolicy --- .../managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index a9a76babcc45c..1936fa170f53d 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -117,7 +117,7 @@ public override string ToString() public bool ShouldExclude(string relativePath) => (FrameworkVersion.Major != 3) && (relativePath.Equals(HostFxr) || relativePath.Equals(HostPolicy)); - private string HostFxr => IsWindows ? "hostfxr.dll" : IsLinux ? "libhostfxr.so" : "libhostfxr.dylib"; - private string HostPolicy => IsWindows ? "hostpolicy.dll" : IsLinux ? "libhostpolicy.so" : "libhostpolicy.dylib"; + private string HostFxr => IsWindows ? "hostfxr.dll" : IsOSX ? "libhostfxr.dylib" : "libhostfxr.so"; + private string HostPolicy => IsWindows ? "hostpolicy.dll" : IsOSX "libhostpolicy.dylib" : "libhostpolicy.so"; } } From 79083129fd865f9fefbf12aa43ef535c188b2433 Mon Sep 17 00:00:00 2001 From: Thefrank <1910378+Thefrank@users.noreply.github.com> Date: Tue, 17 Jan 2023 14:29:29 -0700 Subject: [PATCH 36/38] Fix private string HostPolicy --- .../managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index 1936fa170f53d..4458baaeca29a 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -118,6 +118,6 @@ public bool ShouldExclude(string relativePath) => (FrameworkVersion.Major != 3) && (relativePath.Equals(HostFxr) || relativePath.Equals(HostPolicy)); private string HostFxr => IsWindows ? "hostfxr.dll" : IsOSX ? "libhostfxr.dylib" : "libhostfxr.so"; - private string HostPolicy => IsWindows ? "hostpolicy.dll" : IsOSX "libhostpolicy.dylib" : "libhostpolicy.so"; + private string HostPolicy => IsWindows ? "hostpolicy.dll" : IsOSX ? "libhostpolicy.dylib" : "libhostpolicy.so"; } } From c41fd0a1c217102071b2cd03441e38f57a993b19 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 17 Jan 2023 15:14:20 -0800 Subject: [PATCH 37/38] Apply suggestions from code review --- .../managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index 4458baaeca29a..b21d9e7496c2e 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -94,15 +94,15 @@ public override string ToString() return $"OS: {os} Arch: {arch} FrameworkVersion: {FrameworkVersion}"; } - private static OSPlatform _freebsdOSPlatform = OSPlatform.Create("FREEBSD"); + private static readonly OSPlatform s_freebsdOSPlatform = OSPlatform.Create("FREEBSD"); private static OSPlatform HostOS => RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? OSPlatform.Linux : - RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : RuntimeInformation.IsOSPlatform(_freebsdOSPlatform) ? _freebsdOSPlatform : OSPlatform.Windows; + RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : RuntimeInformation.IsOSPlatform(s_freebsdOSPlatform) ? s_freebsdOSPlatform : OSPlatform.Windows; public bool IsLinux => OS.Equals(OSPlatform.Linux); public bool IsOSX => OS.Equals(OSPlatform.OSX); public bool IsWindows => OS.Equals(OSPlatform.Windows); - public bool IsFreeBSD => OS.Equals(_freebsdOSPlatform); + public bool IsFreeBSD => OS.Equals(s_freebsdOSPlatform); // The .net core 3 apphost doesn't care about semantics of FileType -- all files are extracted at startup. // However, the apphost checks that the FileType value is within expected bounds, so set it to the first enumeration. From a51e7f55176a77c983b059898ac62e170efbeadf Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 17 Jan 2023 18:29:58 -0800 Subject: [PATCH 38/38] Update src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com> --- .../managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index b21d9e7496c2e..1876c7e379050 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -99,10 +99,8 @@ public override string ToString() private static OSPlatform HostOS => RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? OSPlatform.Linux : RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OSPlatform.OSX : RuntimeInformation.IsOSPlatform(s_freebsdOSPlatform) ? s_freebsdOSPlatform : OSPlatform.Windows; - public bool IsLinux => OS.Equals(OSPlatform.Linux); public bool IsOSX => OS.Equals(OSPlatform.OSX); public bool IsWindows => OS.Equals(OSPlatform.Windows); - public bool IsFreeBSD => OS.Equals(s_freebsdOSPlatform); // The .net core 3 apphost doesn't care about semantics of FileType -- all files are extracted at startup. // However, the apphost checks that the FileType value is within expected bounds, so set it to the first enumeration.