From 0cfc81d8d09adf758096349a923bed01a253be4d Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Tue, 16 May 2023 13:36:48 -0700 Subject: [PATCH] Clean up dead code in illink targets (#85741) Removes TFM version checks, and adds a warning when using explicit ILLink package reference. We reference ILLink as a packagereference that versions with the runtime, so the 8.0 linker is only supported when targeting `net8.0`, and we can remove the TFM checks. We don't want to support someone adding a PackageReference to an 8.0 linker, while targeting an older TFM, in an attempt to get newer linker bits but with settings that were closer to what we shipped with that TFM. --------- Co-authored-by: Marek Safar Co-authored-by: Vitek Karas <10670590+vitek-karas@users.noreply.github.com> --- ...Microsoft.DotNet.ILCompiler.SingleEntry.targets | 2 +- .../illink/src/ILLink.Tasks/ILLink.Tasks.csproj | 1 - .../src/ILLink.Tasks/build/6.0_suppressions.xml | 156 --------------------- .../build/Microsoft.NET.ILLink.targets | 59 ++------ 4 files changed, 10 insertions(+), 208 deletions(-) delete mode 100644 src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index 9b4a6b8..43cdfe8 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -43,7 +43,7 @@ + Text="Delete explicit 'Microsoft.DotNet.ILCompiler' package reference in your project file to avoid versioning problems." /> diff --git a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj index 585ac72..ff511c3 100644 --- a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj +++ b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj @@ -28,7 +28,6 @@ - diff --git a/src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml b/src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml deleted file mode 100644 index 7483041..0000000 --- a/src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - - ILLink - IL2070 - member - M:System.Reflection.CustomAttribute.AddCustomAttributes(System.RuntimeType.ListBuilder{System.Object}@,System.Reflection.RuntimeModule,System.Int32,System.RuntimeType,System.Boolean,System.RuntimeType.ListBuilder{System.Object}) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2063 - member - M:System.RuntimeType.GetInterface(System.String,System.Boolean) - Suppressed in 7.0 for dataflow improvements: https://github.com/dotnet/runtime/commit/2e353d18b81732133aadbee888a801fd9f935fbf - - - ILLink - IL2067 - member - M:System.RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter(System.RuntimeType,System.RuntimeType,System.RuntimeType) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2067 - member - M:System.RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter(System.RuntimeType,System.RuntimeType) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2068 - member - M:System.Reflection.Emit.TypeBuilder.CreateTypeNoLock - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2069 - member - M:System.Reflection.Emit.TypeBuilder.CreateTypeNoLock - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2119 - member - M:System.Diagnostics.Tracing.EventSource.WriteEventString(System.String) - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - - - - ILLink - IL2068 - member - M:System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptor.TypeDescriptorCache.GetAssociatedMetadataType(System.Type) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - - - - ILLink - IL2060 - member - M:System.Data.DataRowExtensions.UnboxT`1.Create() - Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05 - - - - - - ILLink - IL2070 - member - M:System.Reflection.CustomAttribute.AddCustomAttributes(System.RuntimeType.ListBuilder`1@,System.Reflection.RuntimeModule,System.Int32,System.RuntimeType,System.Bool,System.RuntimeType.ListBuilder{System.Object}) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - - - - ILLink - IL2119 - member - M:System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform.#ctor(System.String,System.Int32,System.Int32,System.Diagnostics.DiagnosticSourceEventSource,System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform) - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - - - - ILLink - IL2065 - member - M:System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(System.Type) - Suppressed in 7.0 for dataflow improvements: https://github.com/dotnet/runtime/commit/2e353d18b81732133aadbee888a801fd9f935fbf - - - - - - ILLink - IL2055 - member - M:System.Text.Json.Serialization.Converters.FSharpTypeConverterFactory.CreateConverter(System.Type,System.Text.Json.JsonSerializerOptions) - Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05 - - - ILLink - IL2070 - member - M:System.Text.Json.Serialization.Converters.EnumConverterFactory.GetEnumConverterType(System.Type) - Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05 - - - ILLink - IL2070 - member - M:System.Text.Json.Serialization.Converters.NullableConverterFactory.GetNullableConverterType(System.Type) - Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05 - - - - - - ILLink - IL2118 - member - M:System.Xml.Serialization.TypeScope.#cctor - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - ILLink - IL2118 - member - M:System.Xml.Serialization.TypeScope.AddSoapEncodedTypes(System.String) - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - - - - ILLink - IL2118 - member - M:System.Runtime.Serialization.DateTimeDataContract.#ctor - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - - \ No newline at end of file diff --git a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets index b46c700..4ae285b 100644 --- a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets +++ b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets @@ -31,8 +31,7 @@ Copyright (c) .NET Foundation. All rights reserved. switches can flow to the runtimeconfig.json. Features are disabled by default since they may require assemblies, types or members that could be removed by the ILLink, causing a trimmed app to crash. --> - + false false false @@ -49,8 +48,6 @@ Copyright (c) .NET Foundation. All rights reserved. - - true true @@ -80,7 +77,7 @@ Copyright (c) .NET Foundation. All rights reserved. @@ -195,6 +192,10 @@ Copyright (c) .NET Foundation. All rights reserved. is a NativeAOT app, value of SelfContained doesn't matter. --> + + 5 @@ -202,28 +203,16 @@ Copyright (c) .NET Foundation. All rights reserved. - - - - - <_ILLinkSuppressions Include="$(MSBuildThisFileDirectory)6.0_suppressions.xml" /> - + <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --link-attributes "@(_ILLinkSuppressions->'%(Identity)', '" --link-attributes "')" - + - copyused - partial full - - - <_TrimmerDefaultAction Condition="$([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '7.0'))">$(TrimmerDefaultAction) - <_TrimmerDefaultAction Condition="'$(_TrimmerDefaultAction)' == '' And $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '6.0'))">$(TrimMode) - <_TrimmerDefaultAction Condition="'$(_TrimmerDefaultAction)' == '' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0'))">copy @@ -232,22 +221,6 @@ Copyright (c) .NET Foundation. All rights reserved. true - - - - $(NoWarn);IL2008 - $(NoWarn);IL2009 - - $(NoWarn);IL2037 - - $(NoWarn);IL2009;IL2012 - - - - - <_ExtraTrimmerArgs>--enable-serialization-discovery $(_ExtraTrimmerArgs) - - @@ -255,12 +228,6 @@ Copyright (c) .NET Foundation. All rights reserved. false - - <_TrimmerUnreachableBodies>false - - @@ -284,14 +251,6 @@ Copyright (c) .NET Foundation. All rights reserved. - - - - - copy - - - -- 2.7.4