From c959dfa87cbeea3dfc1044361873fbe963eaf0e3 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 (dotnet/linker#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. Commit migrated from https://github.com/dotnet/linker/commit/c90ed0aee46fb24873d95ebaea80a2d11b29a957 --- src/tools/illink/src/linker/Linker.Steps/MarkStep.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs index 524c9195e3001e..4921299ef311bc 100644 --- a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs +++ b/src/tools/illink/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; }