* Parse a symbol table. */
| 862 | * Parse a symbol table. |
| 863 | */ |
| 864 | static void parseSymbols(const uint8_t *data, const Elf64_Shdr *shdr_syms, |
| 865 | const Elf64_Shdr *shdr_strs, SymbolInfo &syms) |
| 866 | { |
| 867 | const Elf64_Sym *sym_tab = |
| 868 | (const Elf64_Sym *)(data + shdr_syms->sh_offset); |
| 869 | const char *str_tab = (const char *)(data + shdr_strs->sh_offset); |
| 870 | size_t sym_num = shdr_syms->sh_size / sizeof(Elf64_Sym); |
| 871 | size_t str_len = shdr_strs->sh_size; |
| 872 | for (size_t i = 0; i < sym_num; i++) |
| 873 | { |
| 874 | const Elf64_Sym *sym = sym_tab + i; |
| 875 | const char *name = parseName(str_tab, str_len, sym->st_name); |
| 876 | if (name == nullptr) |
| 877 | continue; |
| 878 | syms.insert({name, sym}); |
| 879 | } |
| 880 | } |
| 881 | |
| 882 | /* |
| 883 | * Parse an ELF file. |