From 03801256d86eb0d22dc7d489ed4ec0eec9ace6b6 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 12 Dec 2018 23:40:58 +0000 Subject: [WebAssembly] Update dylink section parsing This updates the format of the dylink section in accordance with recent "spec" change: https://github.com/WebAssembly/tool-conventions/pull/77 Differential Revision: https://reviews.llvm.org/D55609 llvm-svn: 348989 --- llvm/lib/Object/WasmObjectFile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/Object/WasmObjectFile.cpp') diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 895d45c470f..1a687d94d7f 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -319,6 +319,10 @@ Error WasmObjectFile::parseDylinkSection(ReadContext &Ctx) { DylinkInfo.MemoryAlignment = readVaruint32(Ctx); DylinkInfo.TableSize = readVaruint32(Ctx); DylinkInfo.TableAlignment = readVaruint32(Ctx); + uint32_t Count = readVaruint32(Ctx); + while (Count--) { + DylinkInfo.Needed.push_back(readString(Ctx)); + } if (Ctx.Ptr != Ctx.End) return make_error("dylink section ended prematurely", object_error::parse_failed); @@ -1405,6 +1409,8 @@ SubtargetFeatures WasmObjectFile::getFeatures() const { bool WasmObjectFile::isRelocatableObject() const { return HasLinkingSection; } +bool WasmObjectFile::isSharedObject() const { return HasDylinkSection; } + const WasmSection &WasmObjectFile::getWasmSection(DataRefImpl Ref) const { assert(Ref.d.a < Sections.size()); return Sections[Ref.d.a]; -- cgit v1.2.3