Skip to content

Commit

Permalink
[mtouch] force --interpreter on arm64_32 debug mode build
Browse files Browse the repository at this point in the history
  • Loading branch information
lewurm committed Sep 17, 2019
1 parent a95e2ed commit b2f901d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tools/mtouch/Assembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion tools/mtouch/BuildTasks.mtouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ public override IEnumerable<string> 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);
Expand Down
23 changes: 19 additions & 4 deletions tools/mtouch/mtouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b2f901d

Please sign in to comment.