community/dotnet7-stage0: sync with aports

This commit is contained in:
Antoine Martin 2023-11-24 17:52:33 -05:00
parent 30f6e014bd
commit 8b189a521f
4 changed files with 416 additions and 42 deletions

View file

@ -2,8 +2,8 @@
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=dotnet7-stage0
pkgver=7.0.110
pkgrel=0
pkgver=7.0.105
pkgrel=4
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
@ -17,7 +17,8 @@ _bootstraprel=0
_installerver=${_gittag/v}
# Version of packages that aren't defined in git-info or badly defined
_aspnetver=7.0.10
_iltoolsver=7.0.2-servicing.22607.1
_aspnetver=7.0.4
# Patches to be used. String before '_' refers to repo to patch
# Look for patch notes within each patch for what they fix / where they come from
@ -28,6 +29,8 @@ _patches="
runtime_76500-properly-set-toolchain-for-alpine.patch
runtime_82269-mono-thread-coop-undefine-fortify-source.patch
runtime_83682-specify-notext-on-linux-musl-x86.patch
runtime_84413-support-adding-rids-with-dash-in-base-part.patch
runtime_84444-suppress-clang-16-warnings.patch
runtime_enable-runtime-marshalling.diff
runtime_remove-usage-of-off64-t.patch
"
@ -40,7 +43,8 @@ pkgdesc="The .NET Core stage0 bits for dotnet build"
# armhf: blocked by https://github.com/dotnet/runtime/issues/77663
# x86: blocked by https://github.com/dotnet/runtime/issues/83509
# riscv64: port WIP https://github.com/dotnet/runtime/issues/36748
arch="all !x86 !armhf !riscv64"
# s390x: no diskspace | lack maintainer resources
arch="x86_64 armv7 aarch64"
url=https://dotnet.microsoft.com
_giturl=https://github.com/dotnet/installer
license="MIT"
@ -54,8 +58,6 @@ source="
dotnet-sdk-$_bootstrapver-linux-musl-x64.noextract::https://dotnetcli.azureedge.net/dotnet/Sdk/$_bootstrapver/dotnet-sdk-$_bootstrapver-linux-musl-x64.tar.gz
dotnet-sdk-$_bootstrapver-linux-musl-arm64.noextract::https://dotnetcli.azureedge.net/dotnet/Sdk/$_bootstrapver/dotnet-sdk-$_bootstrapver-linux-musl-arm64.tar.gz
dotnet-sdk-$_bootstrapver-linux-musl-arm.noextract::https://dotnetcli.azureedge.net/dotnet/Sdk/$_bootstrapver/dotnet-sdk-$_bootstrapver-linux-musl-arm.tar.gz
dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-s390x.noextract::https://lab.ilot.io/ayakael/dotnet-stage0/-/releases/$_bootstrapver-r$_bootstraprel/downloads/sdk/dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-s390x.tar.xz
dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-ppc64le.noextract::https://lab.ilot.io/ayakael/dotnet-stage0/-/releases/$_bootstrapver-r$_bootstraprel/downloads/sdk/dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-ppc64le.tar.xz
Private.SourceBuilt.Artifacts.$_artifactsver.noextract::https://dotnetcli.azureedge.net/source-built-artifacts/assets/Private.SourceBuilt.Artifacts.$_artifactsver.tar.gz
$_extra_nupkgs
$_patches
@ -220,33 +222,10 @@ prepare() {
tmp=$(mktemp)
jq ".sdk.version = \"$_bootstrapver\"" "$builddir"/src/$i/global.json > $tmp && mv $tmp "$builddir"/src/$i/global.json
done
# extracting PackageVersions.props as some version information is there
tar -xzf "$srcdir"/Private.SourceBuilt.Artifacts.*.noextract PackageVersions.props
}
_init() {
export _InitializeDotNetCli=$_cli_root
export DOTNET_INSTALL_DIR=$_cli_root
export PATH="$_cli_root:$PATH"
export NUGET_PACKAGES=$_nugetdir
export DotNetBuildFromSource=true
export DOTNET_CLI_TELEMETRY_OPTOUT=true
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
export SHELL=/bin/bash
export EXTRA_CPPFLAGS="${CPPFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_CXXFLAGS="${CXXFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_CFLAGS="${CFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_LDFLAGS="$LDFLAGS"
unset CXXFLAGS CFLAGS LDFLAGS CPPFLAGS
ulimit -n 4096
"$_cli_root"/dotnet build-server shutdown
}
_runtime() {
_init
"$_cli_root"/dotnet build-server shutdown
if [ -z "${_runtimever+x}" ]; then
local _runtimever=$(grep OutputPackageVersion "$builddir"/git-info/runtime.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
@ -287,8 +266,33 @@ _runtime() {
cp artifacts/packages/*/*/dotnet-runtime-*-*.tar.gz $_downloaddir/Runtime/$_runtimever_ns
}
_roslyn() {
"$_cli_root"/dotnet build-server shutdown
if [ -z "${_roslynver+x}" ]; then
local _roslynver=$(grep OutputPackageVersion "$builddir"/git-info/roslyn.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
local _roslynver_ns=$(awk '{if($2 == "Name=\"Microsoft.Net.Compilers.Toolset\""){print $3}}' "$builddir"/src/installer/eng/Version.Details.xml | awk -F '"' '{print $2}')
msg "[$(date)] Building roslyn version $_roslynver"
cd "$builddir"/src/roslyn
local args="
-c Release
-bl
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/git-info/roslyn.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
"
if [ "$_roslynver" != "${_roslynver##*-}" ]; then
local args="$args /p:VersionSuffix=${_roslynver##*-}"
fi
DotNetBuildFromSource=false ./eng/build.sh --restore $args /p:UseAppHost=false
./eng/build.sh --restore --build --pack $args
for i in artifacts/packages/*/*/*.nupkg; do
$_nuget push $i --source="$_packagesdir"
done
}
_sdk() {
_init
"$_cli_root"/dotnet build-server shutdown
if [ -z "${_sdkver+x}" ]; then
local _sdkver=$(grep OutputPackageVersion "$builddir"/git-info/sdk.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
@ -318,7 +322,7 @@ _sdk() {
}
_aspnetcore() {
_init
"$_cli_root"/dotnet build-server shutdown
if [ -z "${_aspnetver+x}" ]; then
local _aspnetver=$(grep OutputPackageVersion "$builddir"/git-info/aspnetcore.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
@ -357,7 +361,7 @@ _aspnetcore() {
}
_installer() {
_init
"$_cli_root"/dotnet build-server shutdown
msg "[$(date)] Building installer version $_installerver"
cd "$builddir"/src/installer
@ -391,7 +395,24 @@ _installer() {
}
build() {
export _InitializeDotNetCli=$_cli_root
export DOTNET_INSTALL_DIR=$_cli_root
export PATH="$_cli_root:$PATH"
export NUGET_PACKAGES=$_nugetdir
export DotNetBuildFromSource=true
export DOTNET_CLI_TELEMETRY_OPTOUT=true
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
export SHELL=/bin/bash
export EXTRA_CPPFLAGS="${CPPFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_CXXFLAGS="${CXXFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_CFLAGS="${CFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_LDFLAGS="$LDFLAGS"
unset CXXFLAGS CFLAGS LDFLAGS CPPFLAGS
ulimit -n 4096
_runtime
_roslyn
_sdk
_aspnetcore
_installer
@ -409,8 +430,6 @@ bootstrap() {
provides="dotnet$_pkgver_name-bootstrap"
provider_priority=$_pkgver_prior
local _iltoolsver=$(grep \<MicrosoftNETCoreILAsmVersion "$builddir"/PackageVersions.props | sed -E 's|</?MicrosoftNETCoreILAsmVersion>||g' | tr -d ' ')
install -dm 755 \
"$subpkgdir"/$_libdir/dotnet/bootstrap/$pkgver/docs \
"$subpkgdir"/$_libdir/dotnet/bootstrap/$pkgver/comp \
@ -498,12 +517,10 @@ artifacts() {
}
sha512sums="
806bc8467dd23bb07d80afea00ec7973040302c509e544121bb26a308a3cc1e861a34b784d02f9ecf218acbb46fa32679c8fa56c86c04f58767c530a3592aeb6 dotnet-v7.0.110.tar.xz
bfc122f316673fe4014e891eb101ecf40efc2ed4ecaff0cbd4bb5c17f547ccaa867ae8af22f41813565630cdb68e2972633703a88478fadde39584f91588589d dotnet-v7.0.105.tar.xz
8fb7d1754359e3fda35b7a07e13d2a5e9e723196b980dd922b30919aedaddbedd4d82e28b37471437b69cb93e4b1d136ac701e221924e44d0be6b6ba94dc3654 dotnet-sdk-7.0.105-linux-musl-x64.noextract
c8120c20939232b53a3cdc607d812d93fadd6dea9466f9454df559f8b7eb334c69fdfd31bc60e4c70b6cf4fc519a25a0439902b04cf5c5bd0c29de020024fbe2 dotnet-sdk-7.0.105-linux-musl-arm64.noextract
9ffa724ccc02dc3e40afe22f0546a9bdf68b6314cf6da03d9387fb010fe3e5935154a5c06c4a2d588ff4ac77f34120a4ae9bc0237fb24452d78e6698435acf72 dotnet-sdk-7.0.105-linux-musl-arm.noextract
0d6a0f394d53043ffe9aca972a9a4d173f9eb3cad4660422d377080e46cf8cc91f3cbdd05d33095b479c465756d44afe264adb6bdf84d7b05ebc420c3e938837 dotnet-sdk-7.0.105-r0-linux-musl-s390x.noextract
7b29bce712237634cfcb5fb96c74254736d2279c78e7c74f4471a16391f4af16754819f1a93ac4f24e7dd199a91264c6b398e930020f264dfb4e894acca0e452 dotnet-sdk-7.0.105-r0-linux-musl-ppc64le.noextract
e5d8f11d5da842309c1e7cf9936eb0cf3cfb56aaa17aeee64fe264b3e6771ee56dd6c405a4c16950b4e4607dab21bc0ec40783f69b0865a6112d7d03b1b57487 Private.SourceBuilt.Artifacts.7.0.102.noextract
2ede8d9352a51861a5b2550010ff55da8241381a6fa6cc49e025f1c289b230b8c0177e93850de4ea8b6f702c1f2d50d81a9f4d890ca9441c257b614f2a5e05dd stylecop.analyzers.1.2.0-beta.435.nupkg
b6a2dfeccac329546f87f1019c1f2cf07e2f294dd33914449ad08d92269c8713b6fa1e330ef257c24e189023fd0b824df97688b0ba6e578a6d0292b07a72b4c1 installer_set-crossgen2rid-using-buildarchitecture.patch
@ -511,6 +528,8 @@ b6a2dfeccac329546f87f1019c1f2cf07e2f294dd33914449ad08d92269c8713b6fa1e330ef257c2
24f3fed752922d2ca3c151f21fedf6a257c7c74a155105a1aa09cdc847ba24e496212cb2d8548b134a8901c7da8d78c27fa93579211f7bdeadc598f808fed4a8 runtime_76500-properly-set-toolchain-for-alpine.patch
d732df247c721c9f677baabdd7f36dbf4b564814ff64164361065bb1c196b767494a1d39f634eadf01a23032c7b3e64102614b7213065c81096bbf3f8022e6a0 runtime_82269-mono-thread-coop-undefine-fortify-source.patch
2dd195d5275245fe85bea2f75019fd3cbadcef7f5691b44c08db470265c6e7fcb2a50b3276a96df7547af76953623fdc92bd1ad51ccef6738813b78d22327fa3 runtime_83682-specify-notext-on-linux-musl-x86.patch
741d210b83d4dfca79338def253c82737b6d5f319052173f37aa6dfb5b8e90bfc29272657301095a9623ae2c72449ed6fc60cc6c70fcf88f15c66f89cbd3c201 runtime_enable-runtime-marshalling.diff
2ed962096eb9d8ae61831d224ceb05b8f77f5692f38a3457048d1b4abef705e8e4f676b81bb1a833e338e75ac8dc80b0631b1a45ad9a15c5597740b7320bfbb5 runtime_84413-support-adding-rids-with-dash-in-base-part.patch
929d5be2e4a213ad726652c24478e45abe1bf1d444c01a8975da007f246cb056916ad4681e541436faa89447e35c5e0a6101ae4ecaecc8083155b04e7138beb8 runtime_84444-suppress-clang-16-warnings.patch
1f7be536c4826638853f110ee88bbd554be015cc88c6491c1066830789be18ad324f8ed2b1b75ed7aad74457dcafc812730059cb25d36d6344bfae8a517c00c4 runtime_enable-runtime-marshalling.diff
d972e77df27748a80c9b23eca12f9fbd78be97f9034b79cc5703ba58eb6750171d9a115314300f883620ccbca89c65a99ca7a45d54a421b028b590190b4bed80 runtime_remove-usage-of-off64-t.patch
"

View file

@ -0,0 +1,164 @@
From abc761c2c5694e4029fea1a60dc1934951c66e26 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/84413
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Thu, 6 Apr 2023 13:18:11 +0200
Subject: [PATCH 1/2] Microsoft.NETCore.Platforms: support adding rids with '-'
in the base part.
Currently when trying to add a rid like 'linux-musl-x64'
the rid is not understood to be base = 'linux-musl', arch = 'x64'.
Instead the parser considers a potential optional qualifier.
This causes the rid to be parsed as base = 'linux', arch = 'musl',
and qualifier = 'x64'.
We know the rids being added won't have a qualifier. If we take
this into account while parsing, we can parse the rid correctly.
---
.../Microsoft.NETCore.Platforms/src/RID.cs | 11 +++-
.../src/RuntimeGroupCollection.cs | 2 +-
.../tests/RidTests.cs | 50 +++++++++++++------
3 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs
index 6457fd29cadf0..b464d5f0f54e3 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs
@@ -56,7 +56,7 @@ private enum RIDPart : int
Max = Qualifier
}
- public static RID Parse(string runtimeIdentifier)
+ public static RID Parse(string runtimeIdentifier, bool noQualifier)
{
string[] parts = new string[(int)RIDPart.Max + 1];
bool omitVersionDelimiter = true;
@@ -90,6 +90,15 @@ public static RID Parse(string runtimeIdentifier)
// version might be omitted
else if (current == ArchitectureDelimiter)
{
+ // The qualifier delimiter and architecture delimiter are the same.
+ // When there is no qualifier, there will be one delimiter past the base part
+ // for the architecture.
+ // So if we see another delimiter later in the string (for the architecture),
+ // extend the base part instead of starting the architecture part.
+ if (noQualifier && runtimeIdentifier.IndexOf(ArchitectureDelimiter, i + 1) != -1)
+ {
+ break;
+ }
// ensure there's no version later in the string
if (runtimeIdentifier.IndexOf(VersionDelimiter, i) != -1)
{
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
index e069508053105..31009a8d28e5e 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
@@ -34,7 +34,7 @@ public RuntimeGroupCollection(ICollection<RuntimeGroup> runtimeGroups)
/// <param name="parent"></param>
public void AddRuntimeIdentifier(string runtimeIdentifier, string parent)
{
- RID rid = RID.Parse(runtimeIdentifier);
+ RID rid = RID.Parse(runtimeIdentifier, noQualifier: true);
AddRuntimeIdentifier(rid, parent);
}
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs
index 227bcbdd10d4d..8dee0ebeda17a 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs
@@ -10,35 +10,57 @@ public class RidTests
{
public static IEnumerable<object[]> ValidRIDData()
{
- yield return new object[] { "win10-x64", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10"), Architecture = "x64" } };
- yield return new object[] { "win10", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10")} };
- yield return new object[] { "linux", new RID() { BaseRID = "linux" } };
- yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" } };
- yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" } };
- yield return new object[] { "debian.10-x64", new RID() { BaseRID = "debian", Version = new RuntimeVersion("10"), Architecture = "x64" } };
- yield return new object[] { "linuxmint.19.2-x64", new RID() { BaseRID = "linuxmint", Version = new RuntimeVersion("19.2"), Architecture = "x64" } };
- yield return new object[] { "ubuntu.14.04-x64", new RID() { BaseRID = "ubuntu", Version = new RuntimeVersion("14.04"), Architecture = "x64" } };
- yield return new object[] { "foo-bar.42-arm", new RID() { BaseRID = "foo-bar", Version = new RuntimeVersion("42"), Architecture = "arm" } };
- yield return new object[] { "foo-bar-arm", new RID() { BaseRID = "foo", Architecture = "bar", Qualifier = "arm" } }; // demonstrates ambiguity, avoid using `-` in base
- yield return new object[] { "linux-musl-x64", new RID() { BaseRID = "linux", Architecture = "musl", Qualifier = "x64" } }; // yes, we already have ambiguous RIDs
+ yield return new object[] { "win10-x64", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10"), Architecture = "x64" }, null };
+ yield return new object[] { "win10", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10")}, null };
+ yield return new object[] { "linux", new RID() { BaseRID = "linux" }, null };
+ yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" }, null };
+ yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" }, null };
+ yield return new object[] { "debian.10-x64", new RID() { BaseRID = "debian", Version = new RuntimeVersion("10"), Architecture = "x64" }, null };
+ yield return new object[] { "linuxmint.19.2-x64", new RID() { BaseRID = "linuxmint", Version = new RuntimeVersion("19.2"), Architecture = "x64" }, null };
+ yield return new object[] { "ubuntu.14.04-x64", new RID() { BaseRID = "ubuntu", Version = new RuntimeVersion("14.04"), Architecture = "x64" }, null };
+ yield return new object[] { "foo-bar.42-arm", new RID() { BaseRID = "foo-bar", Version = new RuntimeVersion("42"), Architecture = "arm" }, null };
+ yield return new object[] { "foo-bar-arm", new RID() { BaseRID = "foo", Architecture = "bar", Qualifier = "arm" }, // demonstrates ambiguity, avoid using `-` in base
+ new RID() { BaseRID = "foo-bar", Architecture = "arm" } };
+ yield return new object[] { "linux-musl-x64", new RID() { BaseRID = "linux", Architecture = "musl", Qualifier = "x64" }, // yes, we already have ambiguous RIDs
+ new RID() { BaseRID = "linux-musl", Architecture = "x64" } };
}
[Theory]
[MemberData(nameof(ValidRIDData))]
- internal void ParseCorrectly(string input, RID expected)
+ internal void ParseCorrectly(string input, RID expected, RID? expectedNoQualifier)
{
- RID actual = RID.Parse(input);
+ _ = expectedNoQualifier; // unused
+
+ RID actual = RID.Parse(input, noQualifier: false);
Assert.Equal(expected, actual);
}
[Theory]
[MemberData(nameof(ValidRIDData))]
- internal void ToStringAsExpected(string expected, RID rid)
+ internal void ParseCorrectlyNoQualifier(string input, RID expected, RID? expectedNoQualifier)
+ {
+ expectedNoQualifier ??= expected;
+
+ RID actual = RID.Parse(input, noQualifier: true);
+
+ Assert.Equal(expectedNoQualifier, actual);
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidRIDData))]
+ internal void ToStringAsExpected(string expected, RID rid, RID? expectedNoQualifierRid)
{
string actual = rid.ToString();
Assert.Equal(expected, actual);
+
+ if (expectedNoQualifierRid is not null)
+ {
+ actual = expectedNoQualifierRid.ToString();
+
+ Assert.Equal(expected, actual);
+ }
}
}
}
From f70da467ca94291039e0ea5b0723cb9db5e090e7 Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Thu, 6 Apr 2023 18:14:31 +0200
Subject: [PATCH 2/2] Update
src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
---
.../Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
index 31009a8d28e5e..ec4762d71424c 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
@@ -34,6 +34,7 @@ public RuntimeGroupCollection(ICollection<RuntimeGroup> runtimeGroups)
/// <param name="parent"></param>
public void AddRuntimeIdentifier(string runtimeIdentifier, string parent)
{
+ // don't parse qualifier since we don't use them and they are ambiguous with `-` in base RID
RID rid = RID.Parse(runtimeIdentifier, noQualifier: true);
AddRuntimeIdentifier(rid, parent);

View file

@ -0,0 +1,192 @@
From 4b82b0b1173981ea5f2c7baf003a66fad31208c9 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/84443
From: Antoine Martin <dev@ayakael.net>
Date: Thu, 6 Apr 2023 16:01:47 -0400
Subject: [PATCH 1/2] Suppress clang-16 warnings (#81573)
---
eng/common/native/init-compiler.sh | 2 +-
eng/native/configurecompiler.cmake | 9 +++++++++
src/coreclr/dlls/mscordbi/CMakeLists.txt | 5 +----
src/coreclr/dlls/mscordbi/mscordbi.cpp | 15 +++++++++++++++
src/native/corehost/apphost/static/CMakeLists.txt | 4 ++--
...orts.src => singlefilehost_freebsdexports.src} | 4 ++++
.../apphost/static/singlefilehost_unixexports.src | 4 ----
7 files changed, 32 insertions(+), 11 deletions(-)
rename src/native/corehost/apphost/static/{singlefilehost_OSXexports.src => singlefilehost_freebsdexports.src} (81%)
diff --git a/src/runtime/eng/common/native/init-compiler.sh b/src/runtime/eng/common/native/init-compiler.sh
index 41a26d802a93f..f13b74080edf9 100644
--- a/src/runtime/eng/common/native/init-compiler.sh
+++ b/src/runtime/eng/common/native/init-compiler.sh
@@ -71,7 +71,7 @@ if [[ -z "$CLR_CC" ]]; then
# 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=( 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 )
+ if [[ "$compiler" == "clang" ]]; then versions=( 16 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=( 12 11 10 9 8 7 6 5 4.9 ); fi
for version in "${versions[@]}"; do
diff --git a/src/runtime/eng/native/configurecompiler.cmake b/src/runtime/eng/native/configurecompiler.cmake
index 9090289f50e34..eaf5a867c5f6d 100644
--- a/src/runtime/eng/native/configurecompiler.cmake
+++ b/src/runtime/eng/native/configurecompiler.cmake
@@ -447,6 +447,15 @@ if (CLR_CMAKE_HOST_UNIX)
add_compile_options(-Wno-incompatible-ms-struct)
add_compile_options(-Wno-reserved-identifier)
+
+ # clang 16.0 introduced buffer hardening https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734
+ # which we are not conforming to yet.
+ add_compile_options(-Wno-unsafe-buffer-usage)
+
+ # other clang 16.0 suppressions
+ add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
+ add_compile_options(-Wno-cast-function-type-strict)
+ add_compile_options(-Wno-incompatible-function-pointer-types-strict)
else()
add_compile_options(-Wno-uninitialized)
add_compile_options(-Wno-strict-aliasing)
diff --git a/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
index c24a90cf70409..95e92034e238f 100644
--- a/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
+++ b/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
@@ -100,10 +100,7 @@ elseif(CLR_CMAKE_HOST_UNIX)
mscordaccore
)
- # COREDBI_LIBRARIES is mentioned twice because ld is one pass linker and will not find symbols
- # if they are defined after they are used. Having all libs twice makes sure that ld will actually
- # find all symbols.
- target_link_libraries(mscordbi ${COREDBI_LIBRARIES} ${COREDBI_LIBRARIES})
+ target_link_libraries(mscordbi ${COREDBI_LIBRARIES})
add_dependencies(mscordbi mscordaccore)
diff --git a/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp b/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
index 891c01e144f5c..109fe6a5b5417 100644
--- a/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
+++ b/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
@@ -32,3 +32,18 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
// Defer to the main debugging code.
return DbgDllMain(hInstance, dwReason, lpReserved);
}
+
+#if defined(HOST_LINUX) && defined(TARGET_LINUX)
+PALIMPORT HINSTANCE PALAPI DAC_PAL_RegisterModule(IN LPCSTR lpLibFileName);
+PALIMPORT VOID PALAPI DAC_PAL_UnregisterModule(IN HINSTANCE hInstance);
+
+HINSTANCE PALAPI PAL_RegisterModule(IN LPCSTR lpLibFileName)
+{
+ return DAC_PAL_RegisterModule(lpLibFileName);
+}
+
+VOID PALAPI PAL_UnregisterModule(IN HINSTANCE hInstance)
+{
+ DAC_PAL_UnregisterModule(hInstance);
+}
+#endif
diff --git a/src/runtime/src/native/corehost/apphost/static/CMakeLists.txt b/src/runtime/src/native/corehost/apphost/static/CMakeLists.txt
index c37885bf5691c..a632d993c0f2a 100644
--- a/src/runtime/src/native/corehost/apphost/static/CMakeLists.txt
+++ b/src/runtime/src/native/corehost/apphost/static/CMakeLists.txt
@@ -65,8 +65,8 @@ if(CLR_CMAKE_TARGET_WIN32)
add_linker_flag("/DEF:${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost.def")
else()
- if(CLR_CMAKE_TARGET_OSX)
- set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_OSXexports.src)
+ if(CLR_CMAKE_TARGET_FREEBSD)
+ set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_freebsdexports.src)
else()
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_unixexports.src)
endif()
diff --git a/src/runtime/src/native/corehost/apphost/static/singlefilehost_OSXexports.src b/src/runtime/src/native/corehost/apphost/static/singlefilehost_freebsdexports.src
similarity index 81%
rename from src/native/corehost/apphost/static/singlefilehost_OSXexports.src
rename to src/native/corehost/apphost/static/singlefilehost_freebsdexports.src
index 18d5697e84580..1f9c517821855 100644
--- a/src/runtime/src/native/corehost/apphost/static/singlefilehost_OSXexports.src
+++ b/src/runtime/src/native/corehost/apphost/static/singlefilehost_freebsdexports.src
@@ -9,3 +9,7 @@ g_dacTable
; Used by profilers
MetaDataGetDispenser
+
+; FreeBSD needs to reexport these
+__progname
+environ
diff --git a/src/runtime/src/native/corehost/apphost/static/singlefilehost_unixexports.src b/src/runtime/src/native/corehost/apphost/static/singlefilehost_unixexports.src
index 1f9c517821855..18d5697e84580 100644
--- a/src/runtime/src/native/corehost/apphost/static/singlefilehost_unixexports.src
+++ b/src/runtime/src/native/corehost/apphost/static/singlefilehost_unixexports.src
@@ -9,7 +9,3 @@ g_dacTable
; Used by profilers
MetaDataGetDispenser
-
-; FreeBSD needs to reexport these
-__progname
-environ
From b5b3114e6866ac0058b5e18da52f92a1738a915b Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Thu, 6 Apr 2023 16:35:18 -0400
Subject: [PATCH 2/2] Fix DBI loading problem on Linux (#82461)
---
src/coreclr/dlls/mscordbi/CMakeLists.txt | 16 +++++++++++++++-
src/coreclr/dlls/mscordbi/mscordbi.cpp | 15 ---------------
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
index 95e92034e238f..c577651141e5c 100644
--- a/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
+++ b/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
@@ -100,7 +100,21 @@ elseif(CLR_CMAKE_HOST_UNIX)
mscordaccore
)
- target_link_libraries(mscordbi ${COREDBI_LIBRARIES})
+ # Before llvm 16, lld was setting `--undefined-version` by default. The default was
+ # flipped to `--no-undefined-version` in lld 16, so we will explicitly set it to
+ # `--undefined-version` for our use-case.
+ include(CheckLinkerFlag OPTIONAL)
+ if(COMMAND check_linker_flag)
+ check_linker_flag(CXX -Wl,--undefined-version LINKER_SUPPORTS_UNDEFINED_VERSION)
+ if (LINKER_SUPPORTS_UNDEFINED_VERSION)
+ add_linker_flag(-Wl,--undefined-version)
+ endif(LINKER_SUPPORTS_UNDEFINED_VERSION)
+ endif(COMMAND check_linker_flag)
+
+ # COREDBI_LIBRARIES is mentioned twice because ld is one pass linker and will not find symbols
+ # if they are defined after they are used. Having all libs twice makes sure that ld will actually
+ # find all symbols.
+ target_link_libraries(mscordbi ${COREDBI_LIBRARIES} ${COREDBI_LIBRARIES})
add_dependencies(mscordbi mscordaccore)
diff --git a/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp b/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
index 109fe6a5b5417..891c01e144f5c 100644
--- a/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
+++ b/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
@@ -32,18 +32,3 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
// Defer to the main debugging code.
return DbgDllMain(hInstance, dwReason, lpReserved);
}
-
-#if defined(HOST_LINUX) && defined(TARGET_LINUX)
-PALIMPORT HINSTANCE PALAPI DAC_PAL_RegisterModule(IN LPCSTR lpLibFileName);
-PALIMPORT VOID PALAPI DAC_PAL_UnregisterModule(IN HINSTANCE hInstance);
-
-HINSTANCE PALAPI PAL_RegisterModule(IN LPCSTR lpLibFileName)
-{
- return DAC_PAL_RegisterModule(lpLibFileName);
-}
-
-VOID PALAPI PAL_UnregisterModule(IN HINSTANCE hInstance)
-{
- DAC_PAL_UnregisterModule(hInstance);
-}
-#endif

View file

@ -1581,7 +1581,7 @@ index 59d139c7749..a8e94e72847 100644
<NoWarn>$(NoWarn);SYSLIB0021</NoWarn>
<!--Remove once this is fixed, https://github.com/dotnet/runtime/issues/71506 -->
diff --git a/src/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj b/src/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj
index d94830c..5840638 100644
index be33237e616..426ddb38e27 100644
--- a/src/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj
+++ b/src/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj
@@ -1,6 +1,6 @@
@ -1589,9 +1589,9 @@ index d94830c..5840638 100644
<PropertyGroup>
- <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.1;netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
+ <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
<DefineConstants>$(DefineConstants);BUILDING_PKCS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IncludeDllSafeSearchPathAttribute>true</IncludeDllSafeSearchPathAttribute>
<NoWarn>$(NoWarn);CA5384</NoWarn>
diff --git a/src/runtime/src/libraries/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj b/src/runtime/src/libraries/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj
index 8523c0d8296..2045f05a28e 100644
--- a/src/runtime/src/libraries/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj
@ -1805,4 +1805,3 @@ index e7b45293318..089fe0ef33f 100644
--
2.36.3