[PATCH] D70700: [WebAssembly] Mangle the argc/argv `main` as `__wasm_argc_argv`

Dan Gohman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 25 15:42:29 PST 2019


sunfish created this revision.
Herald added subscribers: llvm-commits, dexonsmith, aheejin, jgravelle-google, sbc100, mehdi_amini, dschuff.
Herald added projects: clang, LLVM.

WebAssembly enforces a rule that caller and callee signatures must
match. This means that the traditional technique of passing `main`
`argc` and `argv` even when it doesn't need them doesn't work.

Currently the backend renames `main` to `__original_main`, however this
doesn't interact well with LTO'ing libc, and the name isn't intuitive.
This patch allows us to transition to `__main_argc_argv` instead.

This is currently being discussed in https://github.com/WebAssembly/tool-conventions/pull/134.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70700

Files:
  clang/lib/AST/Mangle.cpp
  clang/lib/Frontend/InitHeaderSearch.cpp
  clang/test/CodeGen/wasm-call-main.c
  clang/test/CodeGen/wasm-main.c
  clang/test/CodeGen/wasm-main_argc_argv.c
  llvm/include/llvm/ADT/Triple.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70700.230983.patch
Type: text/x-patch
Size: 3604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191125/c4cdedb9/attachment.bin>


More information about the cfe-commits mailing list