[lld] r329948 - [WebAssembly] Match llvm change to custom section size

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 13:31:36 PDT 2018


Author: sbc
Date: Thu Apr 12 13:31:35 2018
New Revision: 329948

URL: http://llvm.org/viewvc/llvm-project?rev=329948&view=rev
Log:
[WebAssembly] Match llvm change to custom section size

Summary:
The content of custome sections no longer includes the
name itself.

See: https://reviews.llvm.org/D45579

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

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

Modified: lld/trunk/test/wasm/custom-sections.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/custom-sections.ll?rev=329948&r1=329947&r2=329948&view=diff
==============================================================================
--- lld/trunk/test/wasm/custom-sections.ll (original)
+++ lld/trunk/test/wasm/custom-sections.ll Thu Apr 12 13:31:35 2018
@@ -16,7 +16,7 @@ entry:
 
 ; 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

Modified: lld/trunk/wasm/InputChunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputChunks.cpp?rev=329948&r1=329947&r2=329948&view=diff
==============================================================================
--- lld/trunk/wasm/InputChunks.cpp (original)
+++ lld/trunk/wasm/InputChunks.cpp Thu Apr 12 13:31:35 2018
@@ -143,13 +143,3 @@ void InputFunction::setTableIndex(uint32
   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);
-}

Modified: lld/trunk/wasm/InputChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputChunks.h?rev=329948&r1=329947&r2=329948&view=diff
==============================================================================
--- lld/trunk/wasm/InputChunks.h (original)
+++ lld/trunk/wasm/InputChunks.h Thu Apr 12 13:31:35 2018
@@ -176,20 +176,22 @@ protected:
 // 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




More information about the llvm-commits mailing list