diff --git a/.abf.yml b/.abf.yml index f0291e7..62f4abb 100644 --- a/.abf.yml +++ b/.abf.yml @@ -1,3 +1,3 @@ sources: - dotnet-v6.0.106-x64-bootstrap.tar.xz: 8c726934c554821d15a759614d402db0b9afeadc - dotnet-v6.0.106.tar.gz: 8245cffa114bb13d2dd3eed9b8b48e7e1dc444c5 + dotnet-v6.0.111-x64-bootstrap.tar.xz: 06c13eae6a57936cc237441c7bda98b09836f95e + dotnet-v6.0.111.tar.gz: 4f3608ae1ac059a9aa2d21af54c722150c0d566c diff --git a/arcade-no-apphost.patch b/arcade-no-apphost.patch deleted file mode 100644 index cec03a1..0000000 --- a/arcade-no-apphost.patch +++ /dev/null @@ -1,36 +0,0 @@ -Index: a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj -=================================================================== ---- a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj -+++ b/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj -@@ -5,6 +5,7 @@ - netcoreapp3.1 - latest - true -+ false - - - -Index: a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj -=================================================================== ---- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj -+++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj -@@ -9,6 +9,7 @@ - dotnet-swaggergen - false - true -+ false - - - -Index: a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj -=================================================================== ---- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj -+++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj -@@ -11,6 +11,7 @@ - 2.5.1 - true - Major -+ false - - - diff --git a/build-dotnet-tarball b/build-dotnet-tarball index e45d0e4..948bb56 100755 --- a/build-dotnet-tarball +++ b/build-dotnet-tarball @@ -178,8 +178,15 @@ else rm -rf .dotnet fi -# Remove files with funny licenses, crypto implementations and other -# not-very-useful artifacts to reduce tarball size +# Remove files with funny licenses and crypto implementations and +# other not-very-useful artifacts. We MUST NOT ship any files that +# have unapproved licenses and unexpected cryptographic +# implementations. +# +# We use rm -r (no -f) to make sure the operation fails if the files +# are not at the expected locations. If the files are not at the +# expected location, we need to find the new location of the files and +# delete them, or verify that upstream has already removed the files. # Binaries for gradle rm -r src/aspnetcore/src/SignalR/clients/java/signalr/gradle* diff --git a/command-line-api-use-work-tree-with-git-apply.patch b/command-line-api-use-work-tree-with-git-apply.patch deleted file mode 100644 index 552d59d..0000000 --- a/command-line-api-use-work-tree-with-git-apply.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7a752928ed3588246c4b296feb6cf4946f1b29b7 Mon Sep 17 00:00:00 2001 -From: Omair Majid -Date: Thu, 9 Sep 2021 12:11:39 -0400 -Subject: [PATCH] [ArPow] Use --work-tree with git apply - -This makes things work better in a source-tarball build, where there may -be a .git directory but it's for a different repo than command-line-api. ---- - eng/SourceBuild.props | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props -index 6cc85018..5e223747 100644 ---- a/eng/SourceBuild.props -+++ b/eng/SourceBuild.props -@@ -15,7 +15,7 @@ - - - - --- -2.31.1 - diff --git a/dotnet6.0.spec b/dotnet6.0.spec index da3dad6..9c6d4c3 100644 --- a/dotnet6.0.spec +++ b/dotnet6.0.spec @@ -20,10 +20,10 @@ # until that's done, disable LTO. This has to happen before setting the flags below. %define _lto_cflags %{nil} -%global host_version 6.0.6 -%global runtime_version 6.0.6 +%global host_version 6.0.11 +%global runtime_version 6.0.11 %global aspnetcore_runtime_version %{runtime_version} -%global sdk_version 6.0.106 +%global sdk_version 6.0.111 %global sdk_feature_band_version %(echo %{sdk_version} | sed -e 's|[[:digit:]][[:digit:]]$|00|') %global templates_version %{runtime_version} #%%global templates_version %%(echo %%{runtime_version} | awk 'BEGIN { FS="."; OFS="." } {print $1, $2, $3+1 }') @@ -52,47 +52,30 @@ Group: Development/Other License: MIT and ASL 2.0 and BSD and LGPLv2+ and CC-BY and CC0 and MS-PL and EPL-1.0 and GPL+ and GPLv2 and ISC and OFL and zlib URL: https://github.com/dotnet/ +%if %{with bootstrap} +# The source is generated on a Fedora box via: +# ./build-dotnet-tarball --bootstrap %%{upstream_tag} +Source0: dotnet-%{upstream_tag}-x64-bootstrap.tar.xz +%else # The source is generated on a Fedora box via: # ./build-dotnet-tarball %%{upstream_tag} Source0: dotnet-%{upstream_tag}.tar.gz -# The source is generated on a Fedora box via: -# ./build-dotnet-tarball --bootstrap %%{upstream_tag} -Source1: dotnet-%{upstream_tag}-x64-bootstrap.tar.xz +%endif + Source10: check-debug-symbols.py Source11: dotnet.sh.in + Patch0: runtime-ROSA-rid.patch # Fix using lld on Fedora Patch100: runtime-arm64-lld-fix.patch # Mono still has a dependency on (now unbuildable) ILStrip which was removed from CoreCLR: https://github.com/dotnet/runtime/pull/60315 Patch101: runtime-mono-remove-ilstrip.patch -# https://github.com/dotnet/runtime/pull/65392 -Patch102: runtime-fedora-37-rid.patch # https://github.com/dotnet/runtime/pull/66594 -Patch103: runtime-66594-s390x-debuginfo.patch - -# https://github.com/dotnet/command-line-api/pull/1401 -Patch300: command-line-api-use-work-tree-with-git-apply.patch - -# https://github.com/microsoft/vstest/pull/3046 -Patch400: vstest-use-work-tree-with-git-apply.patch - -# Disable apphost, needed for s390x -Patch500: fsharp-no-apphost.patch - -# This is the suggestion from https://github.com/dotnet/source-build/pull/2450, applied -Patch600: xliff-tasks-use-work-tree-with-git-apply.patch - -# Disable apphost, needed for s390x -Patch700: arcade-no-apphost.patch - -# Named mutex fix for mono, needed for s390x. https://github.com/dotnet/roslyn/pull/57003 -Patch800: roslyn-57003-mono-named-mutex.patch -# Disable apphost, needed for s390x -Patch801: roslyn-no-apphost.patch - -# Disable apphost, needed for s390x -Patch900: roslyn-analyzers-no-apphost.patch - +Patch102: runtime-66594-s390x-debuginfo.patch +# https://github.com/dotnet/runtime/pull/73065 +Patch103: runtime-clang15-support.patch +# https://github.com/dotnet/runtime/pull/60675 +Patch104: runtime-strerror.patch # Fix mono-specific runtime crashes running msbuild. CoreCLR does not # load types that are not actually used/invoked at runtime, while mono # does. System.Configuration and System.Security are missing in @@ -104,15 +87,12 @@ Patch1001: msbuild-no-systemconfiguration.patch Patch1500: sdk-telemetry-optout.patch # https://github.com/dotnet/sdk/pull/22373 Patch1501: sdk-22373-portablerid.patch - -# https://github.com/dotnet/installer/pull/12516 -Patch1600: installer-12516-portablerid.patch - ExclusiveArch: x86_64 BuildRequires: clang BuildRequires: cmake BuildRequires: coreutils +BuildRequires: curl %if %{without bootstrap} BuildRequires: dotnet-sdk-6.0 BuildRequires: dotnet-sdk-6.0-source-built-artifacts @@ -340,8 +320,7 @@ These are not meant for general use. %if %{without bootstrap} %setup -q -n dotnet-%{upstream_tag} %else -tar xf %{S:1} -C $PWD -pushd dotnet-%{upstream_tag}-x64-bootstrap +%setup -q -T -b 0 -n dotnet-%{upstream_tag}-x64-bootstrap %endif %if %{without bootstrap} @@ -356,48 +335,18 @@ rm -rf packages/source-built mkdir -p packages/archive ln -s %{_libdir}/dotnet/source-built-artifacts/Private.SourceBuilt.Artifacts.*.tar.gz packages/archive/ -ln -s %{_libdir}/dotnet/reference-packages/Private.SourceBuild.ReferencePackages*.tar.gz packages/archive/ %endif # Fix bad hardcoded path in build sed -i 's|/usr/share/dotnet|%{_libdir}/dotnet|' src/runtime/src/native/corehost/hostmisc/pal.unix.cpp pushd src/runtime -%patch0 -p2 +%patch0 -p3 %patch100 -p1 %patch101 -p1 %patch102 -p1 %patch103 -p1 -popd - -pushd src/command-line-api -%patch300 -p1 -popd - -pushd src/vstest -%patch400 -p1 -popd - - -pushd src/fsharp -%patch500 -p1 -popd - -pushd src/xliff-tasks -%patch600 -p1 -popd - -pushd src/arcade -%patch700 -p1 -popd - -pushd src/roslyn -%patch800 -p3 -%patch801 -p1 -popd - -pushd src/roslyn-analyzers -%patch900 -p1 +%patch104 -p1 popd pushd src/sdk @@ -406,7 +355,6 @@ pushd src/sdk popd pushd src/installer -%patch1600 -p1 popd @@ -415,11 +363,6 @@ sed -i -E 's|( /p:BuildDebPackage=false)|\1 --cmakeargs -DCLR_CMAKE_USE_SYSTEM_L %endif %build - -%if %{with bootstrap} -pushd dotnet-%{upstream_tag}-x64-bootstrap -%endif - cat /etc/os-release %if %{without bootstrap} @@ -448,6 +391,16 @@ export EXTRA_LDFLAGS="$LDFLAGS" # suggested compile-time change doesn't work, unfortunately. export COMPlus_LTTng=0 +# OpenSSL 3.0 in RHEL 9 has disabled SHA1, used by .NET for strong +# name signing. See https://github.com/dotnet/runtime/issues/67304 +# https://gitlab.com/redhat/centos-stream/rpms/openssl/-/commit/78fb78d30755ae18fdaef28ef392f4e67c662ff6 +export OPENSSL_ENABLE_SHA1_SIGNATURES=1 + +%if %{with bootstrap} +rm -fr .dotnet +./prep.sh --bootstrap +%endif + VERBOSE=1 ./build.sh \ %if %{without bootstrap} --with-sdk previously-built-dotnet \ @@ -460,17 +413,11 @@ echo \ /p:LogVerbosity=n \ /p:MinimalConsoleLogOutput=false \ /p:ContinueOnPrebuiltBaselineError=true \ - +%{nil} sed -e 's|[@]LIBDIR[@]|%{_libdir}|g' %{SOURCE11} > dotnet.sh - %install - -%if %{with bootstrap} -pushd dotnet-%{upstream_tag}-x64-bootstrap -%endif - install -dm 0755 %{buildroot}%{_libdir}/dotnet ls artifacts/%{runtime_arch}/Release tar xf artifacts/%{runtime_arch}/Release/dotnet-sdk-%{sdk_version}-%{runtime_id}.tar.gz -C %{buildroot}%{_libdir}/dotnet/ @@ -590,4 +537,3 @@ echo "Testing build results for debug symbols..." %{_libdir}/dotnet/source-built-artifacts - diff --git a/fsharp-no-apphost.patch b/fsharp-no-apphost.patch deleted file mode 100644 index 1534888..0000000 --- a/fsharp-no-apphost.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/tests/benchmarks/MicroPerf/MicroPerf.fsproj -+++ b/tests/benchmarks/MicroPerf/MicroPerf.fsproj -@@ -9,6 +9,7 @@ - $(OtherFlags) --nowarn:57 - $(OtherFlags) --langversion:preview - $(OtherFlags) --define:PREVIEW -+ false - - - - $(OtherFlags) --nowarn:1204 - - diff --git a/fsharp-use-work-tree-with-git-apply.patch b/fsharp-use-work-tree-with-git-apply.patch deleted file mode 100644 index 810cf67..0000000 --- a/fsharp-use-work-tree-with-git-apply.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/eng/SourceBuild.props -+++ b/eng/SourceBuild.props -@@ -15,7 +15,7 @@ - - - - diff --git a/installer-12516-portablerid.patch b/installer-12516-portablerid.patch deleted file mode 100644 index 4cb4ab6..0000000 --- a/installer-12516-portablerid.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 892222071f73062f969f4f6ed1df8f759b9327b7 Mon Sep 17 00:00:00 2001 -From: Tom Deseyn -Date: Wed, 3 Nov 2021 15:12:59 +0100 -Subject: [PATCH] GetRuntimeInformation.targets: determine - PortableProductMonikerRid based on HostOSName and Architecture. - ---- - src/redist/targets/GetRuntimeInformation.targets | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/redist/targets/GetRuntimeInformation.targets b/src/redist/targets/GetRuntimeInformation.targets -index 5133c3a3841..01f704c7d8e 100644 ---- a/src/redist/targets/GetRuntimeInformation.targets -+++ b/src/redist/targets/GetRuntimeInformation.targets -@@ -28,6 +28,8 @@ - '$(Rid)' == 'linux-musl-x64' ">$(Rid) - $(OSName)-$(Architecture) - -+ $(HostOSName)-$(Architecture) -+ - dotnet-sdk-internal$(PgoTerm) - dotnet-sdk$(PgoTerm) - diff --git a/roslyn-57003-mono-named-mutex.patch b/roslyn-57003-mono-named-mutex.patch deleted file mode 100644 index c264bff..0000000 --- a/roslyn-57003-mono-named-mutex.patch +++ /dev/null @@ -1,453 +0,0 @@ -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs -@@ -31,5 +31,24 @@ namespace Roslyn.Utilities - } - } - } -+ /// -+ /// Are we running on .NET 5 or later using the Mono runtime? -+ /// Will also return true when running on Mono itself; if necessary -+ /// we can use IsRunningOnMono to distinguish. -+ /// -+ public static bool IsUsingMonoRuntime -+ { -+ get -+ { -+ try -+ { -+ return !(Type.GetType("Mono.RuntimeStructs", throwOnError: false) is null); -+ } -+ catch -+ { -+ return false; -+ } -+ } -+ } - } - } -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs -@@ -79,7 +79,7 @@ namespace Microsoft.CodeAnalysis.Compile - // to connect. When it fails it should fall back to in-proc - // compilation. - bool holdsMutex; -- using (var serverMutex = new Mutex(initiallyOwned: true, -+ using (var serverMutex = BuildServerConnection.OpenOrCreateMutex( - name: BuildServerConnection.GetServerMutexName(_pipeName), - createdNew: out holdsMutex)) - { -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs -@@ -103,7 +103,7 @@ class Hello - var mutexName = BuildServerConnection.GetServerMutexName(pipeName); - - bool holdsMutex; -- using (var mutex = new Mutex(initiallyOwned: true, -+ using (var mutex = BuildServerConnection.OpenOrCreateMutex( - name: mutexName, - createdNew: out holdsMutex)) - { -@@ -119,7 +119,7 @@ class Hello - } - finally - { -- mutex.ReleaseMutex(); -+ mutex.Dispose(); - } - } - } -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs -@@ -304,7 +304,7 @@ End Module") - var newTempDir = _tempDirectory.CreateDirectory(new string('a', 100 - _tempDirectory.Path.Length)); - await ApplyEnvironmentVariables( - new[] { new KeyValuePair("TMPDIR", newTempDir.Path) }, -- async () => -+ async () => await Task.Run(async () => - { - using var serverData = await ServerUtil.CreateServer(_logger); - var result = RunCommandLineCompiler( -@@ -317,7 +317,7 @@ End Module") - - var listener = await serverData.Complete(); - Assert.Equal(CompletionData.RequestCompleted, listener.CompletionDataList.Single()); -- }); -+ })); - } - - [Fact] -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs -@@ -101,7 +101,7 @@ namespace Microsoft.CodeAnalysis.Compile - - var thread = new Thread(() => - { -- using (var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created)) -+ using (var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created)) - using (var stream = NamedPipeUtil.CreateServer(pipeName)) - { - readyMre.Set(); -@@ -112,7 +112,7 @@ namespace Microsoft.CodeAnalysis.Compile - stream.Close(); - - doneMre.WaitOne(); -- mutex.ReleaseMutex(); -+ mutex.Dispose(); - } - }); - -@@ -153,7 +153,7 @@ namespace Microsoft.CodeAnalysis.Compile - { - using (var stream = NamedPipeUtil.CreateServer(pipeName)) - { -- var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created); -+ var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created); - readyMre.Set(); - - stream.WaitForConnection(); -@@ -161,7 +161,6 @@ namespace Microsoft.CodeAnalysis.Compile - - // Client is waiting for a response. Close the mutex now. Then close the connection - // so the client gets an error. -- mutex.ReleaseMutex(); - mutex.Dispose(); - stream.Close(); - -Index: tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs -=================================================================== ---- tarball.6.0.1-rc2-6.0.100-rc2.orig/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs -+++ tarball.6.0.1-rc2-6.0.100-rc2/src/roslyn.8e1779e16298415843e85029d8b52a1ae9bb4c30/src/Compilers/Shared/BuildServerConnection.cs -@@ -543,19 +543,10 @@ namespace Microsoft.CodeAnalysis.Command - { - try - { -- if (PlatformInformation.IsRunningOnMono) -+ if (PlatformInformation.IsUsingMonoRuntime) - { -- IServerMutex? mutex = null; -- bool createdNew = false; -- try -- { -- mutex = new ServerFileMutexPair(mutexName, false, out createdNew); -- return !createdNew; -- } -- finally -- { -- mutex?.Dispose(); -- } -+ using var mutex = new ServerFileMutex(mutexName); -+ return !mutex.CouldLock(); - } - else - { -@@ -572,9 +563,11 @@ namespace Microsoft.CodeAnalysis.Command - - internal static IServerMutex OpenOrCreateMutex(string name, out bool createdNew) - { -- if (PlatformInformation.IsRunningOnMono) -+ if (PlatformInformation.IsUsingMonoRuntime) - { -- return new ServerFileMutexPair(name, initiallyOwned: true, out createdNew); -+ var mutex = new ServerFileMutex(name); -+ createdNew = mutex.TryLock(0); -+ return mutex; - } - else - { -@@ -648,19 +641,22 @@ namespace Microsoft.CodeAnalysis.Command - } - - /// -- /// An interprocess mutex abstraction based on OS advisory locking (FileStream.Lock/Unlock). -+ /// An interprocess mutex abstraction based on file sharing permission (FileShare.None). - /// If multiple processes running as the same user create FileMutex instances with the same name, - /// those instances will all point to the same file somewhere in a selected temporary directory. -- /// The TryLock method can be used to attempt to acquire the mutex, with Unlock or Dispose used to release. -+ /// The TryLock method can be used to attempt to acquire the mutex, with Dispose used to release. -+ /// The CouldLock method can be used to check whether an attempt to acquire the mutex would have -+ /// succeeded at the current time, without actually acquiring it. - /// Unlike Win32 named mutexes, there is no mechanism for detecting an abandoned mutex. The file - /// will simply revert to being unlocked but remain where it is. - /// -- internal sealed class FileMutex : IDisposable -+ internal sealed class ServerFileMutex : IServerMutex - { -- public readonly FileStream Stream; -+ public FileStream? Stream; - public readonly string FilePath; -+ public readonly string GuardPath; - -- public bool IsLocked { get; private set; } -+ public bool IsDisposed { get; private set; } - - internal static string GetMutexDirectory() - { -@@ -670,61 +666,176 @@ namespace Microsoft.CodeAnalysis.Command - return result; - } - -- public FileMutex(string name) -+ public ServerFileMutex(string name) - { -- FilePath = Path.Combine(GetMutexDirectory(), name); -- Stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); -+ var mutexDirectory = GetMutexDirectory(); -+ FilePath = Path.Combine(mutexDirectory, name); -+ GuardPath = Path.Combine(mutexDirectory, ".guard"); - } - -- public bool TryLock(int timeoutMs) -+ /// -+ /// Acquire the guard by opening the guard file with FileShare.None. The guard must only ever -+ /// be held for very brief amounts of time, so we can simply spin until it is acquired. The -+ /// guard must be released by disposing the FileStream returned from this routine. Note the -+ /// guard file is never deleted; this is a leak, but only of a single file. -+ /// -+ internal FileStream LockGuard() - { -- if (IsLocked) -- throw new InvalidOperationException("Lock already held"); -- -- var sw = Stopwatch.StartNew(); -- do -+ // We should be able to acquire the guard quickly. Limit the number of retries anyway -+ // by some arbitrary bound to avoid getting hung up in a possibly infinite loop. -+ for (var i = 0; i < 100; i++) - { - try - { -- Stream.Lock(0, 0); -- IsLocked = true; -- return true; -+ return new FileStream(GuardPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); - } - catch (IOException) - { -- // Lock currently held by someone else. -+ // Guard currently held by someone else. - // We want to sleep for a short period of time to ensure that other processes - // have an opportunity to finish their work and relinquish the lock. - // Spinning here (via Yield) would work but risks creating a priority - // inversion if the lock is held by a lower-priority process. - Thread.Sleep(1); - } -+ } -+ // Handle unexpected failure to acquire guard as error. -+ throw new InvalidOperationException("Unable to acquire guard"); -+ } -+ -+ /// -+ /// Attempt to acquire the lock by opening the lock file with FileShare.None. Sets "Stream" -+ /// and returns true if successful, returns false if the lock is already held by another -+ /// thread or process. Guard must be held when calling this routine. -+ /// -+ internal bool TryLockFile() -+ { -+ Debug.Assert(Stream is null); -+ FileStream? stream = null; -+ try -+ { -+ stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); -+ // On some targets, the file locking used to implement FileShare.None may not be -+ // atomic with opening/creating the file. This creates a race window when another -+ // thread holds the lock and is just about to unlock: we may be able to open the -+ // file here, then the other thread unlocks and deletes the file, and then we -+ // acquire the lock on our file handle - but the actual file is already deleted. -+ // To close this race, we verify that the file does in fact still exist now that -+ // we have successfull acquired the locked FileStream. (Note that this check is -+ // safe because we cannot race with an other attempt to create the file since we -+ // hold the guard, and after the FileStream constructor returned we can no race -+ // with file deletion because we hold the lock.) -+ if (!File.Exists(FilePath)) -+ { -+ // To simplify the logic, we treat this case as "unable to acquire the lock" -+ // because it we caught another process while it owned the lock and was just -+ // giving it up. If the caller retries, we'll likely acquire the lock then. -+ stream.Dispose(); -+ return false; -+ } -+ } -+ catch (Exception) -+ { -+ stream?.Dispose(); -+ return false; -+ } -+ Stream = stream; -+ return true; -+ } -+ -+ /// -+ /// Release the lock by deleting the lock file and disposing "Stream". -+ /// -+ internal void UnlockFile() -+ { -+ Debug.Assert(Stream is not null); -+ try -+ { -+ // Delete the lock file while the stream is not yet disposed -+ // and we therefore still hold the FileShare.None exclusion. -+ // There may still be a race with another thread attempting a -+ // TryLockFile in parallel, but that is safely handled there. -+ File.Delete(FilePath); -+ } -+ finally -+ { -+ Stream.Dispose(); -+ Stream = null; -+ } -+ } -+ -+ public bool TryLock(int timeoutMs) -+ { -+ if (IsDisposed) -+ throw new ObjectDisposedException("Mutex"); -+ if (Stream is not null) -+ throw new InvalidOperationException("Lock already held"); -+ -+ var sw = Stopwatch.StartNew(); -+ do -+ { -+ try -+ { -+ // Attempt to acquire lock while holding guard. -+ using var guard = LockGuard(); -+ if (TryLockFile()) -+ return true; -+ } - catch (Exception) - { -- // Something else went wrong. - return false; - } -+ -+ // See comment in LockGuard. -+ Thread.Sleep(1); - } while (sw.ElapsedMilliseconds < timeoutMs); - - return false; - } - -- public void Unlock() -+ public bool CouldLock() - { -- if (!IsLocked) -- return; -- Stream.Unlock(0, 0); -- IsLocked = false; -+ if (IsDisposed) -+ return false; -+ if (Stream is not null) -+ return false; -+ -+ try -+ { -+ // Attempt to acquire lock while holding guard, and if successful -+ // immediately unlock again while still holding guard. This ensures -+ // no other thread will spuriously observe the lock as held due to -+ // the lock attempt here. -+ using var guard = LockGuard(); -+ if (TryLockFile()) -+ { -+ UnlockFile(); -+ return true; -+ } -+ } -+ catch (Exception) -+ { -+ return false; -+ } -+ -+ return false; - } - - public void Dispose() - { -- var wasLocked = IsLocked; -- if (wasLocked) -- Unlock(); -- Stream.Dispose(); -- // We do not delete the lock file here because there is no reliable way to perform a -- // 'delete if no one has the file open' operation atomically on *nix. This is a leak. -+ if (IsDisposed) -+ return; -+ IsDisposed = true; -+ if (Stream is not null) -+ { -+ try -+ { -+ UnlockFile(); -+ } -+ catch (Exception) -+ { -+ } -+ } - } - } - -@@ -792,56 +903,4 @@ namespace Microsoft.CodeAnalysis.Command - } - } - } -- -- /// -- /// Approximates a named mutex with 'locked', 'unlocked' and 'abandoned' states. -- /// There is no reliable way to detect whether a mutex has been abandoned on some target platforms, -- /// so we use the AliveMutex to manually track whether the creator of a mutex is still running, -- /// while the HeldMutex represents the actual lock state of the mutex. -- /// -- internal sealed class ServerFileMutexPair : IServerMutex -- { -- public readonly FileMutex AliveMutex; -- public readonly FileMutex HeldMutex; -- -- public bool IsDisposed { get; private set; } -- -- public ServerFileMutexPair(string mutexName, bool initiallyOwned, out bool createdNew) -- { -- AliveMutex = new FileMutex(mutexName + "-alive"); -- HeldMutex = new FileMutex(mutexName + "-held"); -- createdNew = AliveMutex.TryLock(0); -- if (initiallyOwned && createdNew) -- { -- if (!TryLock(0)) -- throw new Exception("Failed to lock mutex after creating it"); -- } -- } -- -- public bool TryLock(int timeoutMs) -- { -- if (IsDisposed) -- throw new ObjectDisposedException("Mutex"); -- return HeldMutex.TryLock(timeoutMs); -- } -- -- public void Dispose() -- { -- if (IsDisposed) -- return; -- IsDisposed = true; -- -- try -- { -- HeldMutex.Unlock(); -- AliveMutex.Unlock(); -- } -- finally -- { -- AliveMutex.Dispose(); -- HeldMutex.Dispose(); -- } -- } -- } -- - } diff --git a/roslyn-analyzers-no-apphost.patch b/roslyn-analyzers-no-apphost.patch deleted file mode 100644 index c1fc3dd..0000000 --- a/roslyn-analyzers-no-apphost.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj -+++ b/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj -@@ -4,6 +4,7 @@ - netcoreapp3.1 - true - true -+ false - - - diff --git a/roslyn-no-apphost.patch b/roslyn-no-apphost.patch deleted file mode 100644 index f1767c7..0000000 --- a/roslyn-no-apphost.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj -+++ b/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj -@@ -5,6 +5,7 @@ - Exe - netcoreapp3.1 - -+ false - false - - diff --git a/runtime-ROSA-rid.patch b/runtime-ROSA-rid.patch index 2a16e74..c865d1c 100644 --- a/runtime-ROSA-rid.patch +++ b/runtime-ROSA-rid.patch @@ -1,89 +1,8 @@ ---- src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json 2022-07-01 07:47:48.852264765 +0300 -+++ src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json-diff 2022-07-01 08:35:27.637855488 +0300 -@@ -2408,6 +2408,57 @@ - "rhel-x64" - ] - }, -+ "rosa": { -+ "#import": [ -+ "linux" -+ ] -+ }, -+ "rosa-arm64": { -+ "#import": [ -+ "rosa", -+ "linux-arm64" -+ ] -+ }, -+ "rosa-x64": { -+ "#import": [ -+ "rosa", -+ "linux-x64" -+ ] -+ }, -+ "rosa.2019.05": { -+ "#import": [ -+ "rosa" -+ ] -+ }, -+ "rosa.2019.05-arm64": { -+ "#import": [ -+ "rosa.2019.05", -+ "rosa-arm64" -+ ] -+ }, -+ "rosa.2019.05-x64": { -+ "#import": [ -+ "rosa.2019.05", -+ "rosa-x64" -+ ] -+ }, -+ "rosa.2021.1": { -+ "#import": [ -+ "rosa" -+ ] -+ }, -+ "rosa.2021.1-arm64": { -+ "#import": [ -+ "rosa.2021.1", -+ "rosa-arm64" -+ ] -+ }, -+ "rosa.2021.1-x64": { -+ "#import": [ -+ "rosa.2021.1", -+ "rosa-x64" -+ ] -+ }, - "sles": { - "#import": [ - "linux" -@@ -3766,4 +3817,4 @@ - ] - } - } --} -\ В конце файла нет новой строки -+} ---- src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props 2022-07-01 07:47:48.854264756 +0300 -+++ src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props-diff 2022-07-01 08:31:12.759936289 +0300 -@@ -215,6 +215,13 @@ - 9 - - -+ -+ linux -+ x64;arm64 -+ 2021.1;2019.05 -+ false -+ -+ - - linux - x64 ---- src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json 2022-07-01 07:47:48.852264765 +0300 -+++ src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json-diff 2022-07-01 08:40:44.789733576 +0300 -@@ -6020,6 +6020,98 @@ +diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json +index 0fd8c2d..3f8ba71 100644 +--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json ++++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json +@@ -6920,6 +6920,98 @@ "any", "base" ], @@ -182,10 +101,83 @@ "sles": [ "sles", "linux", -@@ -8921,4 +9013,4 @@ - "any", - "base" - ] --} -\ В конце файла нет новой строки -+} +diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json +index b1b0d9e..e2470a4 100644 +--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json ++++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json +@@ -2661,6 +2661,57 @@ + "rhel.9-x64" + ] + }, ++ "rosa": { ++ "#import": [ ++ "linux" ++ ] ++ }, ++ "rosa-arm64": { ++ "#import": [ ++ "rosa", ++ "linux-arm64" ++ ] ++ }, ++ "rosa-x64": { ++ "#import": [ ++ "rosa", ++ "linux-x64" ++ ] ++ }, ++ "rosa.2019.05": { ++ "#import": [ ++ "rosa" ++ ] ++ }, ++ "rosa.2019.05-arm64": { ++ "#import": [ ++ "rosa.2019.05", ++ "rosa-arm64" ++ ] ++ }, ++ "rosa.2019.05-x64": { ++ "#import": [ ++ "rosa.2019.05", ++ "rosa-x64" ++ ] ++ }, ++ "rosa.2021.1": { ++ "#import": [ ++ "rosa" ++ ] ++ }, ++ "rosa.2021.1-arm64": { ++ "#import": [ ++ "rosa.2021.1", ++ "rosa-arm64" ++ ] ++ }, ++ "rosa.2021.1-x64": { ++ "#import": [ ++ "rosa.2021.1", ++ "rosa-x64" ++ ] ++ }, + "sles": { + "#import": [ + "linux" +diff --git a/dotnet-v6.0.403/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/dotnet-v6.0.403-diff/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props +index b54f07c..7259c36 100644 +--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props ++++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props +@@ -223,6 +223,13 @@ + false + + ++ ++ linux ++ x64;arm64 ++ 2021.1;2019.05 ++ false ++ ++ + + linux + x64 diff --git a/runtime-clang15-support.patch b/runtime-clang15-support.patch new file mode 100644 index 0000000..b68ab4d --- /dev/null +++ b/runtime-clang15-support.patch @@ -0,0 +1,58 @@ +From 992cf8c97cc71d4ca9a0a11e6604a6716ed4cefc Mon Sep 17 00:00:00 2001 +From: Adeel Mujahid <3840695+am11@users.noreply.github.com> +Date: Fri, 29 Jul 2022 19:34:00 +0300 +Subject: [PATCH] Define __cpuid{ex} only when there's no builtin one (#73065) + +* Define __cpuid{ex} only when there's no builtin one + +Fix clang 15 RC1 build: `error: definition of builtin function '__cpuid'` + +* Add clang-15 autodetection +--- + eng/common/native/find-native-compiler.sh | 2 +- + src/coreclr/vm/amd64/unixstubs.cpp | 4 ++++ + 3 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/eng/common/native/find-native-compiler.sh b/eng/common/native/find-native-compiler.sh +index 4b99a9cad3b77..41a26d802a93f 100644 +--- a/eng/common/native/find-native-compiler.sh ++++ b/eng/common/native/find-native-compiler.sh +@@ -55,7 +55,7 @@ + # Set default versions + if [ -z "$majorVersion" ]; then + # note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero. +- if [ "$compiler" = "clang" ]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) ++ if [[ "$compiler" == "clang" ]]; then versions=( 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) + elif [ "$compiler" = "gcc" ]; then versions=( 9 8 7 6 5 4.9 ); fi + + for version in "${versions[@]}"; do +diff --git a/src/coreclr/vm/amd64/unixstubs.cpp b/src/coreclr/vm/amd64/unixstubs.cpp +index 517eea98f6b6a..09d2568a9273b 100644 +--- a/src/coreclr/vm/amd64/unixstubs.cpp ++++ b/src/coreclr/vm/amd64/unixstubs.cpp +@@ -10,6 +10,7 @@ extern "C" + PORTABILITY_ASSERT("Implement for PAL"); + } + ++#if !__has_builtin(__cpuid) + void __cpuid(int cpuInfo[4], int function_id) + { + // Based on the Clang implementation provided in cpuid.h: +@@ -20,7 +21,9 @@ extern "C" + : "0"(function_id) + ); + } ++#endif + ++#if !__has_builtin(__cpuidex) + void __cpuidex(int cpuInfo[4], int function_id, int subFunction_id) + { + // Based on the Clang implementation provided in cpuid.h: +@@ -31,6 +34,7 @@ extern "C" + : "0"(function_id), "2"(subFunction_id) + ); + } ++#endif + + DWORD xmmYmmStateSupport() + { diff --git a/runtime-fedora-37-rid.patch b/runtime-fedora-37-rid.patch deleted file mode 100644 index 720fdcb..0000000 --- a/runtime-fedora-37-rid.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json -index bf6dfc3c1a1..1de4979b8ee 100644 ---- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json -+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json -@@ -3029,6 +3029,38 @@ - "any", - "base" - ], -+ "fedora.37": [ -+ "fedora.37", -+ "fedora", -+ "linux", -+ "unix", -+ "any", -+ "base" -+ ], -+ "fedora.37-arm64": [ -+ "fedora.37-arm64", -+ "fedora.37", -+ "fedora-arm64", -+ "fedora", -+ "linux-arm64", -+ "linux", -+ "unix-arm64", -+ "unix", -+ "any", -+ "base" -+ ], -+ "fedora.37-x64": [ -+ "fedora.37-x64", -+ "fedora.37", -+ "fedora-x64", -+ "fedora", -+ "linux-x64", -+ "linux", -+ "unix-x64", -+ "unix", -+ "any", -+ "base" -+ ], - "freebsd": [ - "freebsd", - "unix", -diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json -index 2e6ec616b74..70a1582ba64 100644 ---- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json -+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json -@@ -1146,6 +1146,23 @@ - "fedora-x64" - ] - }, -+ "fedora.37": { -+ "#import": [ -+ "fedora" -+ ] -+ }, -+ "fedora.37-arm64": { -+ "#import": [ -+ "fedora.37", -+ "fedora-arm64" -+ ] -+ }, -+ "fedora.37-x64": { -+ "#import": [ -+ "fedora.37", -+ "fedora-x64" -+ ] -+ }, - "freebsd": { - "#import": [ - "unix" -diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props -index 1945bb9af0e..75c6d28a30f 100644 ---- a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props -+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props -@@ -71,7 +71,7 @@ - - linux - x64;arm64 -- 23;24;25;26;27;28;29;30;31;32;33;34;35;36 -+ 23;24;25;26;27;28;29;30;31;32;33;34;35;36;37 - false - - diff --git a/runtime-strerror.patch b/runtime-strerror.patch new file mode 100644 index 0000000..35d5605 --- /dev/null +++ b/runtime-strerror.patch @@ -0,0 +1,172 @@ +From 577a70afa472a2b7aa8e05947e185d920f42b23d Mon Sep 17 00:00:00 2001 +From: Adeel Mujahid <3840695+am11@users.noreply.github.com> +Date: Tue, 2 Nov 2021 17:47:37 +0200 +Subject: [PATCH] Fix gcc warnings during mono linux-x64 build (#60675) + +* Fix gcc warnings during mono linux-x64 build + +main with Debug configuration: 822 warnings - http://sprunge.us/2GzrDE +PR with Debug configuration: 3 warnings related to deprecated sys/sysctl.h includes - http://sprunge.us/JuyA3K + +after fixing Debug warnings, there were 13 additional warnings in Release configuration: +http://sprunge.us/PJCivP + +PR with Release configuration: (same) 3 warnings - http://sprunge.us/NwKHNE + +* Address CR feedback +--- + src/mono/cmake/config.h.in | 7 +-- + src/mono/cmake/configure.cmake | 40 +++++++++++--- + src/mono/cmake/defines-todo.cmake | 1 - + src/mono/mono/eglib/gstr.c | 14 ++--- + src/mono/mono/utils/mono-proclib.c | 28 +++++----- + 5 files changed, 173 insertions(+), 192 deletions(-) + +diff --git a/src/mono/cmake/config.h.in b/src/mono/cmake/config.h.in +index 48a82ec6db8c4..648ad60dd0494 100644 +--- a/src/mono/cmake/config.h.in ++++ b/src/mono/cmake/config.h.in +@@ -510,14 +510,11 @@ + /* Define to 1 if you have the `strerror_r' function. */ + #cmakedefine HAVE_STRERROR_R 1 + +-/* Define to 1 if strerror_r returns char *. */ +-#cmakedefine STRERROR_R_CHAR_P 1 +- + /* Have GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY */ + #cmakedefine GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY 1 + + /* GLIBC has CPU_COUNT macro in sched.h */ +-#cmakedefine GLIBC_HAS_CPU_COUNT 1 ++#cmakedefine HAVE_GNU_CPU_COUNT + + /* Have large file support */ + #cmakedefine HAVE_LARGE_FILE_SUPPORT 1 +@@ -712,6 +709,8 @@ + /* The size of `size_t', as computed by sizeof. */ + #define SIZEOF_SIZE_T @SIZEOF_SIZE_T@ + ++#cmakedefine01 HAVE_GNU_STRERROR_R ++ + /* Define to 1 if the system has the type `struct sockaddr'. */ + #cmakedefine HAVE_STRUCT_SOCKADDR 1 + +diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake +index 7bee1c6b98553..e8e9fb9e67d79 100644 +--- a/src/mono/cmake/configure.cmake ++++ b/src/mono/cmake/configure.cmake +@@ -135,6 +135,37 @@ + check_type_size("long long" SIZEOF_LONG_LONG) + check_type_size("size_t" SIZEOF_SIZE_T) + ++if (HOST_LINUX OR HOST_ANDROID) ++ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) ++endif() ++ ++check_c_source_compiles( ++ " ++ #include ++ int main(void) ++ { ++ char buffer[1]; ++ char c = *strerror_r(0, buffer, 0); ++ return 0; ++ } ++ " ++ HAVE_GNU_STRERROR_R) ++ ++check_c_source_compiles( ++ " ++ #include ++ int main(void) ++ { ++ CPU_COUNT((void *) 0); ++ return 0; ++ } ++ " ++ HAVE_GNU_CPU_COUNT) ++ ++if (HOST_LINUX OR HOST_ANDROID) ++ set(CMAKE_REQUIRED_DEFINITIONS) ++endif() ++ + # ICONV + set(ICONV_LIB) + find_library(LIBICONV_FOUND iconv) +@@ -142,14 +173,6 @@ + set(ICONV_LIB "iconv") + endif() + +-file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test.c +- "#include \n" +- "void main () { CPU_COUNT((void *) 0); }\n" +-) +-try_compile(GLIBC_HAS_CPU_COUNT ${CMAKE_BINARY_DIR}/CMakeTmp SOURCES "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test.c" +- COMPILE_DEFINITIONS "-D_GNU_SOURCE") +- +- + if(HOST_WIN32) + # checking for this doesn't work for some reason, hardcode result + set(HAVE_WINTERNL_H 1) +diff --git a/src/mono/cmake/defines-todo.cmake b/src/mono/cmake/defines-todo.cmake +index d45098d4eea4f..8d2828d53e9ba 100644 +--- a/src/mono/cmake/defines-todo.cmake ++++ b/src/mono/cmake/defines-todo.cmake +@@ -4,7 +4,6 @@ + + #option (MAJOR_IN_MKDEV "Define to 1 if `major', `minor', and `makedev' are declared in .") + #option (MAJOR_IN_SYSMACROS "Define to 1 if `major', `minor', and `makedev' are declared in .") +-#option (STRERROR_R_CHAR_P "Define to 1 if strerror_r returns char *.") + #option (HAVE_LIBICONV "Define to 1 if you have the `iconv' library (-liconv).") + #option (ANDROID_UNIFIED_HEADERS "Whether Android NDK unified headers are used") + #option (MONO_DL_NEED_USCORE "Does dlsym require leading underscore.") +diff --git a/src/mono/mono/eglib/gstr.c b/src/mono/mono/eglib/gstr.c +index c549b241894f1..cbf63d8f02b97 100644 +--- a/src/mono/mono/eglib/gstr.c ++++ b/src/mono/mono/eglib/gstr.c +@@ -249,7 +249,11 @@ g_strerror (gint errnum) + size_t buff_len = sizeof (tmp_buff); + buff [0] = 0; + +-#ifndef STRERROR_R_CHAR_P ++#if HAVE_GNU_STRERROR_R ++ buff = strerror_r (errnum, buff, buff_len); ++ if (!error_messages [errnum]) ++ error_messages [errnum] = g_strdup (buff); ++#else /* HAVE_GNU_STRERROR_R */ + int r; + while ((r = strerror_r (errnum, buff, buff_len - 1))) { + if (r != ERANGE) { +@@ -261,17 +265,13 @@ g_strerror (gint errnum) + else + buff = g_realloc (buff, buff_len * 2); + buff_len *= 2; +- //Spec is not clean on whether size argument includes space for null terminator or not ++ //Spec is not clean on whether size argument includes space for null terminator or not + } + if (!error_messages [errnum]) + error_messages [errnum] = g_strdup (buff); + if (buff != tmp_buff) + g_free (buff); +-#else /* STRERROR_R_CHAR_P */ +- buff = strerror_r (errnum, buff, buff_len); +- if (!error_messages [errnum]) +- error_messages [errnum] = g_strdup (buff); +-#endif /* STRERROR_R_CHAR_P */ ++#endif /* HAVE_GNU_STRERROR_R */ + + #else /* HAVE_STRERROR_R */ + if (!error_messages [errnum]) +diff --git a/src/mono/mono/utils/mono-proclib.c b/src/mono/mono/utils/mono-proclib.c +index 1fe731d9fe0f5..9a33fc2924e6b 100644 +--- a/src/mono/mono/utils/mono-proclib.c ++++ b/src/mono/mono/utils/mono-proclib.c +@@ -81,7 +81,7 @@ + #endif + + #ifdef HAVE_SCHED_GETAFFINITY +-# ifndef GLIBC_HAS_CPU_COUNT ++# ifndef HAVE_GNU_CPU_COUNT + static int + CPU_COUNT(cpu_set_t *set) + { diff --git a/vstest-use-work-tree-with-git-apply.patch b/vstest-use-work-tree-with-git-apply.patch deleted file mode 100644 index 58c139f..0000000 --- a/vstest-use-work-tree-with-git-apply.patch +++ /dev/null @@ -1,33 +0,0 @@ -From b2c4b2427d8c1a2410c4210789caccf1ec87e64a Mon Sep 17 00:00:00 2001 -From: Omair Majid -Date: Thu, 9 Sep 2021 13:21:51 -0400 -Subject: [PATCH] [ArPow] Use --work-tree with git apply - -This makes things work better in a source-tarball build, where there may -be a .git directory somewhere in our parent directories but it's for a -different repo than vstest. In a situation like that a plain `git apply` -will (silently!) ignore patches because they wont apply to the unrelated -repository. That will (eventually) make the source-build fail. -`--work-tree` makes git directly use the directory that we care about. - -See https://github.com/dotnet/source-build/issues/2445 for more details. ---- - eng/SourceBuild.props | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props -index b365645c..68f82592 100644 ---- a/eng/SourceBuild.props -+++ b/eng/SourceBuild.props -@@ -24,7 +24,7 @@ - - - - --- -2.31.1 - diff --git a/xliff-tasks-use-work-tree-with-git-apply.patch b/xliff-tasks-use-work-tree-with-git-apply.patch deleted file mode 100644 index 810cf67..0000000 --- a/xliff-tasks-use-work-tree-with-git-apply.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/eng/SourceBuild.props -+++ b/eng/SourceBuild.props -@@ -15,7 +15,7 @@ - - - -