File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1334,12 +1334,17 @@ public final class ProductBuildDescription {
1334
1334
return [ " -Xlinker " , " -dead_strip " ]
1335
1335
} else if buildParameters. triple. isWindows ( ) {
1336
1336
return [ " -Xlinker " , " /OPT:REF " ]
1337
- } else {
1338
- // FIXME: wasm-ld / ld.lld strips data segments referenced through __start/__stop symbols
1337
+ } else if buildParameters . triple . arch == . wasm32 {
1338
+ // FIXME: wasm-ld strips data segments referenced through __start/__stop symbols
1339
1339
// during GC, and it removes Swift metadata sections like swift5_protocols
1340
1340
// We should add support of SHF_GNU_RETAIN-like flag for __attribute__((retain))
1341
1341
// to LLVM and wasm-ld
1342
+ // This workaround is required for not only WASI but also all WebAssembly archs
1343
+ // using wasm-ld (e.g. wasm32-unknown-unknown). So this branch is conditioned by
1344
+ // arch == .wasm32
1342
1345
return [ ]
1346
+ } else {
1347
+ return [ " -Xlinker " , " --gc-sections " ]
1343
1348
}
1344
1349
}
1345
1350
}
Original file line number Diff line number Diff line change @@ -446,6 +446,7 @@ final class BuildPlanTests: XCTestCase {
446
446
" -o " , buildPath. appending ( components: " exe " ) . pathString,
447
447
" -module-name " , " exe " ,
448
448
" -emit-executable " ,
449
+ " -Xlinker " , " --gc-sections " ,
449
450
" -Xlinker " , " -rpath=$ORIGIN " ,
450
451
" @ \( buildPath. appending ( components: " exe.product " , " Objects.LinkFileList " ) ) " ,
451
452
" -target " , defaultTargetTriple,
You can’t perform that action at this time.
0 commit comments