Example #1
0
 public ElfSymbolTable(Reader reader, bool is64Bit, ulong address, ElfStringTable stringTable)
 {
     _reader      = reader;
     _address     = address;
     _is64Bit     = is64Bit;
     _symSize     = is64Bit ? 24u : 16u;
     _stringTable = stringTable;
 }
Example #2
0
        public ElfDynamicSection(Reader reader, bool is64Bit, ulong address, ulong size)
        {
            ulong endAddress = address + size;

            while (address < endAddress)
            {
                ElfDynamicEntryTag tag;
                ulong ptr;
                if (is64Bit)
                {
                    ElfDynamicEntry64 dyn = reader.Read <ElfDynamicEntry64>(ref address);
                    tag = (ElfDynamicEntryTag)dyn.Tag;
                    ptr = dyn.Ptr;
                }
                else
                {
                    ElfDynamicEntry32 dyn = reader.Read <ElfDynamicEntry32>(ref address);
                    tag = (ElfDynamicEntryTag)dyn.Tag;
                    ptr = dyn.Ptr;
                }
                if (tag == ElfDynamicEntryTag.Null)
                {
                    break;
                }
                else if (tag == ElfDynamicEntryTag.GnuHash)
                {
                    GnuHashTableVA = ptr;
                }
                else if (tag == ElfDynamicEntryTag.StrTab)
                {
                    StringTableVA = ptr;
                }
                else if (tag == ElfDynamicEntryTag.SymTab)
                {
                    SymbolTableVA = ptr;
                }
                else if (tag == ElfDynamicEntryTag.StrSz)
                {
                    StringTableSize = ptr;
                }
            }

            StringTable = ElfStringTable.Create(reader, StringTableVA, StringTableSize);
            SymbolTable = ElfSymbolTable.Create(reader, is64Bit, SymbolTableVA, StringTable);
            GnuHash     = ElfSymbolGnuHash.Create(reader, is64Bit, GnuHashTableVA);
        }