Skip to content

Commit 2bc3253

Browse files
committed
SwiftDriver: adjust handling of -resource-dir parameter
When computing the resource directory for the Swift registrar, we need to add a couple of components that we had missed. Correct the path computation so that we can find the object file properly. This was detected while running the test suite with the early swift driver on Windows where `-resource-dir` is explicitly passed.
1 parent 4b5e5d7 commit 2bc3253

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/SwiftDriver/Jobs/WindowsToolchain+LinkerSupport.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,10 @@ extension WindowsToolchain {
173173
// finally falling back to the target information.
174174
let rsrc: VirtualPath
175175
if let resourceDir = parsedOptions.getLastArgument(.resourceDir) {
176-
rsrc = try VirtualPath(path: resourceDir.asSingle)
176+
rsrc = try VirtualPath(path: AbsolutePath(validating: resourceDir.asSingle)
177+
.appending(components: targetTriple.platformName() ?? "",
178+
architecture(for: targetTriple))
179+
.pathString)
177180
} else if let sdk = parsedOptions.getLastArgument(.sdk)?.asSingle ?? env["SDKROOT"], !sdk.isEmpty {
178181
rsrc = try VirtualPath(path: AbsolutePath(validating: sdk)
179182
.appending(components: "usr", "lib", "swift",
@@ -182,6 +185,8 @@ extension WindowsToolchain {
182185
.pathString)
183186
} else {
184187
rsrc = VirtualPath.lookup(targetInfo.runtimeResourcePath.path)
188+
.appending(components: targetTriple.platformName() ?? "",
189+
architecture(for: targetTriple))
185190
}
186191
commandLine.appendPath(rsrc.appending(component: "swiftrt.obj"))
187192
}

0 commit comments

Comments
 (0)