Skip to content

Commit 347cb33

Browse files
Enable --gc-sections for WebAssembly targets
This effectively reverts 3a366cc. After swiftlang/swift#71768, we don't have any reason to disable `--gc-sections` for WebAssembly targets. Note that the new wasm segment flags are only supported by the latest LLVM and wasm-ld, but we can assume that toolchains or Swift SDKs for WebAssembly have wasm-ld built from the latest LLVM.
1 parent adfbd9a commit 347cb33

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

Sources/Build/BuildDescription/ProductBuildDescription.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,6 @@ public final class ProductBuildDescription: SPMBuildCore.ProductBuildDescription
119119
return ["-Xlinker", "-dead_strip"]
120120
} else if triple.isWindows() {
121121
return ["-Xlinker", "/OPT:REF"]
122-
} else if triple.arch == .wasm32 {
123-
// FIXME: wasm-ld strips data segments referenced through __start/__stop symbols
124-
// during GC, and it removes Swift metadata sections like swift5_protocols
125-
// We should add support of SHF_GNU_RETAIN-like flag for __attribute__((retain))
126-
// to LLVM and wasm-ld
127-
// This workaround is required for not only WASI but also all WebAssembly triples
128-
// using wasm-ld (e.g. wasm32-unknown-unknown). So this branch is conditioned by
129-
// arch == .wasm32
130-
return []
131122
} else {
132123
return ["-Xlinker", "--gc-sections"]
133124
}

0 commit comments

Comments
 (0)