[PATCH] D75277: [WebAssembly] Remove restriction on main name mangling

Sam Clegg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 11:35:26 PST 2020


sbc100 created this revision.
Herald added subscribers: cfe-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: clang.

Emscripten now handles/supports this new mode.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75277

Files:
  clang/lib/AST/Mangle.cpp
  clang/lib/CodeGen/CodeGenModule.cpp


Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -448,10 +448,8 @@
     CodeGenFunction(*this).EmitCfiCheckStub();
   }
   emitAtAvailableLinkGuard();
-  if (Context.getTargetInfo().getTriple().isWasm() &&
-      !Context.getTargetInfo().getTriple().isOSEmscripten()) {
+  if (Context.getTargetInfo().getTriple().isWasm())
     EmitMainVoidAlias();
-  }
   emitLLVMUsed();
   if (SanStats)
     SanStats->finish();
Index: clang/lib/AST/Mangle.cpp
===================================================================
--- clang/lib/AST/Mangle.cpp
+++ clang/lib/AST/Mangle.cpp
@@ -67,9 +67,7 @@
 
   // On wasm, the argc/argv form of "main" is renamed so that the startup code
   // can call it with the correct function signature.
-  // On Emscripten, users may be exporting "main" and expecting to call it
-  // themselves, so we can't mangle it.
-  if (Triple.isWasm() && !Triple.isOSEmscripten())
+  if (Triple.isWasm())
     if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND))
       if (FD->isMain() && FD->hasPrototype() && FD->param_size() == 2)
         return CCM_WasmMainArgcArgv;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75277.247042.patch
Type: text/x-patch
Size: 1238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200227/e0cefc02/attachment-0001.bin>


More information about the cfe-commits mailing list