Lines Matching defs:elf
50 static unsigned int symbol_count(struct elf_info *elf)
54 for (Elf_Sym *sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
55 if (is_valid_name(elf, sym))
68 static void symsearch_populate(struct elf_info *elf,
72 bool is_arm = (elf->hdr->e_machine == EM_ARM);
74 for (Elf_Sym *sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
75 if (is_valid_name(elf, sym)) {
78 table->symbol_index = sym - elf->symtab_start;
79 table->section_index = get_secindex(elf, sym);
124 void symsearch_init(struct elf_info *elf)
126 unsigned int table_size = symbol_count(elf);
128 elf->symsearch = NOFAIL(malloc(sizeof(struct symsearch) +
130 elf->symsearch->table_size = table_size;
132 symsearch_populate(elf, elf->symsearch->table, table_size);
133 qsort(elf->symsearch->table, table_size,
136 symsearch_fixup(elf->symsearch->table, table_size);
139 void symsearch_finish(struct elf_info *elf)
141 free(elf->symsearch);
142 elf->symsearch = NULL;
153 Elf_Sym *symsearch_find_nearest(struct elf_info *elf, Elf_Addr addr,
157 unsigned int hi = elf->symsearch->table_size;
159 struct syminfo *table = elf->symsearch->table;
187 hi < elf->symsearch->table_size &&
191 result = &elf->symtab_start[table[hi].symbol_index];
196 result = &elf->symtab_start[table[hi - 1].symbol_index];