Skip to content

Commit b481131

Browse files
committed
[SDK Support] Make sure to look in swift_static rather than just swift.
If we're building a statically linked executable, we should look in `usr/lib/swift_static` for `swiftrt.o`, rather than looking in `usr/lib/swift`. Not doing this breaks the Static SDK for Linux. rdar://145549541
1 parent 1f44670 commit b481131

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,13 @@ extension GenericUnixToolchain {
171171
let rsrc: VirtualPath
172172
// Prefer the swiftrt.o runtime file from the SDK if it's specified.
173173
if let sdk = targetInfo.sdkPath {
174-
rsrc = VirtualPath.lookup(sdk.path).appending(components: "usr", "lib", "swift")
174+
let swiftDir: String
175+
if staticStdlib || staticExecutable {
176+
swiftDir = "swift_static"
177+
} else {
178+
swiftDir = "swift"
179+
}
180+
rsrc = VirtualPath.lookup(sdk.path).appending(components: "usr", "lib", swiftDir)
175181
} else {
176182
rsrc = VirtualPath.lookup(targetInfo.runtimeResourcePath.path)
177183
}

0 commit comments

Comments
 (0)