Skip to content

Commit

Permalink
Remove unused runtime library path on non-Darwin platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
finagolfin committed Jun 11, 2023
1 parent 79a9365 commit e8f7a89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ extension Toolchain {
result.append(path)
}

if let sdkPath = sdkPath.map(VirtualPath.lookup) {
// Only Darwin places libraries directly in /sdk/usr/lib/swift/.
if triple.isDarwin, let sdkPath = sdkPath.map(VirtualPath.lookup) {
// If we added the secondary resource dir, we also need the iOSSupport directory.
if secondaryResourceDir != nil {
result.append(sdkPath.appending(components: "System", "iOSSupport", "usr", "lib", "swift"))
Expand Down
3 changes: 3 additions & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4767,6 +4767,9 @@ final class SwiftDriverTests: XCTestCase {
var driver = try Driver(args: ["swiftc", "foo.swift", "-sdk", "/"])
let plannedJobs = try driver.planBuild()
XCTAssertTrue(plannedJobs[0].commandLine.contains(subsequence: ["-sdk", .path(.absolute(.init("/")))]))
if !driver.targetTriple.isDarwin {
XCTAssertFalse(plannedJobs[2].commandLine.contains(subsequence: ["-L", .path(.absolute(.init("/usr/lib/swift")))]))
}
}

func testDumpASTOverride() throws {
Expand Down

0 comments on commit e8f7a89

Please sign in to comment.