From a35e9efabe01cfb4c46c2b8307493e21d1cf0415 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 28 Dec 2020 16:43:54 +0100 Subject: [PATCH] [illink] Do not preserve GeneratedEnumAttribute Context: https://github.com/xamarin/xamarin-android/issues/5167 The attribute itself doesn't need to be preserved. I didn't find any usage of the attribute instances during runtime, so this change removes them during linking. apk size comparison, BuildReleaseArm64False test: > apkdiff -f -e dll$ before.apk after.apk Size difference in bytes ([*1] apk1 only, [*2] apk2 only): - 39 assemblies/Mono.Android.dll + 132 Resource Android.ILLink.ILLink.LinkAttributes.xml - Type Android.Runtime.GeneratedEnumAttribute Summary: - 39 Assemblies -0.01% (of 749,078) Note that the attribute instances removal doesn't work yet, we need net6 illink for that. --- .../PreserveLists/Mono.Android.xml | 1 - src/Mono.Android/ILLink/ILLink.LinkAttributes.xml | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Android.Sdk.ILLink/PreserveLists/Mono.Android.xml b/src/Microsoft.Android.Sdk.ILLink/PreserveLists/Mono.Android.xml index 3958d28e331..8f593a2044f 100644 --- a/src/Microsoft.Android.Sdk.ILLink/PreserveLists/Mono.Android.xml +++ b/src/Microsoft.Android.Sdk.ILLink/PreserveLists/Mono.Android.xml @@ -3,7 +3,6 @@ - diff --git a/src/Mono.Android/ILLink/ILLink.LinkAttributes.xml b/src/Mono.Android/ILLink/ILLink.LinkAttributes.xml index 0f8c426864d..ebafd5160a3 100644 --- a/src/Mono.Android/ILLink/ILLink.LinkAttributes.xml +++ b/src/Mono.Android/ILLink/ILLink.LinkAttributes.xml @@ -6,5 +6,8 @@ + + +