Пример #1
0
        /// <summary>Get all relocations in the section</summary>
        /// <returns>Stream of all relocations from current section</returns>
        public IEnumerator <RelocationSectionItem> GetEnumerator()
        {
            UInt64 offset       = base.Section.sh_offset;
            UInt64 maxOffset    = base.Section.sh_offset + base.Section.sh_size;
            UInt64 sizeOfStruct = this.SizeOfStruct;
            UInt64 itemsCount   = (maxOffset - offset) / sizeOfStruct;

            ElfHeader header  = base.Section.File.Header;
            Boolean   is64Bit = header.Is64Bit;

            for (UInt64 loop = 0; loop < itemsCount; loop++)
            {
                if (is64Bit)
                {
                    Elf.Elf64_Rel rel = header.PtrToStructure <Elf.Elf64_Rel>(offset);
                    yield return(new RelocationSectionItem(rel));
                }
                else
                {
                    Elf.Elf32_Rel rel = header.PtrToStructure <Elf.Elf32_Rel>(offset);
                    yield return(new RelocationSectionItem(rel));
                }
                offset += sizeOfStruct;
            }
        }
Пример #2
0
 internal RelocationSectionItem(Elf.Elf64_Rel relocation)
     : this(relocation.r_offset, relocation.r_info)
 {
 }