Skip to content

Commit 6f132fd

Browse files
authored
Merge pull request #79768 from hjyamauchi/lnk1322
Work around the LNK1322 issue in swift-build on windows
2 parents 5851118 + fcb81f9 commit 6f132fd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

utils/build.ps1

+6-3
Original file line numberDiff line numberDiff line change
@@ -2546,6 +2546,10 @@ function Build-System($Arch) {
25462546
}
25472547

25482548
function Build-Build($Arch) {
2549+
# Use lld to workaround the ARM64 LNK1322 issue: https://github.com/swiftlang/swift/issues/79740
2550+
# FIXME(hjyamauchi) Have a real fix
2551+
$ArchSpecificOptions = if ($Arch -eq $ArchARM64) { @{ CMAKE_Swift_FLAGS = "-use-ld=lld-link"; } } else { @{} }
2552+
25492553
Build-CMakeProject `
25502554
-Src $SourceCache\swift-build `
25512555
-Bin (Get-HostProjectBinaryCache Build) `
@@ -2554,7 +2558,7 @@ function Build-Build($Arch) {
25542558
-Platform Windows `
25552559
-UseBuiltCompilers C,CXX,Swift `
25562560
-SwiftSDK (Get-SwiftSDK Windows) `
2557-
-Defines @{
2561+
-Defines (@{
25582562
BUILD_SHARED_LIBS = "YES";
25592563
CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib";
25602564
ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
@@ -2564,7 +2568,7 @@ function Build-Build($Arch) {
25642568
TSC_DIR = (Get-HostProjectCMakeModules ToolsSupportCore);
25652569
SQLite3_INCLUDE_DIR = "$LibraryRoot\sqlite-3.46.0\usr\include";
25662570
SQLite3_LIBRARY = "$LibraryRoot\sqlite-3.46.0\usr\lib\SQLite3.lib";
2567-
}
2571+
} + $ArchSpecificOptions)
25682572
}
25692573

25702574
function Build-ToolsSupportCore($Arch) {
@@ -3179,7 +3183,6 @@ if ($Clean) {
31793183
}
31803184
}
31813185

3182-
31833186
if (-not $SkipBuild) {
31843187
if ($EnableCaching -And (-Not (Test-SCCacheAtLeast -Major 0 -Minor 7 -Patch 4))) {
31853188
throw "Minimum required sccache version is 0.7.4"

0 commit comments

Comments
 (0)