Skip to content

Enable --gc-sections for WebAssembly targets #7356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kateinoigakukun
Copy link
Member

Enable --gc-sections back for WebAssembly targets

Motivation:

We disabled --gc-sections for Wasm targets due to a lack of features in the object file format. However, we recently added the missing piece in wasm object file format, so we no longer have any reason to disable it.

Modifications:

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.

Result:

Allow dead code stripping at link time for WebAssembly targets.

@MaxDesiatov MaxDesiatov added WebAssembly enhancement build system Changes to interactions with build systems needs tests This change needs test coverage labels Feb 21, 2024
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.
@kateinoigakukun kateinoigakukun force-pushed the yt/enable-gc-sections-wasm branch from 347cb33 to 17dc065 Compare February 21, 2024 16:06
@kateinoigakukun
Copy link
Member Author

@swift-ci Please test

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MaxDesiatov MaxDesiatov enabled auto-merge (squash) February 21, 2024 18:17
@MaxDesiatov MaxDesiatov merged commit 61d6215 into swiftlang:main Feb 21, 2024
@kateinoigakukun kateinoigakukun deleted the yt/enable-gc-sections-wasm branch February 22, 2024 03:24
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
Enable `--gc-sections` back for WebAssembly targets

### Motivation:

We disabled `--gc-sections` for Wasm targets due to a lack of features
in the object file format. However, we recently added the missing piece
in wasm object file format, so we no longer have any reason to disable
it.

### Modifications:

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.


### Result:

Allow dead code stripping at link time for WebAssembly targets.
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
Enable `--gc-sections` back for WebAssembly targets

### Motivation:

We disabled `--gc-sections` for Wasm targets due to a lack of features
in the object file format. However, we recently added the missing piece
in wasm object file format, so we no longer have any reason to disable
it.

### Modifications:

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.


### Result:

Allow dead code stripping at link time for WebAssembly targets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system Changes to interactions with build systems enhancement needs tests This change needs test coverage WebAssembly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants