forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add always trimmed attributes list for browser config (dotnet#39000)
* Add always trimmed attributes list for browser config Example of size reduction on SPC with the most minimalistic Hello World sample. | System.Private.CoreLib | Size (kB) | Delta | |-|-|-| | Original | 1358 kB | - | | Trimmed | 1271 kB | - 87 kB | * Review feedback * Combine and embed the ILLink.LinkAttributes.xml file into the assembly. * Update linker command line to ignore attributes file. Add ExcludeFromCodeCoverageAttribute. * PR feedback. Add note about Obsolete. Only use assembly fullname="*" for compiler generated attributes. * Update ILLink.LinkAttributes.wasm.xml Co-authored-by: Eric Erhardt <[email protected]>
- Loading branch information
1 parent
371ae3c
commit c21a387
Showing
3 changed files
with
188 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.LinkAttributes.wasm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
<linker> | ||
<assembly fullname="System.Private.CoreLib"> | ||
<!-- System --> | ||
<type fullname="System.CLSCompliantAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.ObsoleteAttribute"> | ||
<!-- | ||
Note that removing this attribute can change runtime behavior. For example, | ||
System.Xml.Serialization will behave differently if a ctor is Obsolete. | ||
This is low enough risk on wasm to justify the removing the attribute for size | ||
savings. The app developer can override this setting to keep all ObsoleteAttributes. | ||
--> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
|
||
<!-- System.Diagnostics.CodeAnalysis --> | ||
<type fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.SuppressMessageAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.AllowNullAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.DisallowNullAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.MaybeNullAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.NotNullAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.NotNullWhenAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.MemberNotNullAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
|
||
<!-- System.Runtime.CompilerServices --> | ||
<type fullname="System.Runtime.CompilerServices.AsyncMethodBuilderAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.CallerArgumentExpressionAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.CallerMemberNameAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.CallerFilePathAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.CallerLineNumberAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.CallerMemberNameAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.CompilerGeneratedAttribute" feature="System.Diagnostics.Debugger.IsSupported" featurevalue="false"> | ||
<!-- | ||
The attribute is used during pretty stack trace printing | ||
--> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.CompilerGlobalScopeAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.IsReadOnlyAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.EnumeratorCancellationAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.ExtensionAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.IntrinsicAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.SkipLocalsInitAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.TupleElementNamesAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
|
||
<!-- System.Runtime.Versioning --> | ||
<type fullname="System.Runtime.Versioning.NonVersionableAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
|
||
<!-- Microsoft.ComponentModel --> | ||
<type fullname="System.ComponentModel.EditorBrowsableAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
</assembly> | ||
|
||
<!-- The following attributes are generated by the compiler, so they could be in any assembly --> | ||
<assembly fullname="*"> | ||
<!-- System.Runtime.CompilerServices --> | ||
<type fullname="System.Runtime.CompilerServices.IsUnmanagedAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.NativeIntegerAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.NullableAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.NullableContextAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
<type fullname="System.Runtime.CompilerServices.NullablePublicOnlyAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
|
||
<!-- Microsoft.CodeAnalysis --> | ||
<type fullname="Microsoft.CodeAnalysis.EmbeddedAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
</assembly> | ||
</linker> |