Add star into link attributes (#81407)
authorTlakaelel Axayakatl Ceja <tlakaelel.ceja@microsoft.com>
Fri, 10 Feb 2023 19:12:25 +0000 (11:12 -0800)
committerGitHub <noreply@github.com>
Fri, 10 Feb 2023 19:12:25 +0000 (11:12 -0800)
commit98514de67e76f25b8b7b7965b27a29c2efecb620
tree185ce034d8c33944ca667c850ce36060524b48db
parentf6b9578936c9602a36dafca3bf2a37351106b8c2
Add star into link attributes (#81407)

One of the functionalities of the LinkAttributes files is to occurrences of custom attributes on the current assembly, on top of this functionality there is a special functionality that is only permitted if it's embedded in an XML inside the System.Private.CorLib module that allows the deletion of custom attributes from all the assemblies.
Given that NativeAOT is multithreaded it cannot process all the assemblies to remove attributes as ILLink does, it also does not have a shared storage in which it can store the information about the removed attributes from System.Private.CoreLib.
This PR adds logic to process the special functionality in the embedded System.Private.CoreLib XML every time an assembly is being processed.
In order to make this more performant, an extra argument is passed to the XML reader to only look at the assembly="*" to get the set of attributes that need to be deleted from all assemblies.

* Handle the star argument in LinkAttributes files for NativeAOT
* Minor fixes to print more warnings
* Add a way to only process star/nonstar assemblies in ProcessLinkerXmlBase
* Add smoke test
src/coreclr/tools/Common/Compiler/ProcessLinkerXmlBase.cs
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs
src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerDriver.cs
src/tests/nativeaot/SmokeTests/TrimmingBehaviors/ILLink.LinkAttributes.xml [new file with mode: 0644]
src/tests/nativeaot/SmokeTests/TrimmingBehaviors/ILLinkLinkAttributes.cs [new file with mode: 0644]
src/tests/nativeaot/SmokeTests/TrimmingBehaviors/TrimmingBehaviors.csproj