Skip to content

Commit 1b03427

Browse files
authored
Merge pull request #704 from artemcm/55TBDToLinker
[5.5] Pass `.tbd` inputs down to the linker invocation.
2 parents bd1281d + 64d20de commit 1b03427

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Sources/SwiftDriver/Jobs/DarwinToolchain+LinkerSupport.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ extension DarwinToolchain {
268268
inputModules.append(input.file)
269269
} else if input.type == .object {
270270
inputPaths.append(input.file)
271+
} else if input.type == .tbd {
272+
inputPaths.append(input.file)
271273
} else if input.type == .llvmBitcode {
272274
inputPaths.append(input.file)
273275
}
@@ -291,6 +293,8 @@ extension DarwinToolchain {
291293
return [.flag("-add_ast_path"), .path(path.file)]
292294
} else if path.type == .object {
293295
return [.path(path.file)]
296+
} else if path.type == .tbd {
297+
return [.path(path.file)]
294298
} else if path.type == .llvmBitcode {
295299
return [.path(path.file)]
296300
} else {

Sources/SwiftDriver/Jobs/Planning.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ extension Driver {
330330
addCompileJobGroup: addCompileJobGroup,
331331
addJobOutputs: addJobOutputs)
332332

333-
case .object, .autolink, .llvmBitcode:
333+
case .object, .autolink, .llvmBitcode, .tbd:
334334
if linkerOutputType != nil {
335335
addLinkerInput(input)
336336
} else {

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,17 @@ final class SwiftDriverTests: XCTestCase {
10181018
XCTAssertFalse(cmd.contains(.flag("-shared")))
10191019
}
10201020

1021+
do {
1022+
// .tbd inputs are passed down to the linker.
1023+
var driver = try Driver(args: commonArgs + ["foo.dylib", "foo.tbd", "-target", "x86_64-apple-macosx10.15"], env: env)
1024+
let plannedJobs = try driver.planBuild()
1025+
let linkJob = plannedJobs[2]
1026+
XCTAssertEqual(linkJob.kind, .link)
1027+
let cmd = linkJob.commandLine
1028+
XCTAssertTrue(cmd.contains(.path(try VirtualPath(path: "foo.tbd"))))
1029+
XCTAssertTrue(cmd.contains(.path(try VirtualPath(path: "foo.dylib"))))
1030+
}
1031+
10211032
do {
10221033
// iOS target
10231034
var driver = try Driver(args: commonArgs + ["-emit-library", "-target", "arm64-apple-ios10.0"], env: env)

0 commit comments

Comments
 (0)