parent\parent\Common\Compiler\ObjectWriter\WasmRelocatableObjectWriter.cs (35)
418WasmRelocationType type = reloc.Type switch
420RelocType.WASM_FUNCTION_INDEX_LEB => WasmRelocationType.FunctionIndexLeb,
421RelocType.WASM_TYPE_INDEX_LEB => WasmRelocationType.TypeIndexLeb,
422RelocType.WASM_GLOBAL_INDEX_LEB => WasmRelocationType.GlobalIndexLeb,
423RelocType.WASM_CLR_RESTORE_CONTEXT_EXCEPTION_TAG_LEB => WasmRelocationType.TagIndexLeb,
424RelocType.WASM_TABLE_INDEX_SLEB => WasmRelocationType.TableIndexSleb,
425RelocType.WASM_TABLE_INDEX_I32 => WasmRelocationType.TableIndexI32,
426RelocType.WASM_TABLE_INDEX_I64 => WasmRelocationType.TableIndexI64,
427RelocType.WASM_MEMORY_ADDR_LEB => WasmRelocationType.MemoryAddrLeb,
428RelocType.WASM_MEMORY_ADDR_SLEB when isFunction => WasmRelocationType.TableIndexSleb,
429RelocType.WASM_MEMORY_ADDR_SLEB => WasmRelocationType.MemoryAddrSleb,
430RelocType.WASM_MEMORY_ADDR_REL_SLEB when isFunction => WasmRelocationType.TableIndexSleb,
431RelocType.WASM_MEMORY_ADDR_REL_SLEB => WasmRelocationType.MemoryAddrRelSleb,
432RelocType.IMAGE_REL_BASED_HIGHLOW when isFunction && section is WasmCustomSection => WasmRelocationType.FunctionOffsetI32,
433RelocType.IMAGE_REL_BASED_HIGHLOW when isSection => WasmRelocationType.SectionOffsetI32,
434RelocType.IMAGE_REL_BASED_HIGHLOW when isFunction => WasmRelocationType.TableIndexI32,
435RelocType.IMAGE_REL_BASED_HIGHLOW => WasmRelocationType.MemoryAddrI32,
436RelocType.IMAGE_REL_BASED_DIR64 => WasmRelocationType.MemoryAddrI64,
437RelocType.IMAGE_REL_BASED_RELPTR32 => WasmRelocationType.MemoryAddrLocrelI32,
446if (isFunction && type != WasmRelocationType.FunctionOffsetI32 && addend != 0)
455bool hasAddend = type is WasmRelocationType.MemoryAddrLeb or WasmRelocationType.MemoryAddrSleb or
456WasmRelocationType.MemoryAddrI32 or WasmRelocationType.MemoryAddrI64 or
457WasmRelocationType.FunctionOffsetI32 or WasmRelocationType.SectionOffsetI32 or
458WasmRelocationType.MemoryAddrRelSleb or WasmRelocationType.MemoryAddrLocrelI32;
468WriteULEB128(payload, (ulong)(type == WasmRelocationType.TypeIndexLeb
477WasmRelocationType.FunctionIndexLeb or WasmRelocationType.TypeIndexLeb or WasmRelocationType.GlobalIndexLeb or WasmRelocationType.TagIndexLeb => symbol.Index,
478WasmRelocationType.FunctionOffsetI32 => codeSectionPrefixSize + _functionOffsets[symbol.Index] + addend,
479WasmRelocationType.SectionOffsetI32 => addend,