From 26ec2826aac9ac6cb23fbe9db3d636cde2addf35 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Tue, 24 Sep 2019 17:24:49 +0200 Subject: [PATCH] ARM64_32 Debug Mode (#7012) * [builds] add arm64_32 cross compiler * [mtouch] force --interpreter on arm64_32 debug mode build * [mtouch] include debug check for arm64_32 and reflect error codes in documentation --- builds/Makefile | 6 +++++- docs/website/mtouch-errors.md | 12 ++++++++++++ tools/mtouch/Assembly.cs | 2 +- tools/mtouch/BuildTasks.mtouch.cs | 3 ++- tools/mtouch/mtouch.cs | 23 +++++++++++++++++++---- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/builds/Makefile b/builds/Makefile index 233785ac9af6..1592f5d330fa 100644 --- a/builds/Makefile +++ b/builds/Makefile @@ -958,6 +958,7 @@ install-local:: install-cross $(MONO_IOS_SDK_DESTDIR)/ios-cross32-release/bin/arm-darwin-mono-sgen: .stamp-$(MONO_BUILD_MODE) $(MONO_IOS_SDK_DESTDIR)/ios-cross64-release/bin/aarch64-darwin-mono-sgen: .stamp-$(MONO_BUILD_MODE) $(MONO_IOS_SDK_DESTDIR)/ios-crosswatch-release/bin/armv7k-unknown-darwin-mono-sgen: .stamp-$(MONO_BUILD_MODE) +$(MONO_IOS_SDK_DESTDIR)/ios-crosswatch-release/bin/aarch64-apple-darwin10_ilp32-mono-sgen: .stamp-$(MONO_BUILD_MODE) $(PREFIX)/bin/arm-darwin-mono-sgen: $(MONO_IOS_SDK_DESTDIR)/ios-cross32-release/bin/arm-darwin-mono-sgen | $(PREFIX)/bin $(call Q_2,INSTALL ,[CROSS]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $^ $@ @@ -968,11 +969,14 @@ $(PREFIX)/bin/arm64-darwin-mono-sgen: $(MONO_IOS_SDK_DESTDIR)/ios-cross64-releas $(PREFIX)/bin/armv7k-unknown-darwin-mono-sgen: $(MONO_IOS_SDK_DESTDIR)/ios-crosswatch-release/bin/armv7k-unknown-darwin-mono-sgen | $(PREFIX)/bin $(call Q_2,INSTALL ,[CROSS]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $^ $@ +$(PREFIX)/bin/arm64_32-darwin-mono-sgen: $(MONO_IOS_SDK_DESTDIR)/ios-crosswatch64_32-release/bin/aarch64-apple-darwin10_ilp32-mono-sgen | $(PREFIX)/bin + $(call Q_2,INSTALL ,[CROSS]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $^ $@ + $(PREFIX)/bin: $(Q) mkdir -p $@ .PHONY: install-cross -install-cross: $(PREFIX)/bin/arm-darwin-mono-sgen $(PREFIX)/bin/arm64-darwin-mono-sgen $(PREFIX)/bin/armv7k-unknown-darwin-mono-sgen +install-cross: $(PREFIX)/bin/arm-darwin-mono-sgen $(PREFIX)/bin/arm64-darwin-mono-sgen $(PREFIX)/bin/armv7k-unknown-darwin-mono-sgen $(PREFIX)/bin/arm64_32-darwin-mono-sgen # # LLVM diff --git a/docs/website/mtouch-errors.md b/docs/website/mtouch-errors.md index 2faa3f52b208..9d0b913dc072 100644 --- a/docs/website/mtouch-errors.md +++ b/docs/website/mtouch-errors.md @@ -966,6 +966,18 @@ This warning is shown if the assemblies names given to the `--interpreter` optio + + +### MT0145: Please use device builds on WatchOS. + +This error occurs if you use combined device builds for a Watch extension project. Per device builds are default in new projects. + + + +### MT0146: ARM64_32 Debug mode requires --interpreter[=all], forcing it. + +This warning is shown when `--interpreter` isn't specified explicitly for ARM64_32 Debug builds. The AOT compiler can't be used because it doesn't support ARM64_32. + # MT1xxx: Project related error messages ### MT10xx: Installer / mtouch 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 88da24b3534a..22704ca8a942 100644 --- a/tools/mtouch/BuildTasks.mtouch.cs +++ b/tools/mtouch/BuildTasks.mtouch.cs @@ -218,7 +218,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 4ed30326528b..b53ea6463b66 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: @@ -1339,14 +1344,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) && app.BitCodeMode != BitCodeMode.LLVMOnly) { + if (app.IsArchEnabled (Abi.ARMv7k)) { + throw ErrorHelper.CreateError (145, "Please use device builds on WatchOS."); + } else { + ErrorHelper.Warning (146, "ARM64_32 Debug mode requires --interpreter[=all], forcing it."); + app.UseInterpreter = true; + app.InterpretedAssemblies.Clear (); + } + } } if (cross_prefix == null)