diff options
-rw-r--r-- | lld/test/wasm/custom-sections.ll | 4 | ||||
-rw-r--r-- | lld/wasm/InputChunks.cpp | 10 | ||||
-rw-r--r-- | lld/wasm/InputChunks.h | 8 |
3 files changed, 7 insertions, 15 deletions
diff --git a/lld/test/wasm/custom-sections.ll b/lld/test/wasm/custom-sections.ll index 0b0bd5b4700..201653c272b 100644 --- a/lld/test/wasm/custom-sections.ll +++ b/lld/test/wasm/custom-sections.ll @@ -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 diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp index a1b3426888f..0cac19b3d4e 100644 --- a/lld/wasm/InputChunks.cpp +++ b/lld/wasm/InputChunks.cpp @@ -143,13 +143,3 @@ void InputFunction::setTableIndex(uint32_t Index) { 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); -} diff --git a/lld/wasm/InputChunks.h b/lld/wasm/InputChunks.h index 5b9b885f3c9..baff5e7834f 100644 --- a/lld/wasm/InputChunks.h +++ b/lld/wasm/InputChunks.h @@ -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 |