Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused runtime library path on non-Darwin platforms #1374

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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) {
finagolfin marked this conversation as resolved.
Show resolved Hide resolved
// 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