Skip to content

Commit f1dbbab

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

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
@@ -1042,11 +1042,11 @@ public final class ProductBuildDescription {
10421042
}
10431043
case .executable:
10441044
// Link the Swift stdlib statically, if requested.
1045-
//
1046-
// FIXME: This does not work for linux yet (SR-648).
10471045
if buildParameters.shouldLinkStaticSwiftStdlib {
10481046
if buildParameters.triple.isDarwin() {
10491047
diagnostics.emit(.swiftBackDeployError)
1048+
} else if buildParameters.triple.isLinux() {
1049+
args += ["-static-stdlib"]
10501050
}
10511051
}
10521052
args += ["-emit-executable"]

Tests/BuildTests/BuildPlanTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ final class BuildPlanTests: XCTestCase {
144144
let linkArguments = [
145145
"/fake/path/to/swiftc", "-L", "/path/to/build/debug",
146146
"-o", "/path/to/build/debug/exe", "-module-name", "exe",
147-
"-emit-executable",
147+
"-static-stdlib", "-emit-executable",
148148
"-Xlinker", "-rpath=$ORIGIN",
149149
"@/path/to/build/debug/exe.product/Objects.LinkFileList",
150150
"-target", defaultTargetTriple,

0 commit comments

Comments
 (0)