[PATCH] D43723: [WebAssembly] Minor cleanup -- do not use Config->Relocatable twice.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 23 21:37:22 PST 2018


ruiu created this revision.
ruiu added a reviewer: sbc100.
Herald added subscribers: sunfish, aheejin, jgravelle-google, dschuff, jfb.

[WebAssembly] Minor cleanup -- do not use Config->Relocatable twice.


https://reviews.llvm.org/D43723

Files:
  lld/wasm/Writer.cpp


Index: lld/wasm/Writer.cpp
===================================================================
--- lld/wasm/Writer.cpp
+++ lld/wasm/Writer.cpp
@@ -578,6 +578,7 @@
     debugPrint("mem: global base = %d\n", Config->GlobalBase);
   }
 
+  uint32_t DataStart = MemoryPtr;
   createOutputSegments();
 
   // Arbitrarily set __dso_handle handle to point to the start of the data
@@ -597,9 +598,7 @@
   if (WasmSym::DataEnd)
     WasmSym::DataEnd->setVirtualAddress(MemoryPtr);
 
-  DataSize = MemoryPtr;
-  if (!Config->Relocatable)
-    DataSize -= Config->GlobalBase;
+  DataSize = MemoryPtr - DataStart;
   debugPrint("mem: static data = %d\n", DataSize);
 
   // Stack comes after static data and bss


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43723.135780.patch
Type: text/x-patch
Size: 700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180224/5ac57858/attachment.bin>


More information about the llvm-commits mailing list