parent\parent\Common\Compiler\ObjectWriter\WasmRelocatableObjectWriter.cs (33)
393WasmRelocationType type = reloc.Type switch
395RelocType.WASM_FUNCTION_INDEX_LEB => WasmRelocationType.FunctionIndexLeb,
396RelocType.WASM_TYPE_INDEX_LEB => WasmRelocationType.TypeIndexLeb,
397RelocType.WASM_GLOBAL_INDEX_LEB => WasmRelocationType.GlobalIndexLeb,
398RelocType.WASM_TABLE_INDEX_SLEB => WasmRelocationType.TableIndexSleb,
399RelocType.WASM_TABLE_INDEX_I32 => WasmRelocationType.TableIndexI32,
400RelocType.WASM_TABLE_INDEX_I64 => WasmRelocationType.TableIndexI64,
401RelocType.WASM_MEMORY_ADDR_LEB => WasmRelocationType.MemoryAddrLeb,
402RelocType.WASM_MEMORY_ADDR_SLEB when isFunction => WasmRelocationType.TableIndexSleb,
403RelocType.WASM_MEMORY_ADDR_SLEB => WasmRelocationType.MemoryAddrSleb,
404RelocType.WASM_MEMORY_ADDR_REL_SLEB when isFunction => WasmRelocationType.TableIndexSleb,
405RelocType.WASM_MEMORY_ADDR_REL_SLEB => WasmRelocationType.MemoryAddrRelSleb,
406RelocType.IMAGE_REL_BASED_HIGHLOW when isFunction && section is WasmCustomSection => WasmRelocationType.FunctionOffsetI32,
407RelocType.IMAGE_REL_BASED_HIGHLOW when isSection => WasmRelocationType.SectionOffsetI32,
408RelocType.IMAGE_REL_BASED_HIGHLOW when isFunction => WasmRelocationType.TableIndexI32,
409RelocType.IMAGE_REL_BASED_HIGHLOW => WasmRelocationType.MemoryAddrI32,
410RelocType.IMAGE_REL_BASED_DIR64 => WasmRelocationType.MemoryAddrI64,
411RelocType.IMAGE_REL_BASED_RELPTR32 => WasmRelocationType.MemoryAddrLocrelI32,
415if (isFunction && type != WasmRelocationType.FunctionOffsetI32 && addend != 0)
424bool hasAddend = type is WasmRelocationType.MemoryAddrLeb or WasmRelocationType.MemoryAddrSleb or
425WasmRelocationType.MemoryAddrI32 or WasmRelocationType.MemoryAddrI64 or
426WasmRelocationType.FunctionOffsetI32 or WasmRelocationType.SectionOffsetI32 or
427WasmRelocationType.MemoryAddrRelSleb or WasmRelocationType.MemoryAddrLocrelI32;
437WriteULEB128(payload, (ulong)(type == WasmRelocationType.TypeIndexLeb
446WasmRelocationType.FunctionIndexLeb or WasmRelocationType.TypeIndexLeb or WasmRelocationType.GlobalIndexLeb => symbol.Index,
447WasmRelocationType.FunctionOffsetI32 => codeSectionPrefixSize + _functionOffsets[symbol.Index] + addend,
448WasmRelocationType.SectionOffsetI32 => addend,