[PATCH] D47204: [WebAssembly] Properly calculate function body offset, and write I32 values.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 10:11:46 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD333002: [WebAssembly] Fix two bugs in LEB compression: properly calculate function body… (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47204?vs=148027&id=148043#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47204

Files:
  wasm/InputChunks.cpp


Index: wasm/InputChunks.cpp
===================================================================
--- wasm/InputChunks.cpp
+++ wasm/InputChunks.cpp
@@ -195,6 +195,7 @@
     return encodeSLEB128(static_cast<int32_t>(Value), Buf);
   case R_WEBASSEMBLY_TABLE_INDEX_I32:
   case R_WEBASSEMBLY_MEMORY_ADDR_I32:
+    write32le(Buf, Value);
     return 4;
   default:
     llvm_unreachable("unknown relocation type");
@@ -279,7 +280,7 @@
   const uint8_t *FuncStart = SecStart + getInputSectionOffset();
   const uint8_t *End = FuncStart + Function->Size;
   uint32_t Count;
-  decodeULEB128(Buf, &Count);
+  decodeULEB128(FuncStart, &Count);
   FuncStart += Count;
 
   DEBUG(dbgs() << "write func: " << getName() << "\n");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47204.148043.patch
Type: text/x-patch
Size: 717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/1b93d62a/attachment.bin>


More information about the llvm-commits mailing list