From b2f901d8e8bcc5afd8538b7811e2ea7562d5aae2 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Tue, 17 Sep 2019 22:14:36 +0200 Subject: [PATCH] [mtouch] force --interpreter on arm64_32 debug mode build --- tools/mtouch/Assembly.cs | 2 +- tools/mtouch/BuildTasks.mtouch.cs | 3 ++- tools/mtouch/mtouch.cs | 23 +++++++++++++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/tools/mtouch/Assembly.cs b/tools/mtouch/Assembly.cs index 390d66840d78..9b388ed62055 100644 --- a/tools/mtouch/Assembly.cs +++ b/tools/mtouch/Assembly.cs @@ -281,7 +281,7 @@ public void CreateAOTTask (Abi abi) aotInfo.AsmFiles.Add (asm_output); aotInfo.AotDataFiles.Add (data); - var aotCompiler = Driver.GetAotCompiler (App, Target.Is64Build); + var aotCompiler = Driver.GetAotCompiler (App, abi, Target.Is64Build); var aotArgs = Driver.GetAotArguments (App, assembly_path, abi, build_dir, asm_output ?? other_output, llvm_aot_ofile, data); var task = new AOTTask { diff --git a/tools/mtouch/BuildTasks.mtouch.cs b/tools/mtouch/BuildTasks.mtouch.cs index 7474220958b5..4dc18cd6adf0 100644 --- a/tools/mtouch/BuildTasks.mtouch.cs +++ b/tools/mtouch/BuildTasks.mtouch.cs @@ -204,7 +204,8 @@ public override IEnumerable FileDependencies { if (Assembly.HasDependencyMap) inputs.AddRange (Assembly.DependencyMap); inputs.Add (AssemblyName); - inputs.Add (Driver.GetAotCompiler (Assembly.App, Assembly.Target.Is64Build)); + foreach (var abi in Assembly.Target.Abis) + inputs.Add (Driver.GetAotCompiler (Assembly.App, abi, Assembly.Target.Is64Build)); var mdb = Assembly.FullPath + ".mdb"; if (File.Exists (mdb)) inputs.Add (mdb); diff --git a/tools/mtouch/mtouch.cs b/tools/mtouch/mtouch.cs index e090c5098dd8..1ef159b790fb 100644 --- a/tools/mtouch/mtouch.cs +++ b/tools/mtouch/mtouch.cs @@ -362,7 +362,7 @@ public static int XcodeRun (string command, string args, StringBuilder output = return ret; } - public static string GetAotCompiler (Application app, bool is64bits) + public static string GetAotCompiler (Application app, Abi abi, bool is64bits) { switch (app.Platform) { case ApplePlatform.iOS: @@ -372,7 +372,12 @@ public static string GetAotCompiler (Application app, bool is64bits) return Path.Combine (cross_prefix, "bin", "arm-darwin-mono-sgen"); } case ApplePlatform.WatchOS: - return Path.Combine (cross_prefix, "bin", "armv7k-unknown-darwin-mono-sgen"); + /* Use arm64_32 cross only for Debug mode */ + if (abi == Abi.ARM64_32 && !app.EnableLLVMOnlyBitCode) { + return Path.Combine (cross_prefix, "bin", "arm64_32-darwin-mono-sgen"); + } else { + return Path.Combine (cross_prefix, "bin", "armv7k-unknown-darwin-mono-sgen"); + } case ApplePlatform.TVOS: return Path.Combine (cross_prefix, "bin", "arm64-darwin-mono-sgen"); default: @@ -1331,14 +1336,24 @@ static int Main2 (string[] args) app.UseInterpreter = false; } - // FIXME: the interpreter only supports ARM64 right now + // FIXME: the interpreter only supports ARM64{,_32} right now // temporary - without a check here the error happens when deploying - if (!app.IsSimulatorBuild && !app.IsArchEnabled (Abi.ARM64)) + if (!app.IsSimulatorBuild && (!app.IsArchEnabled (Abi.ARM64) && !app.IsArchEnabled (Abi.ARM64_32))) throw ErrorHelper.CreateError (99, "Internal error: The interpreter is currently only available for 64 bits."); // needs to be set after the argument validations // interpreter can use some extra code (e.g. SRE) that is not shipped in the default (AOT) profile app.EnableRepl = true; + } else { + if (app.Platform == ApplePlatform.WatchOS && app.IsArchEnabled (Abi.ARM64_32)) { + if (app.IsArchEnabled (Abi.ARMv7k)) { + throw ErrorHelper.CreateError (99, "Please use device builds on WatchOS."); + } else { + ErrorHelper.Warning (99, "ARM64_32 Debug mode requires --interpreter[=all], forcing it."); + app.UseInterpreter = true; + app.InterpretedAssemblies.Clear (); + } + } } if (cross_prefix == null)