From 16f02431dc53af2b8acbc60d7cc1aafdad59a9f9 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Thu, 12 Nov 2020 15:05:05 -0800 Subject: [WebAssembly] Added R_WASM_FUNCTION_OFFSET_I64 for use with DWARF DW_AT_low_pc Needed for wasm64, see discussion in https://reviews.llvm.org/D91203 Differential Revision: https://reviews.llvm.org/D91395 --- llvm/lib/Object/WasmObjectFile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Object/WasmObjectFile.cpp') diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 63f2742..82aa1f5 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -876,6 +876,12 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { object_error::parse_failed); Reloc.Addend = readVarint32(Ctx); break; + case wasm::R_WASM_FUNCTION_OFFSET_I64: + if (!isValidFunctionSymbol(Reloc.Index)) + return make_error("Bad relocation function index", + object_error::parse_failed); + Reloc.Addend = readVarint64(Ctx); + break; case wasm::R_WASM_SECTION_OFFSET_I32: if (!isValidSectionSymbol(Reloc.Index)) return make_error("Bad relocation section index", @@ -903,7 +909,8 @@ Error WasmObjectFile::parseRelocSection(StringRef Name, ReadContext &Ctx) { Reloc.Type == wasm::R_WASM_GLOBAL_INDEX_I32) Size = 4; if (Reloc.Type == wasm::R_WASM_TABLE_INDEX_I64 || - Reloc.Type == wasm::R_WASM_MEMORY_ADDR_I64) + Reloc.Type == wasm::R_WASM_MEMORY_ADDR_I64 || + Reloc.Type == wasm::R_WASM_FUNCTION_OFFSET_I64) Size = 8; if (Reloc.Offset + Size > EndOffset) return make_error("Bad relocation offset", -- cgit v1.1