From 23e5d5410ed3e8bc9ab61b3685e1d3a06bdba701 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Tue, 2 Jan 2024 23:49:01 -0800 Subject: [PATCH] Clean up illink suppressions (#96361) * Clean up illink suppressions * Suppress IL2008 * Support multiple suppression xmls CoreLib has a shared ILLink.Substitutions.LibraryBuild.xml, and one that is specific to coreclr. Use an ItemGroup to support the use of both. * Suppress IL2035 * Replace unnecessary " * PR feedback - Keep properties in existing order - Separate PropertyGroup/ItemGroup with blank lines - Place all NoWarns on one line * Update eng/illink.targets Co-authored-by: Viktor Hofer --------- Co-authored-by: Viktor Hofer --- eng/illink.targets | 41 ++++++++----------- eng/testing/tests.browser.targets | 2 +- eng/testing/tests.wasm.targets | 4 +- .../Microsoft.NET.Sdk.IL.targets.template | 2 +- .../System.Private.CoreLib.Shared.projitems | 1 + src/libraries/oob.proj | 2 +- src/libraries/sfx.proj | 2 +- src/mono/browser/browser.proj | 4 +- src/mono/browser/build/BrowserWasmApp.targets | 10 ++--- 9 files changed, 30 insertions(+), 38 deletions(-) diff --git a/eng/illink.targets b/eng/illink.targets index f56f799fcfcc66..0dca1cd421991a 100644 --- a/eng/illink.targets +++ b/eng/illink.targets @@ -27,12 +27,11 @@ $(IntermediateOutputPath)ILLink.Substitutions.xml $(IntermediateOutputPath)ILLink.LinkAttributes.xml - $(ILLinkDirectory)ILLink.Suppressions - $(ILLinkSuppressionsXmlFilePrefix).xml - $(ILLinkSuppressionsXmlFilePrefix).$(Configuration).xml - $(ILLinkSuppressionsXmlFilePrefix).LibraryBuild.xml + $(ILLinkDirectory)ILLink.Suppressions + $(ILLinkSuppressionsXmlPrefix).xml + $(ILLinkSuppressionsXmlPrefix).$(Configuration).xml - false + false true @@ -41,13 +40,15 @@ true - - - - + + + + + + @@ -210,25 +211,15 @@ $(ILLinkArgs) -x "$(ILLinkDescriptorsLibraryBuildXml)" $(ILLinkArgs) --substitutions "$(ILLinkSubstitutionsLibraryBuildXml)" + $(ILLinkArgs) --link-attributes "@(ILLinkSuppressionsLibraryBuildXml->'%(FullPath)', '" --link-attributes "')" - IL2008;IL2009;IL2012;IL2025;IL2026;IL2035;IL2050 - - $(LinkerNoWarn);IL2032;IL2055;IL2057;IL2058;IL2059;IL2060;IL2061 - - $(LinkerNoWarn);IL2062;IL2063;IL2064;IL2065;IL2066 - - $(LinkerNoWarn);IL2067;IL2068;IL2069;IL2070;IL2071;IL2072;IL2073;IL2074;IL2075;IL2076;IL2077;IL2078;IL2079;IL2080;IL2081;IL2082;IL2083;IL2084;IL2085;IL2086;IL2087;IL2088;IL2089;IL2090;IL2091 - - $(LinkerNoWarn);IL2121 + $(LinkerNoWarn);IL2008;IL2009;IL2121;IL2025;IL2035 $(ILLinkArgs) --nowarn $(LinkerNoWarn) $(ILLinkArgs) --disable-opt ipconstprop diff --git a/eng/testing/tests.browser.targets b/eng/testing/tests.browser.targets index c1eaa6c0817db2..ea561e42ccaff4 100644 --- a/eng/testing/tests.browser.targets +++ b/eng/testing/tests.browser.targets @@ -60,7 +60,7 @@ So, set those parameters explicitly here. --> - <_ExtraTrimmerArgs Condition="'$(WasmEnableLegacyJsInterop)' == 'false'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.LegacyJsInterop.xml" + <_ExtraTrimmerArgs Condition="'$(WasmEnableLegacyJsInterop)' == 'false'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.LegacyJsInterop.xml" diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets index 2d7ff9622aa6d7..e76f1acb374cde 100644 --- a/eng/testing/tests.wasm.targets +++ b/eng/testing/tests.wasm.targets @@ -64,8 +64,8 @@ So, set those parameters explicitly here. --> - <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'true' and '$(RunAOTCompilation)' == 'true'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.WasmIntrinsics.xml" - <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'true'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.NoWasmIntrinsics.xml" + <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'true' and '$(RunAOTCompilation)' == 'true'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.WasmIntrinsics.xml" + <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'true'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.NoWasmIntrinsics.xml" diff --git a/src/coreclr/.nuget/Microsoft.NET.Sdk.IL/Microsoft.NET.Sdk.IL.targets.template b/src/coreclr/.nuget/Microsoft.NET.Sdk.IL/Microsoft.NET.Sdk.IL.targets.template index ebb865af5582e0..7cd5c90e143741 100644 --- a/src/coreclr/.nuget/Microsoft.NET.Sdk.IL/Microsoft.NET.Sdk.IL.targets.template +++ b/src/coreclr/.nuget/Microsoft.NET.Sdk.IL/Microsoft.NET.Sdk.IL.targets.template @@ -77,7 +77,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_ilResourceReference>%(ILResourceReference.FullPath) - <_IldasmCommand>"$(_IldasmDir)ildasm" + <_IldasmCommand>"$(_IldasmDir)ildasm" <_IldasmCommand>$(_IldasmCommand) "$(_ilResourceReference)" <_IldasmCommand>$(_IldasmCommand) /OUT="$(IntermediateOutputPath)/$(MSBuildProjectName).ref.il" diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 7a2cbf5b43460b..1c1d6d3530110a 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -67,6 +67,7 @@ + $(ILLinkSharedDirectory)ILLink.Descriptors.LibraryBuild.xml diff --git a/src/libraries/oob.proj b/src/libraries/oob.proj index b879127a13a816..34823cd1ba4fe3 100644 --- a/src/libraries/oob.proj +++ b/src/libraries/oob.proj @@ -55,7 +55,7 @@ $(ILLinkArgs) $(ILLinkArgs) --nowarn IL2121 - $(OOBILLinkArgs) --link-attributes "@(OOBLibrarySuppressionsXml->'%(FullPath)', '" --link-attributes "')" + $(OOBILLinkArgs) --link-attributes "@(OOBLibrarySuppressionsXml->'%(FullPath)', '" --link-attributes "')" diff --git a/src/libraries/sfx.proj b/src/libraries/sfx.proj index 278b269eb219b4..9b174d57c90f0a 100644 --- a/src/libraries/sfx.proj +++ b/src/libraries/sfx.proj @@ -98,7 +98,7 @@ $(ILLinkArgs) $(SharedFrameworkILLinkArgs) -b true - $(SharedFrameworkILLinkArgs) --link-attributes "@(SharedFrameworkSuppressionsXml, '" --link-attributes "')" + $(SharedFrameworkILLinkArgs) --link-attributes "@(SharedFrameworkSuppressionsXml, '" --link-attributes "')" diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index 1de2f40fdbace1..7e7453a4326494 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -263,8 +263,8 @@ - <_EmccExportedLibraryFunction>"[@(EmccExportedLibraryFunction -> '%27%(Identity)%27', ',')]" - <_EmccExportedRuntimeMethods>"[@(EmccExportedRuntimeMethod -> '%27%(Identity)%27', ',')]" + <_EmccExportedLibraryFunction>"[@(EmccExportedLibraryFunction -> '%27%(Identity)%27', ',')]" + <_EmccExportedRuntimeMethods>"[@(EmccExportedRuntimeMethod -> '%27%(Identity)%27', ',')]" <_EmccExportedFunctions>@(EmccExportedFunction -> '%(Identity)',',') 16777216 5MB diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index bded4ae2b44993..7ca72154951a9c 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -46,9 +46,9 @@ <_WasmGenerateAppBundleDependsOn>_GetWasmGenerateAppBundleDependencies;$(_WasmGenerateAppBundleDependsOn) - <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'true' and '$(RunAOTCompilation)' == 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.WasmIntrinsics.xml" - <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.NoWasmIntrinsics.xml" - <_ExtraTrimmerArgs Condition="'$(WasmEnableLegacyJsInterop)' == 'false'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.LegacyJsInterop.xml" + <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'true' and '$(RunAOTCompilation)' == 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.WasmIntrinsics.xml" + <_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.NoWasmIntrinsics.xml" + <_ExtraTrimmerArgs Condition="'$(WasmEnableLegacyJsInterop)' == 'false'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.LegacyJsInterop.xml" true emcc @@ -427,8 +427,8 @@ <_WasmSIMDLib Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-nosimd.a <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' != 'true'">libmono-wasm-simd.a <_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-nosimd.a - <_EmccExportedLibraryFunction>"[@(EmccExportedLibraryFunction -> '%27%(Identity)%27', ',')]" - <_EmccExportedRuntimeMethods>"[@(EmccExportedRuntimeMethod -> '%27%(Identity)%27', ',')]" + <_EmccExportedLibraryFunction>"[@(EmccExportedLibraryFunction -> '%27%(Identity)%27', ',')]" + <_EmccExportedRuntimeMethods>"[@(EmccExportedRuntimeMethod -> '%27%(Identity)%27', ',')]" <_EmccExportedFunctions>@(EmccExportedFunction -> '%(Identity)',',')