[PATCH] D42539: [WebAssembly] Handle relocations where provisional value != index

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 07:42:34 PST 2018


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

Since https://reviews.llvm.org/rLLD323168, we have relocations where the provisional value is not the same as the symbol index. Thus, we now need to remove the assertion that the provisional value matches the symbol index.

This //was// in a previous review, but somehow the chunk was dropped in the final commits - it could perfectly well have been my fault during a rebase though.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42539

Files:
  wasm/InputChunks.cpp


Index: wasm/InputChunks.cpp
===================================================================
--- wasm/InputChunks.cpp
+++ wasm/InputChunks.cpp
@@ -47,16 +47,16 @@
   int64_t ExistingValue;
   switch (Reloc.Reloc.Type) {
   case R_WEBASSEMBLY_TYPE_INDEX_LEB:
-  case R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
-  case R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
     ExistingValue = decodeULEB128(Buf);
     // Additional check to verify that the existing value that the location
     // matches our expectations.
     if (ExistingValue != Reloc.Reloc.Index) {
       DEBUG(dbgs() << "existing value: " << decodeULEB128(Buf) << "\n");
       assert(decodeULEB128(Buf) == Reloc.Reloc.Index);
     }
     LLVM_FALLTHROUGH;
+  case R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
+  case R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
   case R_WEBASSEMBLY_MEMORY_ADDR_LEB:
     encodeULEB128(Reloc.Value, Buf, 5);
     break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42539.131449.patch
Type: text/x-patch
Size: 876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180125/db2ab28f/attachment.bin>


More information about the llvm-commits mailing list