[tools] Pass the AOTCompiler property to the ComputeAOTArguments linker steps.

So that the ComputeAOTArguments can compute the llvm-path value to pass to the AOT
compiler (the llvm-path value states where the opt and llc command-line tools are,
and they're next to the AOT compiler).
This commit is contained in:
Rolf Bjarne Kvinge 2021-07-15 11:57:21 +02:00
Родитель f292635e48
Коммит 2116ba59de
4 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -356,6 +356,7 @@
<_CustomLinkerOptions>
AssemblyName=$(AssemblyName).dll
AOTCompiler=$(_AOTCompiler)
AOTOutputDirectory=$(_AOTOutputDirectory)
CacheDirectory=$(_LinkerCacheDirectory)
Debug=$(_BundlerDebug)

Просмотреть файл

@ -1408,7 +1408,7 @@ namespace Xamarin.Bundler {
return processArguments;
}
public void GetAotArguments (string filename, Abi abi, string outputDir, string outputFile, string llvmOutputFile, string dataFile, out List<string> processArguments, out List<string> aotArguments)
public void GetAotArguments (string filename, Abi abi, string outputDir, string outputFile, string llvmOutputFile, string dataFile, out List<string> processArguments, out List<string> aotArguments, string llvm_path = null)
{
string fname = Path.GetFileName (filename);
processArguments = new List<string> ();
@ -1472,8 +1472,13 @@ namespace Xamarin.Bundler {
aotArguments.Add ($"msym-dir={msymdir}");
}
if (enable_llvm)
aotArguments.Add ($"llvm-path={Driver.GetFrameworkCurrentDirectory (app)}/LLVM/bin/");
if (enable_llvm) {
if (!string.IsNullOrEmpty (llvm_path)) {
aotArguments.Add ($"llvm-path={llvm_path}");
} else {
aotArguments.Add ($"llvm-path={Driver.GetFrameworkCurrentDirectory (app)}/LLVM/bin/");
}
}
aotArguments.Add ($"outfile={outputFile}");
if (enable_llvm)

Просмотреть файл

@ -17,6 +17,7 @@ using ObjCRuntime;
namespace Xamarin.Linker {
public class LinkerConfiguration {
public List<Abi> Abis;
public string AOTCompiler;
public string AOTOutputDirectory;
public string CacheDirectory { get; private set; }
public Version DeploymentTarget { get; private set; }
@ -104,6 +105,9 @@ namespace Xamarin.Linker {
// This is the AssemblyName MSBuild property for the main project (which is also the root/entry assembly)
Application.RootAssemblies.Add (value);
break;
case "AOTCompiler":
AOTCompiler = value;
break;
case "AOTOutputDirectory":
AOTOutputDirectory = value;
break;

Просмотреть файл

@ -39,7 +39,7 @@ namespace Xamarin.Linker {
var llvmFile = string.Empty;
if ((abi & Abi.LLVM) == Abi.LLVM)
throw ErrorHelper.CreateError (99, $"Support for LLVM hasn't been implemented yet.");
app.GetAotArguments (asm.FullPath, abi, outputDirectory, aotAssembly, llvmFile, aotData, out var processArguments, out var aotArguments);
app.GetAotArguments (asm.FullPath, abi, outputDirectory, aotAssembly, llvmFile, aotData, out var processArguments, out var aotArguments, Path.GetDirectoryName (Configuration.AOTCompiler));
item.Metadata.Add ("Arguments", StringUtils.FormatArguments (aotArguments));
item.Metadata.Add ("ProcessArguments", StringUtils.FormatArguments (processArguments));
item.Metadata.Add ("Abi", abiString);