From 0196080358dc1821d0eede8031f040fa0f458efb Mon Sep 17 00:00:00 2001 From: Dylan Conway Date: Mon, 9 Mar 2026 22:05:29 -0700 Subject: [PATCH 1/2] Build ICU stage 2 with ClangCL so -march limits codegen on x64 --- build-icu.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build-icu.ps1 b/build-icu.ps1 index 2ceca7608c55..106f0cd896b3 100644 --- a/build-icu.ps1 +++ b/build-icu.ps1 @@ -76,11 +76,14 @@ if (-not (Test-Path $ICU_SOURCE_DIR)) { } if ($Platform -eq "x64") { - $ArchFlag = if ($Baseline) { "/arch:SSE2" } else { "/arch:AVX2" } + $ArchFlag = if ($Baseline) { "/clang:-march=nehalem" } else { "/clang:-march=haswell" } } else { $ArchFlag = "" } +# ClangCL for stage 2 so -march= limits codegen (MSVC /arch:SSE2 is a no-op on x64). +$ToolsetArg = if ($Platform -eq "x64") { @("/p:PlatformToolset=ClangCL") } else { @() } + # --- Function to patch vcxproj files for static library build with /MT --- function Patch-IcuVcxProj { param( @@ -235,6 +238,7 @@ foreach ($target in @("common", "i18n")) { "/v:minimal" ) + $buildArgs += $ToolsetArg & $msbuildPath $buildArgs if ($LASTEXITCODE -ne 0) { From 335daa86527e86bd414a45eba2cce35eb571a6f6 Mon Sep 17 00:00:00 2001 From: Dylan Conway Date: Mon, 9 Mar 2026 22:14:02 -0700 Subject: [PATCH 2/2] Strip .rc from ICU vcxproj since rc.exe cannot parse clang stddef.h --- build-icu.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-icu.ps1 b/build-icu.ps1 index 106f0cd896b3..338b3d368a96 100644 --- a/build-icu.ps1 +++ b/build-icu.ps1 @@ -128,6 +128,10 @@ function Patch-IcuVcxProj { $content = $content -replace '[^<]*\.(dll|DLL)', '' $content = $content -replace '[^<]*', '' + # Strip .rc — rc.exe cannot parse clang stddef.h and static libs do not need version resources. + $content = $content -replace "(?s)]*>.*?", "" + $content = $content -replace "]*/>", "" + # For stubdata - remove resource-only DLL settings if ($FilePath -match "stubdata") { $content = $content -replace 'true', ''