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)
682foreach (var reloc in block.ChecksumRelocations)
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\PEObjectWriter.cs (16)
573if (Relocation.GetFileRelocationType(reloc.Type) == reloc.Type)
890uint relocLength = (uint)Relocation.GetSize(reloc.Type);
895long addend = Relocation.ReadValue(reloc.Type, pData);
906Relocation.WriteValue(reloc.Type, pData, symbolImageOffset + imageBase + addend);
909Relocation.WriteValue(reloc.Type, pData, symbolImageOffset + addend);
913Relocation.WriteValue(reloc.Type, pData, symbolImageOffset - (relocOffset + relocLength) + addend);
916Relocation.WriteValue(reloc.Type, pData, (long)(symbolImageOffset & ~1u) - (long)(relocOffset + relocLength) + addend);
919Relocation.WriteValue(reloc.Type, pData, (long)symbolImageOffset - (long)relocOffset + addend);
923Relocation.WriteValue(reloc.Type, pData, fileOffset + addend);
927Relocation.WriteValue(reloc.Type, pData, symbolImageOffset - (relocOffset + offsetCorrection) + addend);
934Relocation.WriteValue(reloc.Type, pData, delta);
939Relocation.WriteValue(reloc.Type, pData, (symbolImageOffset + addend) & 0xfff);
945Relocation.WriteValue(reloc.Type, pData, delta);
955Relocation.WriteValue(reloc.Type, pData, delta);
967Span<byte> data = new byte[Relocation.GetSize(reloc.Type)];
975stream.Write(new Span<byte>(data, Relocation.GetSize(reloc.Type)));
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmObjectWriter.cs (24)
812RelocType fileRelocType = Relocation.GetFileRelocationType(reloc.Type);
862byte[] relocScratchBuffer = new byte[Relocation.MaxSize];
879int size = Relocation.GetSize(reloc.Type);
912long addend = Relocation.ReadValue(reloc.Type, pData);
913int relocLength = Relocation.GetSize(reloc.Type);
921Relocation.WriteValue(reloc.Type, pData, index);
940Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + 0 + addend);
944Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + addend);
949Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset - (virtualRelocOffset + relocLength) + addend);
954Relocation.WriteValue(reloc.Type, pData, fileOffset + addend);
971Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + addend);
987Relocation.WriteValue(reloc.Type, pData, virtualSymbolImageOffset + addend);
1001Relocation.WriteValue(reloc.Type, pData, index + addend);
1011Relocation.WriteValue(reloc.Type, pData, index + addend);
1026Span<byte> relocContents = buffer.AsSpan(0, Relocation.GetSize(reloc.Type));
1035sectionStream.Write(new Span<byte>(pData, Relocation.GetSize(reloc.Type)));
1269uint encodeLength = Relocation.WASM_PADDED_RELOC_SIZE_32;
1273Debug.Assert(headerBuffer.Slice(1).Length == Relocation.WASM_PADDED_RELOC_SIZE_32);
1280public override int HeaderSize => 1 + Relocation.WASM_PADDED_RELOC_SIZE_32;
1360Relocation.WASM_PADDED_RELOC_SIZE_32, // encode size of data length
1363Relocation.WASM_PADDED_RELOC_SIZE_32, // encode size of data length
1403Debug.Assert(headerBuffer.Slice(len).Length == Relocation.WASM_PADDED_RELOC_SIZE_32);
1412Debug.Assert(headerBuffer.Slice(len).Length == Relocation.WASM_PADDED_RELOC_SIZE_32, $"{headerBuffer.Slice(len).Length} != {Relocation.WASM_PADDED_RELOC_SIZE_32}");