This commit is contained in:
nub31
2025-08-18 16:56:20 +02:00
parent a01539ff24
commit 8e36aa4d95
5 changed files with 73 additions and 153 deletions

View File

@@ -6,12 +6,6 @@ public static class GCC
{
public static async Task<bool> Assemble(string asmPath, string outPath)
{
var dir = Path.GetDirectoryName(outPath);
if (dir != null)
{
Directory.CreateDirectory(dir);
}
using var process = new Process();
process.StartInfo = new ProcessStartInfo("gcc", ["-xassembler", "-c", "-o", outPath, asmPath])
{
@@ -22,7 +16,7 @@ public static class GCC
};
process.Start();
await process.WaitForExitAsync();
var errors = await process.StandardError.ReadToEndAsync();
@@ -33,15 +27,9 @@ public static class GCC
return process.ExitCode == 0;
}
public static async Task<bool> Link(string executablePath, params IEnumerable<string> objectFiles)
{
var dir = Path.GetDirectoryName(executablePath);
if (dir != null)
{
Directory.CreateDirectory(dir);
}
using var process = new Process();
process.StartInfo = new ProcessStartInfo("gcc", ["-nostartfiles", "-o", executablePath, ..objectFiles])
{
@@ -52,7 +40,7 @@ public static class GCC
};
process.Start();
await process.WaitForExitAsync();
var errors = await process.StandardError.ReadToEndAsync();
@@ -63,4 +51,4 @@ public static class GCC
return process.ExitCode == 0;
}
}
}