[PATCH] D42024: [WebAssembly] Create synthetic __dso_handle symbol

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 18:02:39 PST 2018


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff, jfb.

This is used by __cxa_ataxit to determine the currently
executing DLL.  Once we fully support DLLs this will need
to be set to some address within the DLL.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42024

Files:
  wasm/Driver.cpp


Index: wasm/Driver.cpp
===================================================================
--- wasm/Driver.cpp
+++ wasm/Driver.cpp
@@ -299,9 +299,18 @@
     for (auto* Arg : Args.filtered(OPT_undefined))
       addSyntheticUndefinedFunction(Arg->getValue(), nullptr);
 
+    // Create linker-synthetic symbols
+    // __wasm_call_ctors:
+    //    Function that directly calls all ctors in priority order.
+    // __stack_pointer:
+    //    Wasm global that holds the address of the top of the explict
+    //    value stack in linear memory.
+    // __dso_handle;
+    //    Global used by __cxa_atexit to determine current DLL
     Config->CtorSymbol = Symtab->addDefinedFunction(
         "__wasm_call_ctors", &Signature, WASM_SYMBOL_VISIBILITY_HIDDEN);
     Config->StackPointerSymbol = Symtab->addDefinedGlobal("__stack_pointer");
+    Symtab->addDefinedGlobal("__dso_handle")->setVirtualAddress(0);
   }
 
   createFiles(Args);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42024.129743.patch
Type: text/x-patch
Size: 935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180113/4c2c410c/attachment.bin>


More information about the llvm-commits mailing list