[PATCH] D45580: [WebAssembly] Match llvm change to custom section size

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 13:36:03 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL329948: [WebAssembly] Match llvm change to custom section size (authored by sbc, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D45580

Files:
  lld/trunk/test/wasm/custom-sections.ll
  lld/trunk/wasm/InputChunks.cpp
  lld/trunk/wasm/InputChunks.h


Index: lld/trunk/test/wasm/custom-sections.ll
===================================================================
--- lld/trunk/test/wasm/custom-sections.ll
+++ lld/trunk/test/wasm/custom-sections.ll
@@ -16,7 +16,7 @@
 
 ; CHECK:        - Type:            CUSTOM
 ; CHECK-NEXT:     Name:            green
-; CHECK-NEXT:     Payload:         '05677265656E626172717578'
+; CHECK-NEXT:     Payload:         '626172717578'
 ; CHECK-NEXT:   - Type:            CUSTOM
 ; CHECK-NEXT:     Name:            red
-; CHECK-NEXT:     Payload:         037265646578747261666F6F
+; CHECK-NEXT:     Payload:         6578747261666F6F
Index: lld/trunk/wasm/InputChunks.cpp
===================================================================
--- lld/trunk/wasm/InputChunks.cpp
+++ lld/trunk/wasm/InputChunks.cpp
@@ -143,13 +143,3 @@
   assert(!hasTableIndex());
   TableIndex = Index;
 }
-
-InputSection::InputSection(const WasmSection &S, ObjFile *F)
-    : InputChunk(F, InputChunk::Section), Section(S) {
-  assert(Section.Type == llvm::wasm::WASM_SEC_CUSTOM);
-  // TODO check LEB errors
-  unsigned Count;
-  uint64_t NameSize = llvm::decodeULEB128(Section.Content.data(), &Count);
-  uint32_t PayloadOffset = Count + NameSize;
-  Payload = Section.Content.slice(PayloadOffset);
-}
Index: lld/trunk/wasm/InputChunks.h
===================================================================
--- lld/trunk/wasm/InputChunks.h
+++ lld/trunk/wasm/InputChunks.h
@@ -176,20 +176,22 @@
 // Represents a single Wasm Section within an input file.
 class InputSection : public InputChunk {
 public:
-  InputSection(const WasmSection &S, ObjFile *F);
+  InputSection(const WasmSection &S, ObjFile *F)
+      : InputChunk(F, InputChunk::Section), Section(S) {
+    assert(Section.Type == llvm::wasm::WASM_SEC_CUSTOM);
+  }
 
   StringRef getName() const override { return Section.Name; }
   uint32_t getComdat() const override { return UINT32_MAX; }
 
 protected:
-  ArrayRef<uint8_t> data() const override { return Payload; }
+  ArrayRef<uint8_t> data() const override { return Section.Content; }
 
   // Offset within the input section.  This is only zero since this chunk
   // type represents an entire input section, not part of one.
   uint32_t getInputSectionOffset() const override { return 0; }
 
   const WasmSection &Section;
-  ArrayRef<uint8_t> Payload;
 };
 
 } // namespace wasm


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45580.142253.patch
Type: text/x-patch
Size: 2362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180412/ce9f755f/attachment.bin>


More information about the llvm-commits mailing list