Filter MSVC lld flag in response files

This commit is contained in:
starr-openai
2026-05-13 17:21:23 -07:00
parent 8044985718
commit 89fec45529

View File

@@ -122,6 +122,7 @@ runs:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
internal static class Program
@@ -144,7 +145,7 @@ internal static class Program
{
if (!string.Equals(arg, "/arm64hazardfree", StringComparison.OrdinalIgnoreCase))
{
filteredArgs.Add(QuoteArgument(arg));
filteredArgs.Add(QuoteArgument(FilterResponseFile(arg)));
}
}
startInfo.Arguments = string.Join(" ", filteredArgs);
@@ -160,6 +161,25 @@ internal static class Program
return process.ExitCode;
}
private static string FilterResponseFile(string argument)
{
if (argument.Length < 2 || argument[0] != '@')
{
return argument;
}
var responsePath = argument.Substring(1);
if (!File.Exists(responsePath))
{
return argument;
}
var filteredResponsePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".rsp");
var responseContents = File.ReadAllText(responsePath).Replace("/arm64hazardfree", string.Empty);
File.WriteAllText(filteredResponsePath, responseContents);
return "@" + filteredResponsePath;
}
private static string QuoteArgument(string argument)
{
if (argument.Length == 0)