/* * Runs the AOT compiler, creating one of the following: * [not llvm] => .s + .aotdata * [is llvm-only] => .bc + .aotdata * [is llvm] => * [is llvm creating assembly code] => .s + -llvm.s + .aotdata * [is llvm creating object code] => .s + -llvm.o + .aotdata */ public void CreateAOTTask(Abi abi) { // Check if we've already created the AOT tasks. if (AotInfos.ContainsKey(abi)) { return; } var assembly_path = FullPath; var build_dir = Path.GetDirectoryName(assembly_path); var arch = abi.AsArchString(); var asm_dir = Path.Combine(App.Cache.Location, arch); var asm = Path.Combine(asm_dir, Path.GetFileName(assembly_path)) + ".s"; var data = Path.Combine(asm_dir, Path.GetFileNameWithoutExtension(assembly_path)) + ".aotdata" + "." + arch; var llvm_aot_ofile = ""; var asm_output = (string)null; var other_output = string.Empty; var is_llvm = (abi & Abi.LLVM) == Abi.LLVM; Directory.CreateDirectory(asm_dir); if (!File.Exists(assembly_path)) { throw new MonoTouchException(3004, true, Errors.MT3004, assembly_path); } var aotInfo = new AotInfo(); AotInfos.Add(abi, aotInfo); if (App.EnableLLVMOnlyBitCode) { // In llvm-only mode, the AOT compiler emits a .bc file and no .s file for JITted code llvm_aot_ofile = Path.Combine(asm_dir, Path.GetFileName(assembly_path)) + ".bc"; aotInfo.BitcodeFiles.Add(llvm_aot_ofile); other_output = Path.Combine(asm_dir, Path.GetFileName(assembly_path)) + "-output"; } else if (is_llvm) { if (Driver.GetLLVMAsmWriter(App)) { llvm_aot_ofile = Path.Combine(asm_dir, Path.GetFileName(assembly_path)) + "-llvm.s"; aotInfo.AsmFiles.Add(llvm_aot_ofile); } else { llvm_aot_ofile = Path.Combine(asm_dir, Path.GetFileName(assembly_path)) + "-llvm.o"; aotInfo.ObjectFiles.Add(llvm_aot_ofile); } asm_output = asm; } else { asm_output = asm; } if (!string.IsNullOrEmpty(asm_output)) { aotInfo.AsmFiles.Add(asm_output); } aotInfo.AotDataFiles.Add(data); 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 { Assembly = this, AssemblyName = assembly_path, AddBitcodeMarkerSection = BuildTarget != AssemblyBuildTarget.StaticObject && App.EnableMarkerOnlyBitCode, AssemblyPath = asm, ProcessStartInfo = Driver.CreateStartInfo(App, aotCompiler, aotArgs, Path.GetDirectoryName(assembly_path)), AotInfo = aotInfo, }; if (App.Platform == ApplePlatform.WatchOS) { // Visual Studio for Mac sets this environment variable, and it confuses the AOT compiler. // So unset it. // See https://github.com/mono/mono/issues/11765 task.ProcessStartInfo.EnvironmentVariables ["MONO_THREADS_SUSPEND"] = null; } aotInfo.Task = task; }
/* * Runs the AOT compiler, creating one of the following: * [not llvm] => .s + .aotdata * [is llvm-only] => .bc + .aotdata * [is llvm] => * [is llvm creating assembly code] => .s + -llvm.s + .aotdata * [is llvm creating object code] => .s + -llvm.o + .aotdata */ public void CreateAOTTask(Abi abi) { // Check if we've already created the AOT tasks. if (AotInfos.ContainsKey(abi)) { return; } var assembly_path = FullPath; var build_dir = Path.GetDirectoryName(assembly_path); var arch = abi.AsArchString(); var asm_dir = Path.Combine(App.Cache.Location, arch); var asm = Path.Combine(asm_dir, Path.GetFileName(assembly_path)) + ".s"; var data = Path.Combine(asm_dir, Path.GetFileNameWithoutExtension(assembly_path)) + ".aotdata" + "." + arch; var llvm_aot_ofile = ""; var asm_output = ""; var is_llvm = (abi & Abi.LLVM) == Abi.LLVM; Directory.CreateDirectory(asm_dir); if (!File.Exists(assembly_path)) { throw new MonoTouchException(3004, true, "Could not AOT the assembly '{0}' because it doesn't exist.", assembly_path); } var aotInfo = new AotInfo(); AotInfos.Add(abi, aotInfo); if (App.EnableLLVMOnlyBitCode) { // In llvm-only mode, the AOT compiler emits a .bc file and no .s file for JITted code llvm_aot_ofile = Path.Combine(asm_dir, Path.GetFileName(assembly_path)) + ".bc"; aotInfo.BitcodeFiles.Add(llvm_aot_ofile); } else if (is_llvm) { if (Driver.GetLLVMAsmWriter(App)) { llvm_aot_ofile = Path.Combine(asm_dir, Path.GetFileName(assembly_path)) + "-llvm.s"; aotInfo.AsmFiles.Add(llvm_aot_ofile); } else { llvm_aot_ofile = Path.Combine(asm_dir, Path.GetFileName(assembly_path)) + "-llvm.o"; aotInfo.ObjectFiles.Add(llvm_aot_ofile); } asm_output = asm; } else { asm_output = asm; } if (!string.IsNullOrEmpty(asm_output)) { aotInfo.AsmFiles.Add(asm_output); } aotInfo.AotDataFiles.Add(data); var aotCompiler = Driver.GetAotCompiler(App, Target.Is64Build); var aotArgs = Driver.GetAotArguments(App, assembly_path, abi, build_dir, asm_output, llvm_aot_ofile, data); var task = new AOTTask { Assembly = this, AssemblyName = assembly_path, AddBitcodeMarkerSection = BuildTarget != AssemblyBuildTarget.StaticObject && App.EnableMarkerOnlyBitCode, AssemblyPath = asm, ProcessStartInfo = Driver.CreateStartInfo(App, aotCompiler, aotArgs, Path.GetDirectoryName(assembly_path)), AotInfo = aotInfo, }; aotInfo.Task = task; }