HomePhabricator

[WebAssembly] New-style command support

Authored by sunfish on Sep 30 2020, 5:21 PM.

Description

[WebAssembly] New-style command support

This adds support for new-style command support. In this mode, all exports
are considered command entrypoints, and the linker inserts calls to
__wasm_call_ctors and __wasm_call_dtors for all such entrypoints.

This enables support for:

  • Command entrypoints taking arguments other than strings and return values other than int.
  • Multicall executables without requiring on the use of string-based command-line arguments.

This new behavior is disabled when the input has an explicit call to
__wasm_call_ctors, indicating code not expecting new-style command
support.

This change does mean that wasm-ld no longer supports DCE-ing the
__wasm_call_ctors function when there are no calls to it. If there are no
calls to it, and there are ctors present, we assume it's wasm-ld's job to
insert the calls. This seems ok though, because if there are ctors present,
the program is expecting them to be called. This change affects the
init-fini-gc.ll test.

Details

Committed
sunfishSep 30 2020, 7:02 PM
Parents
rGb656189e6a60: [flang][msvc] Avoid ReferenceVariantBase ctor ambiguity. NFC.
Branches
Unknown
Tags
Unknown