public override Dictionary <int, ElfSymbol> LoadSymbolsSection(ElfSection symSection) { //Debug.Print("Symbols"); var stringtableSection = symSection.LinkedSection; var rdr = CreateReader(symSection.FileOffset); var symbols = new Dictionary <int, ElfSymbol>(); for (ulong i = 0; i < symSection.Size / symSection.EntrySize; ++i) { var sym = Elf64_Sym.Load(rdr); //Debug.Print(" {0,3} {1,-25} {2,-12} {3,6} {4,-15} {5:X8} {6,9}", // i, // RemoveGlibcSuffix(ReadAsciiString(stringtableSection.FileOffset + sym.st_name)), // (ElfSymbolType)(sym.st_info & 0xF), // sym.st_shndx, // GetSectionName(sym.st_shndx), // sym.st_value, // sym.st_size); symbols.Add( (int)i, new ElfSymbol { Name = RemoveModuleSuffix(ReadAsciiString(stringtableSection.FileOffset + sym.st_name)), Type = (ElfSymbolType)(sym.st_info & 0xF), SectionIndex = sym.st_shndx, Value = sym.st_value, Size = sym.st_size, }); } return(symbols); }
public override ElfSymbol LoadSymbol(ulong offsetSymtab, ulong symbolIndex, ulong entrySize, ulong offsetStringTable) { var rdr = CreateReader(offsetSymtab + entrySize * symbolIndex); var sym = Elf64_Sym.Load(rdr); return(new ElfSymbol { Name = RemoveModuleSuffix(ReadAsciiString(offsetStringTable + sym.st_name)), Type = (ElfSymbolType)(sym.st_info & 0xF), Bind = sym.st_info >> 4, SectionIndex = sym.st_shndx, Value = sym.st_value, Size = sym.st_size, }); }