Skip to content

Commit 216ba83

Browse files
authored
Merge pull request #1381 from finagolfin/release/5.9
[5.9] Remove unused runtime library path on non-Darwin platforms
2 parents 0b96083 + 5677d20 commit 216ba83

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ extension Toolchain {
4646
result.append(path)
4747
}
4848

49-
if let sdkPath = sdkPath.map(VirtualPath.lookup) {
49+
// Only Darwin places libraries directly in /sdk/usr/lib/swift/.
50+
if triple.isDarwin, let sdkPath = sdkPath.map(VirtualPath.lookup) {
5051
// If we added the secondary resource dir, we also need the iOSSupport directory.
5152
if secondaryResourceDir != nil {
5253
result.append(sdkPath.appending(components: "System", "iOSSupport", "usr", "lib", "swift"))

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4753,6 +4753,9 @@ final class SwiftDriverTests: XCTestCase {
47534753
var driver = try Driver(args: ["swiftc", "foo.swift", "-sdk", "/"])
47544754
let plannedJobs = try driver.planBuild()
47554755
XCTAssertTrue(plannedJobs[0].commandLine.contains(subsequence: ["-sdk", .path(.absolute(.init("/")))]))
4756+
if !driver.targetTriple.isDarwin {
4757+
XCTAssertFalse(plannedJobs[2].commandLine.contains(subsequence: ["-L", .path(.absolute(.init("/usr/lib/swift")))]))
4758+
}
47564759
}
47574760

47584761
func testDumpASTOverride() throws {

0 commit comments

Comments
 (0)