Skip to content

Commit 4ca89fa

Browse files
committed
[Unix] Go back to only checking the runtime resource path for swiftrt.o
1 parent ff07a06 commit 4ca89fa

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift

+7-10
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,13 @@ extension GenericUnixToolchain {
168168
}
169169

170170
if !isEmbeddedEnabled && !parsedOptions.hasArgument(.nostartfiles) {
171-
let rsrc: VirtualPath
172-
// Prefer the swiftrt.o runtime file from the SDK if it's specified.
173-
if let sdk = targetInfo.sdkPath {
174-
rsrc = VirtualPath.lookup(sdk.path).appending(components: "usr", "lib", "swift")
175-
} else {
176-
rsrc = VirtualPath.lookup(targetInfo.runtimeResourcePath.path)
177-
}
178-
let platform: String = targetTriple.platformName() ?? ""
179-
let architecture: String = majorArchitectureName(for: targetTriple)
180-
commandLine.appendPath(rsrc.appending(components: platform, architecture, "swiftrt.o"))
171+
let swiftrtPath = VirtualPath.lookup(targetInfo.runtimeResourcePath.path)
172+
.appending(
173+
components: targetTriple.platformName() ?? "",
174+
String(majorArchitectureName(for: targetTriple)),
175+
"swiftrt.o"
176+
)
177+
commandLine.appendPath(swiftrtPath)
181178
}
182179

183180
// If we are linking statically, we need to add all

0 commit comments

Comments
 (0)