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 (25)
802RelocType fileRelocType = Relocation.GetFileRelocationType(reloc.Type);
852byte[] relocScratchBuffer = new byte[Relocation.MaxSize];
869int size = Relocation.GetSize(reloc.Type);
902long addend = Relocation.ReadValue(reloc.Type, pData);
903int relocLength = Relocation.GetSize(reloc.Type);
911Relocation.WriteValue(reloc.Type, pData, index);
930Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + 0 + addend);
934Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + addend);
939Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset - (virtualRelocOffset + relocLength) + addend);
944Relocation.WriteValue(reloc.Type, pData, fileOffset + addend);
961Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + addend);
977Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + addend);
991Relocation.WriteValue(reloc.Type, pData, index + addend);
1001Relocation.WriteValue(reloc.Type, pData, index + addend);
1006Relocation.WriteValue(reloc.Type, pData, RtlRestoreContextTagIndex + addend);
1021Span<byte> relocContents = buffer.AsSpan(0, Relocation.GetSize(reloc.Type));
1030sectionStream.Write(new Span<byte>(pData, Relocation.GetSize(reloc.Type)));
1294uint encodeLength = Relocation.WASM_PADDED_RELOC_SIZE_32;
1298Debug.Assert(headerBuffer.Slice(1).Length == Relocation.WASM_PADDED_RELOC_SIZE_32);
1305public override int HeaderSize => 1 + Relocation.WASM_PADDED_RELOC_SIZE_32;
1385Relocation.WASM_PADDED_RELOC_SIZE_32, // encode size of data length
1388Relocation.WASM_PADDED_RELOC_SIZE_32, // encode size of data length
1428Debug.Assert(headerBuffer.Slice(len).Length == Relocation.WASM_PADDED_RELOC_SIZE_32);
1437Debug.Assert(headerBuffer.Slice(len).Length == Relocation.WASM_PADDED_RELOC_SIZE_32, $"{headerBuffer.Slice(len).Length} != {Relocation.WASM_PADDED_RELOC_SIZE_32}");