Skip to content

Commit 1e0c92f

Browse files
committed
Revert "Work around lld 13+ issue with --gc-sections for ELF by adding -z nostart-stop-gc"
This reverts c771555, now that it was properly fixed in swiftlang/swift#72061.
1 parent b385bbf commit 1e0c92f

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,6 @@ extension GenericUnixToolchain {
8989
#else
9090
commandLine.appendFlag("-fuse-ld=\(linker)")
9191
#endif
92-
// Starting with lld 13, Swift stopped working with the lld
93-
// --gc-sections implementation for ELF, unless -z nostart-stop-gc is
94-
// also passed to lld:
95-
//
96-
// https://reviews.llvm.org/D96914
97-
if linker == "lld" || linker.hasSuffix("ld.lld") {
98-
commandLine.appendFlag(.Xlinker)
99-
commandLine.appendFlag("-z")
100-
commandLine.appendFlag(.Xlinker)
101-
commandLine.appendFlag("nostart-stop-gc")
102-
}
10392
}
10493

10594
if let arg = parsedOptions.getLastArgument(.ldPath)?.asSingle {

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,8 +2372,7 @@ final class SwiftDriverTests: XCTestCase {
23722372
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs()
23732373
let lastJob = plannedJobs.last!
23742374
XCTAssertTrue(lastJob.tool.name.contains("clang"))
2375-
XCTAssertTrue(lastJob.commandLine.contains(subsequence: [.flag("-fuse-ld=lld"),
2376-
.flag("-Xlinker"), .flag("-z"), .flag("-Xlinker"), .flag("nostart-stop-gc")]))
2375+
XCTAssertTrue(lastJob.commandLine.contains(.flag("-fuse-ld=lld")))
23772376
}
23782377

23792378
do {

0 commit comments

Comments
 (0)