Skip to content

Commit 93c612e

Browse files
authored
Merge pull request #1211 from mhjacobson/freebsd-use-lld-not-gold
2 parents 032ccef + d0e27c7 commit 93c612e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import struct TSCBasic.AbsolutePath
1717

1818
extension GenericUnixToolchain {
1919
private func defaultLinker(for targetTriple: Triple) -> String? {
20-
if targetTriple.os == .openbsd || targetTriple.environment == .android {
20+
if targetTriple.os == .openbsd || targetTriple.os == .freeBSD ||
21+
targetTriple.environment == .android {
2122
return "lld"
2223
}
2324

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,14 @@ final class SwiftDriverTests: XCTestCase {
21042104
XCTAssertTrue(lastJob.commandLine.contains(subsequence: [.flag("-fuse-ld=lld"),
21052105
.flag("-Xlinker"), .flag("-z"), .flag("-Xlinker"), .flag("nostart-stop-gc")]))
21062106
}
2107+
2108+
do {
2109+
var driver = try Driver(args: commonArgs + ["-emit-library", "-target", "x86_64-unknown-freebsd"], env: env)
2110+
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
2111+
let lastJob = plannedJobs.last!
2112+
XCTAssertTrue(lastJob.tool.name.contains("clang"))
2113+
XCTAssertTrue(lastJob.commandLine.contains(.flag("-fuse-ld=lld")))
2114+
}
21072115
}
21082116

21092117
func testWebAssemblyUnsupportedFeatures() throws {

0 commit comments

Comments
 (0)