Skip to content

Commit e270919

Browse files
committed
Disable LTO support on Windows
1 parent b1e5ef9 commit e270919

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/SwiftDriver/Toolchains/WindowsToolchain.swift

+8-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ extension WindowsToolchain {
109109
targetTriple: Triple,
110110
targetVariantTriple: Triple?,
111111
diagnosticsEngine: DiagnosticsEngine) throws {
112+
// The default linker `LINK.exe` can use `/LTCG:INCREMENTAL` to enable LTO,
113+
// and LLVM LTOs are available through `lld-link`. Both LTO methods still need
114+
// additional work to be integrated, so disable this option for now.
115+
if parsedOptions.hasArgument(.lto) {
116+
// TODO: LTO support on Windows
117+
throw ToolchainValidationError.argumentNotSupported("-lto=")
118+
}
112119
// Windows executables should be profiled with ETW, whose support needs to be
113120
// implemented before we can enable the option.
114121
if parsedOptions.hasArgument(.profileGenerate) {
@@ -137,7 +144,7 @@ extension WindowsToolchain {
137144
case .illegalCrtName(let argument):
138145
return "\(argument) is not a valid C Runtime for Windows"
139146
case .sdkNotFound:
140-
return "swift development on Windows always requires SDK of the target platform"
147+
return "swift development on Windows always requires the SDK of target platform"
141148
}
142149
}
143150
}

0 commit comments

Comments
 (0)