mirror of
https://github.com/openai/codex.git
synced 2026-05-15 16:53:05 +00:00
Filter unsupported ARM64 lld flag in archive probe
This commit is contained in:
47
.github/scripts/setup-dev-drive.ps1
vendored
47
.github/scripts/setup-dev-drive.ps1
vendored
@@ -102,6 +102,53 @@ function Export-MsvcEnvironment {
|
||||
throw "Windows linker not found at $linker"
|
||||
}
|
||||
|
||||
if ((Split-Path -Leaf $linker) -match "lld") {
|
||||
$wrapperDir = Join-Path $env:RUNNER_TEMP "arm64-archive-lld-wrapper"
|
||||
New-Item -Path $wrapperDir -ItemType Directory -Force | Out-Null
|
||||
$wrapperPath = Join-Path $wrapperDir "lld-link-wrapper.exe"
|
||||
@'
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
var linker = Environment.GetEnvironmentVariable("ARM64_ARCHIVE_REAL_LINKER");
|
||||
if (string.IsNullOrEmpty(linker))
|
||||
{
|
||||
Console.Error.WriteLine("ARM64_ARCHIVE_REAL_LINKER is not set");
|
||||
return 1;
|
||||
}
|
||||
|
||||
var startInfo = new ProcessStartInfo(linker)
|
||||
{
|
||||
UseShellExecute = false,
|
||||
};
|
||||
foreach (var arg in args)
|
||||
{
|
||||
if (!string.Equals(arg, "/arm64hazardfree", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
startInfo.ArgumentList.Add(arg);
|
||||
}
|
||||
}
|
||||
|
||||
using var process = Process.Start(startInfo);
|
||||
if (process is null)
|
||||
{
|
||||
Console.Error.WriteLine($"Failed to start linker: {linker}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
process.WaitForExit();
|
||||
return process.ExitCode;
|
||||
}
|
||||
}
|
||||
'@ | Add-Type -Language CSharp -OutputAssembly $wrapperPath -OutputType ConsoleApplication
|
||||
"ARM64_ARCHIVE_REAL_LINKER=$linker" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
$linker = $wrapperPath
|
||||
}
|
||||
|
||||
Write-Output "Using Windows linker: $linker"
|
||||
"CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER=$linker" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user