From e28b7f3f306bb410a8a1a2f4b80f413fdea4ce86 Mon Sep 17 00:00:00 2001 From: Vitek Karas <10670590+vitek-karas@users.noreply.github.com> Date: Thu, 6 Jan 2022 20:37:08 +0100 Subject: [PATCH] Add a custom flag to disable marking of copy assemblies (#2370) (#2437) 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 6c4ddd1728ae..1d1b955551d4 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; }