Skip to content

Commit d494bc9

Browse files
committed
Fix mimalloc patching
1 parent d8a1649 commit d494bc9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

utils/build.ps1

+10-2
Original file line numberDiff line numberDiff line change
@@ -1811,9 +1811,17 @@ function Build-mimalloc() {
18111811
foreach ($Tool in $Tools) {
18121812
$Binary = [IO.Path]::Combine($Arch.ToolchainInstallRoot, "usr", "bin", $Tool)
18131813
# Binary-patch in place
1814-
Start-Process -Wait -WindowStyle Hidden -FilePath "$SourceCache\mimalloc\bin\minject$BuildSuffix" -ArgumentList @("-f", "-i", "-v", "$Binary")
1814+
Invoke-Program "$SourceCache\mimalloc\bin\minject$BuildSuffix" "-f" "-i" "-v" "$Binary"
18151815
# Log the import table
1816-
Start-Process -Wait -WindowStyle Hidden -FilePath "$SourceCache\mimalloc\bin\minject$BuildSuffix" -ArgumentList @("-l", "$Binary")
1816+
$LogFile = "$BinaryCache\$($Arch.LLVMTarget)\mimalloc\minject-log-$Tool.txt"
1817+
$ErrorFile = "$BinaryCache\$($Arch.LLVMTarget)\mimalloc\minject-log-$Tool-error.txt"
1818+
Invoke-Program "$SourceCache\mimalloc\bin\minject$BuildSuffix" "-l" "$Binary" -OutFile $LogFile 2> $ErrorFile
1819+
# Verify patching
1820+
$Found = Select-String -Path $LogFile -Pattern "mimalloc"
1821+
if (-not $Found) {
1822+
Get-Content $ErrorFile
1823+
throw "Failed to patch mimalloc for $Tool"
1824+
}
18171825
}
18181826
}
18191827

0 commit comments

Comments
 (0)