emscripten-core / emscripten-core/emscripten

Is there a way to suppress --strip-target-features?

Open
#20,903 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

The emscripten linker appears to always strip the target_features custom section when linking, see https://github.com/emscripten-core/emscripten/blob/c54ebd73e383742e1e94729d863f97f23cfa8ff0/tools/link.py#L369
But according to https://github.com/dotnet/runtime/issues/94804#issuecomment-1819258475 one of our scenarios would benefit from this section, so that wasm-opt will be able to automatically sense which features were enabled at build time.
Is there a way to keep this section that I'm missing, other than suppressing optimization? If we need it should we add it back ourselves after the link?
The target_features section doesn't seem like it would be very big, so it's kind of unfortunate if there's no way to keep it when our binaries are upwards of a megabyte anyway. Right now we have to manually pick the right flags to pass to wasm-opt when we invoke it, which is inconvenient, so if we could just rely on always having this section it would also simplify our build pipeline while it enables the scenario mentioned before.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.