forked from OSchip/llvm-project
[WebAssembly] Teach lld how to demangle "__main_argc_argv".
WebAssembly requires that caller and callee signatures match, so it can't do the usual trick of passing more arguments to main than it expects. Instead WebAssembly will mangle "main" with argc/argv parameters as "__main_argc_argv". This patch teaches lld how to demangle it. This patch is part of https://reviews.llvm.org/D70700.
This commit is contained in:
parent
c08384a3ae
commit
197bda587b
|
@ -29,6 +29,10 @@ std::string toString(const wasm::Symbol &sym) {
|
|||
}
|
||||
|
||||
std::string maybeDemangleSymbol(StringRef name) {
|
||||
// WebAssembly requires caller and callee signatures to match, so we mangle
|
||||
// `main` in the case where we need to pass it arguments.
|
||||
if (name == "__main_argc_argv")
|
||||
return "main";
|
||||
if (wasm::config->demangle)
|
||||
return demangleItanium(name);
|
||||
return std::string(name);
|
||||
|
|
Loading…
Reference in New Issue