Skip to content
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

Stop using --gc-sections for Wasm target to protect metadata sections #5638

Merged

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Jul 3, 2022

Stop using --gc-sections for Wasm target to protect metadata sections

Motivation:

Now wasm-ld strips data segments referenced through __start/__stop symbols
during GC, and it removes Swift metadata sections like swift5_protocols.
This option has been added in #4135

Modifications:

We should add support for SHF_GNU_RETAIN-like flag for attribute((retain))
to LLVM and wasm-ld.
For now, just disable section GC for Wasm target.

Context

Result:

Swift metadata sections are retained in the final executable in release configuration for Wasm target.

CC: @MaxDesiatov @keith

@kateinoigakukun
Copy link
Member Author

@swift-ci Please smoke test

Copy link
Member

@keith keith left a comment

Choose a reason for hiding this comment

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

seems good, we should definitely do that TODO for binary size sake

Now wasm-ld strips data segments referenced through __start/__stop symbols
during GC, and it removes Swift metadata sections like swift5_protocols
We should add support of SHF_GNU_RETAIN-like flag for __attribute__((retain))
to LLVM and wasm-ld. For now, just disable section GC for Wasm target.
@kateinoigakukun kateinoigakukun force-pushed the katei/void-gc-sections-on-wasm branch from 4f68200 to 9722969 Compare July 7, 2022 19:44
@kateinoigakukun
Copy link
Member Author

@swift-ci Please smoke test

@MaxDesiatov MaxDesiatov merged commit 3a366cc into swiftlang:main Jul 10, 2022
@kateinoigakukun kateinoigakukun deleted the katei/void-gc-sections-on-wasm branch July 10, 2022 09:58
kateinoigakukun added a commit to swiftwasm/swift-package-manager that referenced this pull request Jul 10, 2022
…ns (swiftlang#5638)

Now wasm-ld strips data segments referenced through __start/__stop symbols
during GC, and it removes Swift metadata sections like swift5_protocols
We should add support of SHF_GNU_RETAIN-like flag for __attribute__((retain))
to LLVM and wasm-ld. For now, just disable section GC for Wasm target.

Context:
llvm/llvm-project#55839
https://reviews.llvm.org/D126950#3558050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants