src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\ObjectWriter.cs (13)
29private sealed record BlockToRelocate(int SectionIndex, long Offset, byte[] Data, Relocation[] Relocations);
30private protected sealed record ChecksumsToCalculate(int SectionIndex, long Offset, Relocation[] ChecksumRelocations);
194adjustedAddend += Relocation.ReadValue(relocType, (void*)pData);
197if (relocType is IMAGE_REL_BASED_THUMB_BRANCH24 && !Relocation.FitsInThumb2BlRel24((int)adjustedAddend))
203Relocation.WriteValue(relocType, (void*)pData, adjustedAddend);
212long adjustedAddend = addend + Relocation.ReadValue(relocType, (void*)pData);
213Relocation.WriteValue(relocType, (void*)pData, definedSymbol.Size + adjustedAddend);
480foreach (Relocation reloc in nodeContents.Relocs)
506foreach (Relocation reloc in nodeContents.Relocs)
508RelocType fileReloc = Relocation.GetFileRelocationType(reloc.RelocType);
556ArrayBuilder<Relocation> checksumRelocationsBuilder = default;
557foreach (Relocation reloc in blockToRelocate.Relocations)
687foreach (var reloc in block.ChecksumRelocations)
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\PEObjectWriter.cs (16)
572if (Relocation.GetFileRelocationType(reloc.Type) == reloc.Type)
897uint relocLength = (uint)Relocation.GetSize(reloc.Type);
902long addend = Relocation.ReadValue(reloc.Type, pData);
913Relocation.WriteValue(reloc.Type, pData, symbolImageOffset + imageBase + addend);
916Relocation.WriteValue(reloc.Type, pData, symbolImageOffset + addend);
920Relocation.WriteValue(reloc.Type, pData, symbolImageOffset - (relocOffset + relocLength) + addend);
923Relocation.WriteValue(reloc.Type, pData, (long)(symbolImageOffset & ~1u) - (long)(relocOffset + relocLength) + addend);
926Relocation.WriteValue(reloc.Type, pData, (long)symbolImageOffset - (long)relocOffset + addend);
930Relocation.WriteValue(reloc.Type, pData, fileOffset + addend);
934Relocation.WriteValue(reloc.Type, pData, symbolImageOffset - (relocOffset + offsetCorrection) + addend);
941Relocation.WriteValue(reloc.Type, pData, delta);
946Relocation.WriteValue(reloc.Type, pData, (symbolImageOffset + addend) & 0xfff);
952Relocation.WriteValue(reloc.Type, pData, delta);
962Relocation.WriteValue(reloc.Type, pData, delta);
974Span<byte> data = new byte[Relocation.GetSize(reloc.Type)];
982stream.Write(new Span<byte>(data, Relocation.GetSize(reloc.Type)));
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmObjectWriter.cs (26)
803RelocType fileRelocType = Relocation.GetFileRelocationType(reloc.Type);
853byte[] relocScratchBuffer = new byte[Relocation.MaxSize];
870int size = Relocation.GetSize(reloc.Type);
889Relocation.WriteValue(reloc.Type, pData, (int)globalIndex);
923long addend = Relocation.ReadValue(reloc.Type, pData);
924int relocLength = Relocation.GetSize(reloc.Type);
932Relocation.WriteValue(reloc.Type, pData, index);
951Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + 0 + addend);
955Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + addend);
960Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset - (virtualRelocOffset + relocLength) + addend);
965Relocation.WriteValue(reloc.Type, pData, fileOffset + addend);
982Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + addend);
998Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + addend);
1012Relocation.WriteValue(reloc.Type, pData, index + addend);
1022Relocation.WriteValue(reloc.Type, pData, index + addend);
1027Relocation.WriteValue(reloc.Type, pData, RtlRestoreContextTagIndex + addend);
1042Span<byte> relocContents = buffer.AsSpan(0, Relocation.GetSize(reloc.Type));
1051sectionStream.Write(new Span<byte>(pData, Relocation.GetSize(reloc.Type)));
1321uint encodeLength = Relocation.WASM_PADDED_RELOC_SIZE_32;
1325Debug.Assert(headerBuffer.Slice(1).Length == Relocation.WASM_PADDED_RELOC_SIZE_32);
1332public override int HeaderSize => 1 + Relocation.WASM_PADDED_RELOC_SIZE_32;
1412Relocation.WASM_PADDED_RELOC_SIZE_32, // encode size of data length
1415Relocation.WASM_PADDED_RELOC_SIZE_32, // encode size of data length
1455Debug.Assert(headerBuffer.Slice(len).Length == Relocation.WASM_PADDED_RELOC_SIZE_32);
1464Debug.Assert(headerBuffer.Slice(len).Length == Relocation.WASM_PADDED_RELOC_SIZE_32, $"{headerBuffer.Slice(len).Length} != {Relocation.WASM_PADDED_RELOC_SIZE_32}");