Skip to content

Commit

Permalink
Add granular suppressions for linker warnings (#40691)
Browse files Browse the repository at this point in the history
* Add granular suppressions for linker warnings

* Add suppressions for mono SPC

* Misc additions

* Add suppressions for Debug config

* Fix Android xml file

* Include System.ComponentModel.Annotations suppressions

* Add suppressions for System.Security.Cryptography.X509Certificates on Linux

* Fix TargetOs exists check

* Add IL2077 to System.Security.Cryptography.X509Certificates on Android

* Generalize some System.Security.Cryptography.X509Certificates suppressions to 'NonWindows'

* Remove ref to catch-all System.Security.Cryptography.X509Certificates file

* Misc clean up and some feedback

* Use ILLinkDirectory in CreateRuntimeRootILLinkDescriptorFile.targets

* Update paths for directories

* Set TargetPath as part of include

* Delete bin-placing TODO

* Include more xml files during per-library run

* Include more xml files during per-library run, pt 2

* Include more xml files during per-library run, pt 3

* Try including System.ComponentModel.Annotations based on BuildingNETCoreAppVertical

* Switch to BuildAllConfigurations

* Include xml extension in file paths

* Remove version number from assembly suppression files

* Delete ILLink.Suppressions.xml

* Try removing IL2035 nowarn

* Remove version from Microsoft.VisualBasic.Core assemly name
  • Loading branch information
layomia authored Sep 30, 2020
1 parent f98038a commit 994dca6
Show file tree
Hide file tree
Showing 47 changed files with 3,686 additions and 21 deletions.
45 changes: 40 additions & 5 deletions eng/illink.targets
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<!-- Inputs and outputs of ILLinkTrimAssembly -->
<PropertyGroup>
<ILLinkDirectory Condition="'$(ILLinkDirectory)' == ''">$(MSBuildProjectDirectory)\ILLink\</ILLinkDirectory>
<ILLinkTasksDir>$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NET_ILLink_Tasks)', 'tools'))</ILLinkTasksDir>
<ILLinkTasksPath Condition="'$(ILLinkTasksPath)' == '' and '$(MSBuildRuntimeType)' == 'core'">$(ILLinkTasksDir)net5.0/ILLink.Tasks.dll</ILLinkTasksPath>
<ILLinkTasksPath Condition="'$(ILLinkTasksPath)' == '' and '$(MSBuildRuntimeType)' != 'core'">$(ILLinkTasksDir)net472/ILLink.Tasks.dll</ILLinkTasksPath>
Expand All @@ -35,14 +36,20 @@
<ILLinkTrimInputSymbols>$(ILLinkTrimInputPath)$(TargetName).pdb</ILLinkTrimInputSymbols>
<ILLinkTrimOutputPath>$(IntermediateOutputPath)</ILLinkTrimOutputPath>

<ILLinkTrimXml Condition="'$(ILLinkTrimXml)' == '' and Exists('$(MSBuildProjectDirectory)/ILLinkTrim.xml')">$(MSBuildProjectDirectory)/ILLinkTrim.xml</ILLinkTrimXml>
<ILLinkTrimXml Condition="'$(ILLinkTrimXml)' == '' and Exists('$(ILLinkDirectory)ILLinkTrim.xml')">$(ILLinkDirectory)ILLinkTrim.xml</ILLinkTrimXml>
<!-- ILLinkTrim_LibraryBuild.xml files are only used during building the library, not an app. They shouldn't be embedded into the assembly. -->
<ILLinkTrimXmlLibraryBuild Condition="'$(ILLinkTrimXmlLibraryBuild)' == '' and Exists('$(MSBuildProjectDirectory)/ILLinkTrim_LibraryBuild.xml')">$(MSBuildProjectDirectory)/ILLinkTrim_LibraryBuild.xml</ILLinkTrimXmlLibraryBuild>
<ILLinkTrimXmlLibraryBuild Condition="'$(ILLinkTrimXmlLibraryBuild)' == '' and Exists('$(ILLinkDirectory)ILLinkTrim_LibraryBuild.xml')">$(ILLinkDirectory)ILLinkTrim_LibraryBuild.xml</ILLinkTrimXmlLibraryBuild>
<ILLinkDescriptorsXmlIntermediatePath>$(IntermediateOutputPath)ILLink.Descriptors.xml</ILLinkDescriptorsXmlIntermediatePath>

<ILLinkSubstitutionsXmlIntermediatePath>$(IntermediateOutputPath)ILLink.Substitutions.xml</ILLinkSubstitutionsXmlIntermediatePath>
<ILLinkLinkAttributesXmlIntermediatePath>$(IntermediateOutputPath)ILLink.LinkAttributes.xml</ILLinkLinkAttributesXmlIntermediatePath>

<ILLinkSuppressionsXmlFilePrefix>$(ILLinkDirectory)ILLink.Suppressions</ILLinkSuppressionsXmlFilePrefix>
<ILLinkSuppressionsXmlFile>$(ILLinkSuppressionsXmlFilePrefix).xml</ILLinkSuppressionsXmlFile>
<ILLinkSuppressionsConfigurationSpecificXmlFile>$(ILLinkSuppressionsXmlFilePrefix).$(Configuration).xml</ILLinkSuppressionsConfigurationSpecificXmlFile>
<ILLinkSuppressionsTargetOSSpecificXmlFile>$(ILLinkSuppressionsXmlFilePrefix).$(TargetOS).xml</ILLinkSuppressionsTargetOSSpecificXmlFile>
<ILLinkSuppressionsNonWindowsXmlFile>$(ILLinkSuppressionsXmlFilePrefix).NonWindows.xml</ILLinkSuppressionsNonWindowsXmlFile>

<!-- if building a PDB, tell illink to rewrite the symbols file -->
<ILLinkRewritePDBs Condition="'$(ILLinkRewritePDBs)' == '' and '$(DebugSymbols)' != 'false'">true</ILLinkRewritePDBs>
</PropertyGroup>
Expand All @@ -52,24 +59,52 @@
<None Include="@(ILLinkSubstitutionsXmls)" />
</ItemGroup>

<PropertyGroup>
<ILLinkTrimAssemblyArtifactsRootDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ILLinkTrimAssembly', '$(BuildSettings)'))</ILLinkTrimAssemblyArtifactsRootDir>
<ILLinkTrimAssemblySuppressionsXmlsDir>$(ILLinkTrimAssemblyArtifactsRootDir)suppressions-xmls\</ILLinkTrimAssemblySuppressionsXmlsDir>
</PropertyGroup>

<!-- Custom binplacing for pre/post-trimming and reports that is useful for analysis
Must be enabled by setting BinPlaceILLinkTrimAssembly=true
-->
<ItemGroup Condition="'$(BinPlaceILLinkTrimAssembly)' == 'true'">
<BinPlaceTargetFramework Include="$(BuildSettings)">
<RuntimePath>$(ArtifactsBinDir)ILLinkTrimAssembly/$(BuildSettings)/trimmed</RuntimePath>
<RuntimePath>$(ILLinkTrimAssemblyArtifactsRootDir)trimmed</RuntimePath>
<ItemName>TrimmedItem</ItemName>
</BinPlaceTargetFramework>
<BinPlaceTargetFramework Include="$(BuildSettings)">
<RuntimePath>$(ArtifactsBinDir)ILLinkTrimAssembly/$(BuildSettings)/reports</RuntimePath>
<RuntimePath>$(ILLinkTrimAssemblyArtifactsRootDir)reports</RuntimePath>
<ItemName>TrimmingReport</ItemName>
</BinPlaceTargetFramework>
<BinPlaceTargetFramework Include="$(BuildSettings)">
<RuntimePath>$(ArtifactsBinDir)ILLinkTrimAssembly/$(BuildSettings)/pretrimmed</RuntimePath>
<RuntimePath>$(ILLinkTrimAssemblyArtifactsRootDir)pretrimmed</RuntimePath>
<ItemName>PreTrimmedItem</ItemName>
</BinPlaceTargetFramework>
</ItemGroup>

<ItemGroup>
<ILLinkSuppressionsXmls Condition="Exists('$(ILLinkSuppressionsXmlFile)')"
Include="$(ILLinkSuppressionsXmlFile)" />
<ILLinkSuppressionsXmls Condition="Exists('$(ILLinkSuppressionsConfigurationSpecificXmlFile)')"
Include="$(ILLinkSuppressionsConfigurationSpecificXmlFile)" />
<ILLinkSuppressionsXmls Condition="Exists('$(ILLinkSuppressionsTargetOSSpecificXmlFile)')"
Include="$(ILLinkSuppressionsTargetOSSpecificXmlFile)" />
<ILLinkSuppressionsXmls Condition="'$(TargetOS)' != 'Windows_NT' and Exists('$(ILLinkSuppressionsNonWindowsXmlFile)')"
Include="$(ILLinkSuppressionsNonWindowsXmlFile)" />
<ILLinkSuppressionsXmls Update="@(ILLinkSuppressionsXmls)" TargetPath="%(FileName).$(AssemblyName).xml" />
</ItemGroup>

<ItemGroup>
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)">
<RuntimePath>$(ILLinkTrimAssemblySuppressionsXmlsDir)</RuntimePath>
<ItemName>ILLinkSuppressionsXmls</ItemName>
</BinPlaceTargetFrameworks>
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS)">
<RuntimePath>$(ILLinkTrimAssemblySuppressionsXmlsDir)</RuntimePath>
<ItemName>ILLinkSuppressionsXmls</ItemName>
</BinPlaceTargetFrameworks>
</ItemGroup>

<Target Name="_EmbedILLinkXmls"
DependsOnTargets="_CombineILLinkDescriptorsXmls;_CombineILLinkSubstitutionsXmls;_CombineILLinkLinkAttributesXmls">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</PropertyGroup>

<ItemGroup>
<_ILLinkDescriptorsFilePaths Include="$(MSBuildThisFileDirectory)ILLinkTrim.xml" />
<_ILLinkDescriptorsFilePaths Include="$(ILLinkDirectory)ILLinkTrim.xml" />
<_ILLinkDescriptorsFilePaths Include="$(CoreLibSharedDir)ILLink\ILLink.Descriptors.Shared.xml" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<ILLinkTrimAssembly>true</ILLinkTrimAssembly>
<ILLinkTrimXml>$(IntermediateOutputPath)System.Private.CoreLib.xml</ILLinkTrimXml>
<ILLinkDirectory>$(MSBuildThisFileDirectory)src\ILLink\</ILLinkDirectory>
</PropertyGroup>

<!-- Note that various places in SPCL depend on this resource name i.e. TplEventSource -->
Expand Down
143 changes: 143 additions & 0 deletions src/libraries/Microsoft.CSharp/src/ILLink/ILLink.Suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<linker>
<assembly fullname="Microsoft.CSharp, PublicKeyToken=b03f5f7f11d50a3a">
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.DynamicMetaObjectProviderDebugView.#cctor</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2055</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.ComInterop.VariantArray.GetStructType(System.Int32)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2055</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.Semantics.AggregateType.CalculateAssociatedSystemType</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2060</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.Semantics.ExprMethodInfo.get_MethodInfo</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2070</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.RuntimeBinderExtensions.GetTypeIndexerName(System.Type)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2070</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.SymbolTable.AddAggregateToSymbolTable(Microsoft.CSharp.RuntimeBinder.Semantics.NamespaceOrAggregateSymbol,System.Type)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2070</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.SymbolTable.AddConversionsForOneType(System.Type)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2072</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.ComInterop.ComTypeClassDesc.CreateInstance</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2072</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.Semantics.ExprFactory.CreateZeroInit(Microsoft.CSharp.RuntimeBinder.Semantics.CType)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2072</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.Semantics.ExprZeroInit.get_Object</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.ComInterop.ComBinderHelpers.ProcessArgumentsForCom(System.Dynamic.DynamicMetaObject[]@)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.ComInterop.ExcepInfo.GetException</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.ComInterop.IDispatchComObject.GetMembers(System.Collections.Generic.IEnumerable{System.String})</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.ComInterop.TypeUtils.GetUserDefinedCoercionMethod(System.Type,System.Type,System.Boolean)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.DynamicMetaObjectProviderDebugView.CreateDelegateAndInvoke(System.Type[],System.Runtime.CompilerServices.CallSiteBinder,System.Object[])</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GenerateField(Microsoft.CSharp.RuntimeBinder.Semantics.ExprCall)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.Semantics.ExprMethodInfo.get_ConstructorInfo</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.Semantics.ExprMethodInfo.get_MethodInfo</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.Semantics.ExprPropertyInfo.get_PropertyInfo</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.SymbolTable.AddPredefinedMethodToSymbolTable(Microsoft.CSharp.RuntimeBinder.Semantics.AggregateSymbol,Microsoft.CSharp.RuntimeBinder.Syntax.Name)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.SymbolTable.AddPredefinedPropertyToSymbolTable(Microsoft.CSharp.RuntimeBinder.Semantics.AggregateSymbol,Microsoft.CSharp.RuntimeBinder.Syntax.Name)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2075</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.SymbolTable.BuildDeclarationChain(System.Type)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2080</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.CSharp.RuntimeBinder.SymbolTable.AddNamesInInheritanceHierarchy(System.String,System.Collections.Generic.List{System.Type})</property>
</attribute>
</assembly>
</linker>
Loading

0 comments on commit 994dca6

Please sign in to comment.