diff --git a/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift b/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift index ffdf2a406..76ea1851c 100644 --- a/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift +++ b/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift @@ -171,7 +171,13 @@ extension GenericUnixToolchain { let rsrc: VirtualPath // Prefer the swiftrt.o runtime file from the SDK if it's specified. if let sdk = targetInfo.sdkPath { - rsrc = VirtualPath.lookup(sdk.path).appending(components: "usr", "lib", "swift") + let swiftDir: String + if staticStdlib || staticExecutable { + swiftDir = "swift_static" + } else { + swiftDir = "swift" + } + rsrc = VirtualPath.lookup(sdk.path).appending(components: "usr", "lib", swiftDir) } else { rsrc = VirtualPath.lookup(targetInfo.runtimeResourcePath.path) }