From c90ed0aee46fb24873d95ebaea80a2d11b29a957 Mon Sep 17 00:00:00 2001 From: Vitek Karas Date: Mon, 15 Nov 2021 20:14:29 +0100 Subject: [PATCH] Add a custom flag to disable marking of copy assemblies (#2370) Enabled by `--custom-data DisableMarkingOfCopyAssemblies=true` on the command line. Assumes that ALL assemblies on the input are in "copy" action (it doesn't validate this fact). It disables marking basically fully - linker will go over all assemblies, and process them in "copy" mode (copy the original file over) and will call all the custom steps and so on, but it will do no marking (or very little, depends on descriptors and such which this doesn't disable). This is intentionally non-discoverable feature, to be used only by the mono AOT toolchain. --- src/linker/Linker.Steps/MarkStep.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/linker/Linker.Steps/MarkStep.cs b/src/linker/Linker.Steps/MarkStep.cs index 524c9195e300..4921299ef311 100644 --- a/src/linker/Linker.Steps/MarkStep.cs +++ b/src/linker/Linker.Steps/MarkStep.cs @@ -1387,7 +1387,9 @@ protected void MarkAssembly (AssemblyDefinition assembly, DependencyInfo reason) MarkExportedTypesTarget.ProcessAssembly (assembly, Context); if (ProcessReferencesStep.IsFullyPreservedAction (Context.Annotations.GetAction (assembly))) { - MarkEntireAssembly (assembly); + if (!Context.TryGetCustomData ("DisableMarkingOfCopyAssemblies", out string? disableMarkingOfCopyAssembliesValue) || + disableMarkingOfCopyAssembliesValue != "true") + MarkEntireAssembly (assembly); return; }