From 1be4bf9abcbea756d628beb870efb09e6fdcc1a8 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 15 May 2018 21:49:58 +0000 Subject: [WebAssembly] Provide WasmFunction content offset information. WasmObjectWriter mostly operates with function segments offsets that do not include their size fields. WasmObjectFile needs to have and provide this information to the lld to maintain proper R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocations entries. Patch by Yury Delendik Differential Revision: https://reviews.llvm.org/D46763 llvm-svn: 332406 --- llvm/lib/Object/WasmObjectFile.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'llvm/lib/Object/WasmObjectFile.cpp') diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 2a2f1652bd8..8b31c04a37a 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -875,6 +875,7 @@ Error WasmObjectFile::parseCodeSection(const uint8_t *Ptr, const uint8_t *End) { uint32_t Size = readVaruint32(Ptr); const uint8_t *FunctionEnd = Ptr + Size; + Function.CodeOffset = Ptr - FunctionStart; Function.Index = NumImportedFunctions + Functions.size(); Function.CodeSectionOffset = FunctionStart - CodeSectionStart; Function.Size = FunctionEnd - FunctionStart; -- cgit v1.2.3