Skip to content

Commit

Permalink
[task] Bootstrap export-symbols-outfile mono aot compiler option to M…
Browse files Browse the repository at this point in the history
…onoAOTCompiler Task
  • Loading branch information
mdh1418 committed Dec 9, 2022
1 parent 2e322e7 commit 4142a37
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task
/// </summary>
public string LibraryFilePrefix { get; set; } = "";

/// <summary>
/// Enables exporting symbols of methods decorated with UnmanagedCallersOnly Attribute containing a specified EntryPoint
/// </summary>
public bool EnableUnmanagedCallersOnlyMethodsExport { get; set; }

/// <summary>
/// Path to the directory where LLVM binaries (opt and llc) are found.
/// It's required if UseLLVM is set
Expand Down Expand Up @@ -729,6 +734,20 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st
}
}

if ((parsedAotMode == MonoAotMode.Full ||
parsedAotMode == MonoAotMode.FullInterp ||
parsedAotMode == MonoAotMode.LLVMOnly ||
parsedAotMode == MonoAotMode.LLVMOnlyInterp) &&
EnableUnmanagedCallersOnlyMethodsExport)
{
string exportSymbolsFile = Path.Combine(OutputDir, Path.ChangeExtension(assemblyFilename, ".exportsymbols"));
ProxyFile proxyFile = _cache.NewFile(exportSymbolsFile);
proxyFiles.Add(proxyFile);

aotArgs.Add($"export-symbols-outfile={proxyFile.TempFile}");
aotAssembly.SetMetadata("ExportSymbolsFile", proxyFile.TargetFile);
}

// pass msym-dir if specified
if (MsymPath != null)
{
Expand Down

0 comments on commit 4142a37

Please sign in to comment.