Skip to content

[wasm-split] Support --no-placeholders option in multi-split#7789

Merged
aheejin merged 2 commits intoWebAssembly:mainfrom
aheejin:multi_split_placeholders
Aug 5, 2025
Merged

[wasm-split] Support --no-placeholders option in multi-split#7789
aheejin merged 2 commits intoWebAssembly:mainfrom
aheejin:multi_split_placeholders

Conversation

@aheejin
Copy link
Copy Markdown
Member

@aheejin aheejin commented Aug 5, 2025

This supports --no-placeholders option with --multi-split. Currently --multi-split does not accept --no-placeholders option and set it to true by default internally.

Because --no-placeholders is false by default and this has been the case for the default two-way split, this means this PR is a breaking change for multi-split users.

.add(
"--no-placeholders",
"",
"Do not import placeholder functions. Calls to secondary functions will "
"fail before the secondary module has been instantiated.",
WasmSplitOption,
{Mode::Split},
Options::Arguments::Zero,
[&](Options* o, const std::string& argument) { usePlaceholders = false; })

But it will be inconsistent if we set the option by default to true in case of two-way split and false in case of multi-split.

About the test:

  • This changes CHECK-A, CHECK-B, and CHECK-C to MOD1, MOD2, and MOD3
  • Because previously --no-placeholders was the default, the expectation lines for PRIMARY didn't have any placeholders. Now it does.
  • ***-OPTIONS check lines now test both options, --import-namespace and --no-placeholders.

This supports `--no-placeholders` option with `--multi-split`. Currently
`--multi-split` does not accept `--no-placeholders` option and set it to
true by default internally.

Because `--no-placeholders` is false by default and this has been the
case for the default two-way split, this means this PR is a breaking
change for multi-split users.
https://github.com/WebAssembly/binaryen/blob/8ad26cbaca2a3a8982789b25d9a279dc26e85f15/src/tools/wasm-split/split-options.cpp#L210-L218

But it will be inconsistent if we set the option by default to true in
case of two-way split and false in case of multi-split.

About the test:
- This changes `CHECK-A`, `CHECK-B`, and `CHECK-C` to `MOD1`, `MOD2`,
  and `MOD3`
- Because previously `--no-placeholders` was the default, the
  expectation lines for `PRIMARY` didn't have any placeholders. Now it
  does.
- `***-OPTIONS` check lines now test both options, `--import-namespace`
  and `--no-placeholders`.
@aheejin aheejin requested a review from tlively August 5, 2025 01:31
@tlively
Copy link
Copy Markdown
Member

tlively commented Aug 5, 2025

The breaking change should be fine, since AFAIK this has no production users (yet).

@aheejin aheejin merged commit 9f93631 into WebAssembly:main Aug 5, 2025
16 checks passed
@aheejin aheejin deleted the multi_split_placeholders branch August 5, 2025 03:00
@aheejin
Copy link
Copy Markdown
Member Author

aheejin commented Aug 5, 2025

cc @biggs0125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants