[all-commits] [llvm/llvm-project] 6cd851: [WebAssembly] New-style command support

Dan Gohman via All-commits all-commits at lists.llvm.org
Wed Sep 30 19:03:09 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6cd8511e5932e4a53b2bb7780f69489355fc7783
      https://github.com/llvm/llvm-project/commit/6cd8511e5932e4a53b2bb7780f69489355fc7783
  Author: Dan Gohman <dev at sunfishcode.online>
  Date:   2020-09-30 (Wed, 30 Sep 2020)

  Changed paths:
    A lld/test/wasm/command-exports-no-tors.s
    A lld/test/wasm/command-exports.s
    R lld/test/wasm/init-fini-gc.ll
    A lld/test/wasm/init-fini-no-gc.ll
    M lld/wasm/Driver.cpp
    M lld/wasm/InputChunks.h
    M lld/wasm/MarkLive.cpp
    M lld/wasm/Symbols.cpp
    M lld/wasm/Symbols.h
    M lld/wasm/Writer.cpp

  Log Message:
  -----------
  [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.




More information about the All-commits mailing list