Skip to content

Commit 261e7b7

Browse files
authored
Merge pull request #1374 from finagolfin/run
Remove unused runtime library path on non-Darwin platforms
2 parents 99d316a + e8f7a89 commit 261e7b7

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
@@ -51,7 +51,8 @@ extension Toolchain {
5151
result.append(path)
5252
}
5353

54-
if let sdkPath = sdkPath.map(VirtualPath.lookup) {
54+
// Only Darwin places libraries directly in /sdk/usr/lib/swift/.
55+
if triple.isDarwin, let sdkPath = sdkPath.map(VirtualPath.lookup) {
5556
// If we added the secondary resource dir, we also need the iOSSupport directory.
5657
if secondaryResourceDir != nil {
5758
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
@@ -4767,6 +4767,9 @@ final class SwiftDriverTests: XCTestCase {
47674767
var driver = try Driver(args: ["swiftc", "foo.swift", "-sdk", "/"])
47684768
let plannedJobs = try driver.planBuild()
47694769
XCTAssertTrue(plannedJobs[0].commandLine.contains(subsequence: ["-sdk", .path(.absolute(.init("/")))]))
4770+
if !driver.targetTriple.isDarwin {
4771+
XCTAssertFalse(plannedJobs[2].commandLine.contains(subsequence: ["-L", .path(.absolute(.init("/usr/lib/swift")))]))
4772+
}
47704773
}
47714774

47724775
func testDumpASTOverride() throws {

0 commit comments

Comments
 (0)