public Overlay(BinaryReader br) { //Get Header int physicalSize = (int)br.BaseStream.Length; int size = physicalSize; br.BaseStream.Position = size - 4; int header_inset = br.ReadBigInt32(); br.BaseStream.Position = size - header_inset; TextSize = br.ReadBigInt32(); DataSize = br.ReadBigInt32(); RodataSize = br.ReadBigInt32(); BssSize = br.ReadBigInt32(); RelCount = br.ReadBigInt32(); int virtualSize = physicalSize + BssSize; for (int i = 0; i < RelCount; i++) { var rel = new RelocationWord(this, br.ReadBigInt32()); Relocations.Add(rel); } }
public int GetRelocationOffset(RelocationWord item) { int off = item.SectionOffset; switch (item.SectionId) { case Section.data: off += TextSize; break; case Section.rodata: off += TextSize + DataSize; break; case Section.bss: off += TextSize + DataSize + RodataSize; break; } return(off); }