From 69062fde5d234974f16d785174473a1d02e77b49 Mon Sep 17 00:00:00 2001 From: Dong-Heon Jung Date: Tue, 16 Apr 2024 05:33:22 +0900 Subject: [PATCH] Update Architecture to unknown machine (#101038) * Update Architecture to unknown machine * Update src/tools/illink/src/linker/Linker.Steps/OutputStep.cs Suggested by @am11. Thank you. Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com> --------- Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com> Co-authored-by: Jan Kotas --- .../src/linker/Linker.Steps/OutputStep.cs | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/src/tools/illink/src/linker/Linker.Steps/OutputStep.cs b/src/tools/illink/src/linker/Linker.Steps/OutputStep.cs index 5cf6f0e3f1e918..2fa3c03f2b396b 100644 --- a/src/tools/illink/src/linker/Linker.Steps/OutputStep.cs +++ b/src/tools/illink/src/linker/Linker.Steps/OutputStep.cs @@ -42,17 +42,6 @@ namespace Mono.Linker.Steps public class OutputStep : BaseStep { - private Dictionary? architectureMap; - - private enum NativeOSOverride - { - Apple = 0x4644, - FreeBSD = 0xadc4, - Linux = 0x7b79, - NetBSD = 0x1993, - Default = 0 - } - readonly List assembliesWritten; public OutputStep () @@ -60,25 +49,6 @@ public OutputStep () assembliesWritten = new List (); } - TargetArchitecture CalculateArchitecture (TargetArchitecture readyToRunArch) - { - if (architectureMap == null) { - architectureMap = new Dictionary (); - foreach (var os in Enum.GetValues (typeof (NativeOSOverride))) { - ushort osVal = (ushort) (NativeOSOverride) os; - foreach (var arch in Enum.GetValues (typeof (TargetArchitecture))) { - ushort archVal = (ushort) (TargetArchitecture) arch; - architectureMap.Add ((ushort) (archVal ^ osVal), (TargetArchitecture) arch); - } - } - } - - if (architectureMap.TryGetValue ((ushort) readyToRunArch, out TargetArchitecture pureILArch)) { - return pureILArch; - } - throw new BadImageFormatException ("unrecognized module attributes"); - } - protected override bool ConditionToProcess () { return Context.ErrorsCount == 0; @@ -125,7 +95,7 @@ protected virtual void WriteAssembly (AssemblyDefinition assembly, string direct if (module.IsCrossgened ()) { module.Attributes |= ModuleAttributes.ILOnly; module.Attributes ^= ModuleAttributes.ILLibrary; - module.Architecture = CalculateArchitecture (module.Architecture); + module.Architecture = TargetArchitecture.I386; // I386+ILOnly which ultimately translates to AnyCPU } }