@@ -143,16 +143,17 @@ public final class DarwinToolchain: Toolchain {
143
143
public enum ToolchainValidationError : Error , DiagnosticData {
144
144
case osVersionBelowMinimumDeploymentTarget( String )
145
145
case argumentNotSupported( String )
146
- case iOSVersionAboveMaximumDeploymentTarget ( Int )
146
+ case invalidDeploymentTargetForIR ( String , String )
147
147
case unsupportedTargetVariant( variant: Triple )
148
148
case darwinOnlySupportsLibCxx
149
149
150
150
public var description : String {
151
151
switch self {
152
152
case . osVersionBelowMinimumDeploymentTarget( let target) :
153
153
return " Swift requires a minimum deployment target of \( target) "
154
- case . iOSVersionAboveMaximumDeploymentTarget( let version) :
155
- return " iOS \( version) does not support 32-bit programs "
154
+ case . invalidDeploymentTargetForIR( let target, let archName) :
155
+ return
156
+ " \( target) and above does not support emitting binaries or IR for \( archName) "
156
157
case . unsupportedTargetVariant( variant: let variant) :
157
158
return " unsupported ' \( variant. isiOS ? " -target-variant " : " -target " ) ' value ' \( variant. triple) '; use 'ios-macabi' instead "
158
159
case . argumentNotSupported( let argument) :
@@ -166,6 +167,7 @@ public final class DarwinToolchain: Toolchain {
166
167
public func validateArgs( _ parsedOptions: inout ParsedOptions ,
167
168
targetTriple: Triple ,
168
169
targetVariantTriple: Triple ? ,
170
+ compilerOutputType: FileType ? ,
169
171
diagnosticsEngine: DiagnosticsEngine ) throws {
170
172
// On non-darwin hosts, libArcLite won't be found and a warning will be emitted
171
173
// Guard for the sake of tests running on all platforms
@@ -176,7 +178,8 @@ public final class DarwinToolchain: Toolchain {
176
178
diagnosticsEngine: diagnosticsEngine)
177
179
#endif
178
180
// Validating apple platforms deployment targets.
179
- try validateDeploymentTarget ( & parsedOptions, targetTriple: targetTriple)
181
+ try validateDeploymentTarget ( & parsedOptions, targetTriple: targetTriple,
182
+ compilerOutputType: compilerOutputType)
180
183
if let targetVariantTriple = targetVariantTriple,
181
184
!targetTriple. isValidForZipperingWithTriple ( targetVariantTriple) {
182
185
throw ToolchainValidationError . unsupportedTargetVariant ( variant: targetVariantTriple)
@@ -198,7 +201,7 @@ public final class DarwinToolchain: Toolchain {
198
201
}
199
202
200
203
func validateDeploymentTarget( _ parsedOptions: inout ParsedOptions ,
201
- targetTriple: Triple ) throws {
204
+ targetTriple: Triple , compilerOutputType : FileType ? ) throws {
202
205
// Check minimum supported OS versions.
203
206
if targetTriple. isMacOSX,
204
207
targetTriple. version ( for: . macOS) < Triple . Version ( 10 , 9 , 0 ) {
@@ -213,8 +216,11 @@ public final class DarwinToolchain: Toolchain {
213
216
throw ToolchainValidationError . osVersionBelowMinimumDeploymentTarget ( " iOS 7 " )
214
217
}
215
218
if targetTriple. arch? . is32Bit == true ,
216
- targetTriple. version ( for: . iOS( . device) ) >= Triple . Version ( 11 , 0 , 0 ) {
217
- throw ToolchainValidationError . iOSVersionAboveMaximumDeploymentTarget ( targetTriple. version ( for: . iOS( . device) ) . major)
219
+ targetTriple. version ( for: . iOS( . device) ) >= Triple . Version ( 11 , 0 , 0 ) ,
220
+ compilerOutputType != . swiftModule {
221
+ throw
222
+ ToolchainValidationError
223
+ . invalidDeploymentTargetForIR ( " iOS 11 " , targetTriple. archName)
218
224
}
219
225
} else if targetTriple. isWatchOS,
220
226
targetTriple. version ( for: . watchOS( . device) ) < Triple . Version ( 2 , 0 , 0 ) {
0 commit comments