Skip to content

Commit 960c210

Browse files
authored
Darwin: fix target variant flag when building zippered libraries (#1803)
Addresses rdar://144817791
1 parent 1890792 commit 960c210

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Sources/SwiftDriver/Jobs/DarwinToolchain+LinkerSupport.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ extension DarwinToolchain {
235235
commandLine.appendFlag("--target=\(targetTriple.triple)")
236236
if let variantTriple = targetInfo.targetVariant?.triple {
237237
assert(targetTriple.isValidForZipperingWithTriple(variantTriple))
238-
commandLine.appendFlag("-darwin-target-variant=\(variantTriple.triple)")
238+
commandLine.appendFlag("-darwin-target-variant")
239+
commandLine.appendFlag(variantTriple.triple)
239240
}
240241

241242
// On Darwin, we only support libc++.

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4075,7 +4075,7 @@ final class SwiftDriverTests: XCTestCase {
40754075

40764076
XCTAssertEqual(plannedJobs[1].kind, .link)
40774077
XCTAssert(plannedJobs[1].commandLine.contains(.flag("--target=x86_64-apple-ios13.1-macabi")))
4078-
XCTAssert(plannedJobs[1].commandLine.contains(.flag("-darwin-target-variant=x86_64-apple-macosx10.14")))
4078+
XCTAssertJobInvocationMatches(plannedJobs[1], .flag("-darwin-target-variant"), .flag("x86_64-apple-macosx10.14"))
40794079
}
40804080

40814081
// Test -target-variant is passed to generate pch job
@@ -4100,7 +4100,7 @@ final class SwiftDriverTests: XCTestCase {
41004100

41014101
XCTAssertEqual(plannedJobs[2].kind, .link)
41024102
XCTAssert(plannedJobs[2].commandLine.contains(.flag("--target=x86_64-apple-ios13.1-macabi")))
4103-
XCTAssert(plannedJobs[2].commandLine.contains(.flag("-darwin-target-variant=x86_64-apple-macosx10.14")))
4103+
XCTAssertJobInvocationMatches(plannedJobs[2], .flag("-darwin-target-variant"), .flag("x86_64-apple-macosx10.14"))
41044104
}
41054105
}
41064106

@@ -5006,7 +5006,7 @@ final class SwiftDriverTests: XCTestCase {
50065006
XCTAssertJobInvocationMatches(frontendJobs[0], .flag("-target-sdk-version"), .flag("10.15"), .flag("-target-variant-sdk-version"), .flag("13.1"))
50075007
XCTAssertEqual(frontendJobs[1].kind, .link)
50085008
XCTAssertJobInvocationMatches(frontendJobs[1], .flag("--target=x86_64-apple-macosx10.14"))
5009-
XCTAssertJobInvocationMatches(frontendJobs[1], .flag("-darwin-target-variant=x86_64-apple-ios13.1-macabi"))
5009+
XCTAssertJobInvocationMatches(frontendJobs[1], .flag("-darwin-target-variant"), .flag("x86_64-apple-ios13.1-macabi"))
50105010
}
50115011

50125012
do {
@@ -5023,7 +5023,7 @@ final class SwiftDriverTests: XCTestCase {
50235023
}
50245024
XCTAssertEqual(frontendJobs[1].kind, .link)
50255025
XCTAssertJobInvocationMatches(frontendJobs[1], .flag("--target=x86_64-apple-macosx10.14"))
5026-
XCTAssertJobInvocationMatches(frontendJobs[1], .flag("-darwin-target-variant=x86_64-apple-ios13.1-macabi"))
5026+
XCTAssertJobInvocationMatches(frontendJobs[1], .flag("-darwin-target-variant"), .flag("x86_64-apple-ios13.1-macabi"))
50275027
}
50285028

50295029
do {
@@ -5043,7 +5043,7 @@ final class SwiftDriverTests: XCTestCase {
50435043
}
50445044
XCTAssertEqual(frontendJobs[1].kind, .link)
50455045
XCTAssertJobInvocationMatches(frontendJobs[1], .flag("--target=x86_64-apple-ios13.1-macabi"))
5046-
XCTAssertJobInvocationMatches(frontendJobs[1], .flag("-darwin-target-variant=x86_64-apple-macosx10.14"))
5046+
XCTAssertJobInvocationMatches(frontendJobs[1], .flag("-darwin-target-variant"), .flag("x86_64-apple-macosx10.14"))
50475047
}
50485048
}
50495049
}

0 commit comments

Comments
 (0)