[llvm] r326765 - [WebAssebmly] Remove reloc ordering constraint

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 5 23:13:10 PST 2018


Author: sbc
Date: Mon Mar  5 23:13:10 2018
New Revision: 326765

URL: http://llvm.org/viewvc/llvm-project?rev=326765&view=rev
Log:
[WebAssebmly] Remove reloc ordering constraint

The MC layer doesn't currently emit relocations in offset
order for the entire code section so this check was causing
failures on the wasm waterfall.

Perhaps we can re-instate this check if we divide the relocations
per-function, or add extra ordering the MC object writer.

Differential Revision: https://reviews.llvm.org/D44136

Modified:
    llvm/trunk/lib/Object/WasmObjectFile.cpp

Modified: llvm/trunk/lib/Object/WasmObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/WasmObjectFile.cpp?rev=326765&r1=326764&r2=326765&view=diff
==============================================================================
--- llvm/trunk/lib/Object/WasmObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/WasmObjectFile.cpp Mon Mar  5 23:13:10 2018
@@ -554,7 +554,6 @@ Error WasmObjectFile::parseRelocSection(
     return make_error<GenericBinaryError>("Invalid section code",
                                           object_error::parse_failed);
   uint32_t RelocCount = readVaruint32(Ptr);
-  uint32_t LastOffset = 0;
   uint32_t EndOffset = Section->Content.size();
   while (RelocCount--) {
     wasm::WasmRelocation Reloc = {};
@@ -600,10 +599,9 @@ Error WasmObjectFile::parseRelocSection(
     if (Reloc.Type == wasm::R_WEBASSEMBLY_TABLE_INDEX_I32 ||
         Reloc.Type == wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32)
       Size = 4;
-    if (Reloc.Offset < LastOffset || Reloc.Offset + Size > EndOffset)
+    if (Reloc.Offset + Size > EndOffset)
       return make_error<GenericBinaryError>("Bad relocation offset",
                                             object_error::parse_failed);
-    LastOffset = Reloc.Offset;
 
     Section->Relocations.push_back(Reloc);
   }




More information about the llvm-commits mailing list