From d1152a267cb1e9d4f5793d5324a785f8d6ffa8a8 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 4 Feb 2019 17:28:46 +0000 Subject: [WebAssembly] Rename relocations from R_WEBASSEMBLY_ to R_WASM_ See https://github.com/WebAssembly/tool-conventions/pull/95. This is less typing and IMHO more readable, and it also fits with our naming around the binary format which tends to use the short name. e.g. include/llvm/BinaryFormat/Wasm.h tools/llvm-objdump/WasmDump.cpp etc.. Differential Revision: https://reviews.llvm.org/D57611 llvm-svn: 353062 --- llvm/lib/Object/WasmObjectFile.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'llvm/lib/Object/WasmObjectFile.cpp') diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index d2421cb95ee..21b4604f799 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -719,43 +719,43 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { PreviousOffset = Reloc.Offset; Reloc.Index = readVaruint32(Ctx); switch (Reloc.Type) { - case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB: - case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB: - case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32: + case wasm::R_WASM_FUNCTION_INDEX_LEB: + case wasm::R_WASM_TABLE_INDEX_SLEB: + case wasm::R_WASM_TABLE_INDEX_I32: if (!isValidFunctionSymbol(Reloc.Index)) return make_error("Bad relocation function index", object_error::parse_failed); break; - case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB: + case wasm::R_WASM_TYPE_INDEX_LEB: if (Reloc.Index >= Signatures.size()) return make_error("Bad relocation type index", object_error::parse_failed); break; - case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB: + case wasm::R_WASM_GLOBAL_INDEX_LEB: if (!isValidGlobalSymbol(Reloc.Index)) return make_error("Bad relocation global index", object_error::parse_failed); break; - case wasm::R_WEBASSEMBLY_EVENT_INDEX_LEB: + case wasm::R_WASM_EVENT_INDEX_LEB: if (!isValidEventSymbol(Reloc.Index)) return make_error("Bad relocation event index", object_error::parse_failed); break; - case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB: - case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB: - case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32: + case wasm::R_WASM_MEMORY_ADDR_LEB: + case wasm::R_WASM_MEMORY_ADDR_SLEB: + case wasm::R_WASM_MEMORY_ADDR_I32: if (!isValidDataSymbol(Reloc.Index)) return make_error("Bad relocation data index", object_error::parse_failed); Reloc.Addend = readVarint32(Ctx); break; - case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32: + case wasm::R_WASM_FUNCTION_OFFSET_I32: if (!isValidFunctionSymbol(Reloc.Index)) return make_error("Bad relocation function index", object_error::parse_failed); Reloc.Addend = readVarint32(Ctx); break; - case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32: + case wasm::R_WASM_SECTION_OFFSET_I32: if (!isValidSectionSymbol(Reloc.Index)) return make_error("Bad relocation section index", object_error::parse_failed); @@ -771,10 +771,10 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { // also shouldn't overlap a function/element boundary, but we don't bother // to check that. uint64_t Size = 5; - if (Reloc.Type == wasm::R_WEBASSEMBLY_TABLE_INDEX_I32 || - Reloc.Type == wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32 || - Reloc.Type == wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32 || - Reloc.Type == wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32) + if (Reloc.Type == wasm::R_WASM_TABLE_INDEX_I32 || + Reloc.Type == wasm::R_WASM_MEMORY_ADDR_I32 || + Reloc.Type == wasm::R_WASM_SECTION_OFFSET_I32 || + Reloc.Type == wasm::R_WASM_FUNCTION_OFFSET_I32) Size = 4; if (Reloc.Offset + Size > EndOffset) return make_error("Bad relocation offset", @@ -1419,7 +1419,7 @@ uint64_t WasmObjectFile::getRelocationOffset(DataRefImpl Ref) const { symbol_iterator WasmObjectFile::getRelocationSymbol(DataRefImpl Ref) const { const wasm::WasmRelocation &Rel = getWasmRelocation(Ref); - if (Rel.Type == wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB) + if (Rel.Type == wasm::R_WASM_TYPE_INDEX_LEB) return symbol_end(); DataRefImpl Sym; Sym.d.a = 1; -- cgit v1.2.3