Exemple #1
0
        /// <summary>Get all relocations with addendum constant in the section</summary>
        /// <returns>Stream of all relocations with addendum constant 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_Rela rel = header.PtrToStructure <Elf.Elf64_Rela>(offset);
                    yield return(new RelocationASectionItem(rel));
                }
                else
                {
                    Elf.Elf32_Rela rel = header.PtrToStructure <Elf.Elf32_Rela>(offset);
                    yield return(new RelocationASectionItem(rel));
                }
                offset += sizeOfStruct;
            }
        }
Exemple #2
0
 internal RelocationASectionItem(Elf.Elf32_Rela relocation)
     : base(relocation.r_offset, relocation.r_info)
 {
     this.r_addend = relocation.r_addend;
 }