Skip to content

Commit 73609f9

Browse files
authored
Enable -static-stdlib on Linux (swiftlang#2921)
https://bugs.swift.org/browse/SR-648 has been resolved, so we can enable this flag on Linux
1 parent b5d188f commit 73609f9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/Build/BuildPlan.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,11 +1091,11 @@ public final class ProductBuildDescription {
10911091
}
10921092
case .executable:
10931093
// Link the Swift stdlib statically, if requested.
1094-
//
1095-
// FIXME: This does not work for linux yet (SR-648).
10961094
if buildParameters.shouldLinkStaticSwiftStdlib {
10971095
if buildParameters.triple.isDarwin() {
10981096
diagnostics.emit(.swiftBackDeployError)
1097+
} else if buildParameters.triple.isLinux() {
1098+
args += ["-static-stdlib"]
10991099
}
11001100
}
11011101
args += ["-emit-executable"]

Tests/BuildTests/BuildPlanTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ final class BuildPlanTests: XCTestCase {
150150
let linkArguments = [
151151
"/fake/path/to/swiftc", "-L", "/path/to/build/debug",
152152
"-o", "/path/to/build/debug/exe", "-module-name", "exe",
153-
"-emit-executable",
153+
"-static-stdlib", "-emit-executable",
154154
"-Xlinker", "-rpath=$ORIGIN",
155155
"@/path/to/build/debug/exe.product/Objects.LinkFileList",
156156
"-target", defaultTargetTriple,

0 commit comments

Comments
 (0)