[PATCH] D42237: [WebAssembly] Symbol changes #4b: export stack-pointer, LLD only

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 15:59:32 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD322911: [WebAssembly] Export the stack pointer when using --emit-relocs (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42237?vs=130378&id=130515#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42237

Files:
  test/wasm/stack-pointer.ll
  wasm/Writer.cpp


Index: test/wasm/stack-pointer.ll
===================================================================
--- test/wasm/stack-pointer.ll
+++ test/wasm/stack-pointer.ll
@@ -58,6 +58,9 @@
 ; CHECK-NEXT:       - Name:            __wasm_call_ctors
 ; CHECK-NEXT:         Kind:            FUNCTION
 ; CHECK-NEXT:         Index:           1
+; CHECK-NEXT:       - Name:            __stack_pointer
+; CHECK-NEXT:         Kind:            GLOBAL
+; CHECK-NEXT:         Index:           0
 ; CHECK-NEXT:       - Name:            __heap_base
 ; CHECK-NEXT:         Kind:            GLOBAL
 ; CHECK-NEXT:         Index:           1
Index: wasm/Writer.cpp
===================================================================
--- wasm/Writer.cpp
+++ wasm/Writer.cpp
@@ -659,9 +659,12 @@
   }
 
   for (const Symbol *Sym : DefinedGlobals) {
-    // Can't export the SP right now because it's mutable and mutable globals
-    // cannot be exported.
-    if (Sym == Config->StackPointerSymbol)
+    // Can't export the SP right now because its mutable, and mutuable globals
+    // are yet supported in the official binary format.  However, for
+    // intermediate output we need to export it in case it is the target of any
+    // relocations.
+    // TODO(sbc): Remove this if/when the "mutable global" proposal is accepted.
+    if (Sym == Config->StackPointerSymbol && !Config->EmitRelocs)
       continue;
     ExportedSymbols.emplace_back(WasmExportEntry{Sym, BudgeLocalName(Sym)});
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42237.130515.patch
Type: text/x-patch
Size: 1475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180118/7879925a/attachment.bin>


More information about the llvm-commits mailing list