This commit is contained in:
nub31
2025-09-11 21:22:30 +02:00
parent 5fecfeba43
commit fd27d2709d
46 changed files with 5339 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using System.Diagnostics;
namespace NubLang.CLI;
public static class GCC
{
public static async Task<bool> Assemble(string asmPath, string outPath)
{
using var process = new Process();
process.StartInfo = new ProcessStartInfo("x86_64-elf-as", ["-nostartfiles", "-o", outPath, asmPath])
{
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
};
process.Start();
await process.WaitForExitAsync();
var errors = await process.StandardError.ReadToEndAsync();
if (!string.IsNullOrWhiteSpace(errors))
{
await Console.Error.WriteLineAsync("gcc error when assembling:\n" + errors);
}
return process.ExitCode == 0;
}
}