diff options
author | Paulo Matos <pmatos@igalia.com> | 2020-10-23 08:36:06 -0700 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2020-10-23 08:42:54 -0700 |
commit | 69e2797eaed5b9db969fb4ff5e40530a7122b3a3 (patch) | |
tree | 3b987ba96bce3ae10bd2271fcb7e6d139c0f1d9b /llvm/lib/Object/WasmObjectFile.cpp | |
parent | e7d37742a2a584fef9002778b33f9453647ab43c (diff) | |
download | llvm-69e2797eaed5b9db969fb4ff5e40530a7122b3a3.zip llvm-69e2797eaed5b9db969fb4ff5e40530a7122b3a3.tar.gz llvm-69e2797eaed5b9db969fb4ff5e40530a7122b3a3.tar.bz2 |
[WebAssembly] Implementation of (most) table instructions
Implementation of instructions table.get, table.set, table.grow,
table.size, table.fill, table.copy.
Missing instructions are table.init and elem.drop as they deal with
element sections which are not yet implemented.
Added more tests to tables.s
Differential Revision: https://reviews.llvm.org/D89797
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 107a9ef..f8ca654 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -822,6 +822,11 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { return make_error<GenericBinaryError>("Bad relocation function index", object_error::parse_failed); break; + case wasm::R_WASM_TABLE_NUMBER_LEB: + if (!isValidTableSymbol(Reloc.Index)) + return make_error<GenericBinaryError>("Bad relocation table index", + object_error::parse_failed); + break; case wasm::R_WASM_TYPE_INDEX_LEB: if (Reloc.Index >= Signatures.size()) return make_error<GenericBinaryError>("Bad relocation type index", @@ -1181,6 +1186,10 @@ bool WasmObjectFile::isValidFunctionSymbol(uint32_t Index) const { return Index < Symbols.size() && Symbols[Index].isTypeFunction(); } +bool WasmObjectFile::isValidTableSymbol(uint32_t Index) const { + return Index < Symbols.size() && Symbols[Index].isTypeTable(); +} + bool WasmObjectFile::isValidGlobalSymbol(uint32_t Index) const { return Index < Symbols.size() && Symbols[Index].isTypeGlobal(); } |