Rizin
unix-like reverse engineering framework and cli tools
elf_symbols.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2021 08A <08A@riseup.net>
2 // SPDX-FileCopyrightText: 2008-2020 nibble <nibble.ds@gmail.com>
3 // SPDX-FileCopyrightText: 2008-2020 pancake <pancake@nopcode.org>
4 // SPDX-FileCopyrightText: 2008-2020 alvaro_fe <alvaro.felipe91@gmail.com>
5 // SPDX-License-Identifier: LGPL-3.0-only
6 
7 #include "elf.h"
8 #include <ht_uu.h>
9 
10 #define HASH_NCHAIN_OFFSET(x) ((x) + 4)
11 
16  bool dynamic;
18 };
19 
21  unsigned char bind;
22  const char *name;
23 };
24 
26  unsigned char type;
27  const char *name;
28 };
29 
39 };
40 
54 };
55 
57  return (struct symbols_segment){
58  .offset = offset,
59  .number = number,
60  .entry_size = entry_size,
61  .dynamic = dynamic,
62  .strtab = strtab
63  };
64 }
65 
66 static Elf_(Word) get_number_of_symbols_from_heuristic_aux(ELFOBJ *bin, ut64 symtab_offset, ut64 strtab_offset) {
67  if (symtab_offset > strtab_offset) {
68  return 0;
69  }
70 
71  ut64 symtab_size = strtab_offset - symtab_offset;
72  return symtab_size / sizeof(Elf_(Sym));
73 }
74 
75 static Elf_(Word) get_number_of_symbols_from_heuristic(ELFOBJ *bin) {
76  ut64 symtab_addr;
77  ut64 strtab_addr;
78  if (!Elf_(rz_bin_elf_get_dt_info)(bin, DT_SYMTAB, &symtab_addr) || !Elf_(rz_bin_elf_get_dt_info)(bin, DT_STRTAB, &strtab_addr)) {
79  return 0;
80  }
81 
82  ut64 symtab_offset = Elf_(rz_bin_elf_v2p)(bin, symtab_addr);
83  ut64 strtab_offset = Elf_(rz_bin_elf_v2p)(bin, strtab_addr);
84  if (symtab_offset == UT64_MAX || strtab_offset == UT64_MAX) {
85  return 0;
86  }
87 
88  return get_number_of_symbols_from_heuristic_aux(bin, symtab_offset, strtab_offset);
89 }
90 
91 static Elf_(Word) get_number_of_symbols_from_section(ELFOBJ *bin) {
93  if (!section) {
94  return 0;
95  }
96 
97  return section->size / sizeof(Elf_(Sym));
98 }
99 
100 static bool is_special_arm_symbol(ELFOBJ *bin, Elf_(Sym) * sym, const char *name) {
101  if (!name) {
102  return false;
103  }
104 
105  if (name[0] != '$') {
106  return false;
107  }
108 
109  if (name[1] == 'a' || name[1] == 't' || name[1] == 'd' || name[1] == 'x') {
110  return (name[2] == '\0' || name[2] == '.') &&
111  ELF_ST_TYPE(sym->st_info) == STT_NOTYPE &&
112  ELF_ST_BIND(sym->st_info) == STB_LOCAL &&
113  ELF_ST_VISIBILITY(sym->st_info) == STV_DEFAULT;
114  }
115 
116  return false;
117 }
118 
119 static bool is_special_symbol(ELFOBJ *bin, Elf_(Sym) * sym, const char *name) {
120  switch (bin->ehdr.e_machine) {
121  case EM_ARM:
122  case EM_AARCH64:
123  return is_special_arm_symbol(bin, sym, name);
124  default:
125  return false;
126  }
127 }
128 
129 static const char *symbol_type_to_str(ELFOBJ *bin, RzBinElfSymbol *ret, Elf_(Sym) * sym) {
130  if (bin && ret && is_special_symbol(bin, sym, ret->name)) {
132  }
133 
134  for (size_t i = 0; i < RZ_ARRAY_SIZE(symbol_type_translation_table); i++) {
135  if (ELF_ST_TYPE(sym->st_info) == symbol_type_translation_table[i].type) {
137  }
138  }
139 
141 }
142 
143 static const char *symbol_bind_to_str(Elf_(Sym) * sym) {
144  for (size_t i = 0; i < RZ_ARRAY_SIZE(symbol_bind_translation_table); i++) {
145  if (ELF_ST_BIND(sym->st_info) == symbol_bind_translation_table[i].bind) {
147  }
148  }
149 
151 }
152 
153 static bool get_symbol_entry_aux(ELFOBJ *bin, ut64 offset, Elf_(Sym) * result) {
154 #if RZ_BIN_ELF64
155  return Elf_(rz_bin_elf_read_word)(bin, &offset, &result->st_name) &&
156  Elf_(rz_bin_elf_read_char)(bin, &offset, &result->st_info) &&
157  Elf_(rz_bin_elf_read_char)(bin, &offset, &result->st_other) &&
158  Elf_(rz_bin_elf_read_section)(bin, &offset, &result->st_shndx) &&
159  Elf_(rz_bin_elf_read_addr)(bin, &offset, &result->st_value) &&
160  Elf_(rz_bin_elf_read_xword)(bin, &offset, &result->st_size);
161 #else
162  return Elf_(rz_bin_elf_read_word)(bin, &offset, &result->st_name) &&
163  Elf_(rz_bin_elf_read_addr)(bin, &offset, &result->st_value) &&
164  Elf_(rz_bin_elf_read_word)(bin, &offset, &result->st_size) &&
165  Elf_(rz_bin_elf_read_char)(bin, &offset, &result->st_info) &&
166  Elf_(rz_bin_elf_read_char)(bin, &offset, &result->st_other) &&
167  Elf_(rz_bin_elf_read_section)(bin, &offset, &result->st_shndx);
168 #endif
169 }
170 
171 static bool get_symbol_entry(ELFOBJ *bin, ut64 offset, Elf_(Sym) * result) {
172  if (!get_symbol_entry_aux(bin, offset, result)) {
173  RZ_LOG_WARN("Failed to read symbol entry at 0x%" PFMT64x ".\n", offset);
174  return false;
175  }
176 
177  return true;
178 }
179 
180 static bool is_section_local_symbol(ELFOBJ *bin, Elf_(Sym) * symbol) {
181  if (symbol->st_name != 0) {
182  return false;
183  }
184  if (ELF_ST_TYPE(symbol->st_info) != STT_SECTION) {
185  return false;
186  }
187  if (ELF_ST_BIND(symbol->st_info) != STB_LOCAL) {
188  return false;
189  }
190  if (symbol->st_shndx >= bin->ehdr.e_shnum) {
191  return false;
192  }
193 
194  return true;
195 }
196 
197 static bool set_elf_symbol_name(ELFOBJ *bin, struct symbols_segment *segment, RzBinElfSymbol *elf_symbol, Elf_(Sym) * symbol, RzBinElfSection *section) {
198  if (section && is_section_local_symbol(bin, symbol)) {
199  elf_symbol->name = rz_str_new(section->name);
200  return elf_symbol->name;
201  }
202 
203  if (!segment->strtab) {
204  return false;
205  }
206 
207  elf_symbol->name = Elf_(rz_bin_elf_strtab_get_dup)(segment->strtab, symbol->st_name);
208  if (!elf_symbol->name) {
209  return false;
210  }
211 
212  return true;
213 }
214 
215 static bool convert_elf_symbol_entry(ELFOBJ *bin, struct symbols_segment *segment, RzBinElfSymbol *elf_symbol, Elf_(Sym) * symbol, size_t ordinal) {
216  RzBinElfSection *section = Elf_(rz_bin_elf_get_section)(bin, symbol->st_shndx);
217 
218  elf_symbol->bind = symbol_bind_to_str(symbol);
219  elf_symbol->ordinal = ordinal;
220  elf_symbol->size = symbol->st_size;
221 
222  if (symbol->st_size == 0 && symbol->st_shndx == SHN_UNDEF && symbol->st_value == 0) {
223  elf_symbol->paddr = elf_symbol->vaddr = UT64_MAX;
224  } else {
226  elf_symbol->paddr = section->offset + symbol->st_value;
227  elf_symbol->vaddr = Elf_(rz_bin_elf_p2v)(bin, elf_symbol->paddr);
228  } else {
229  elf_symbol->vaddr = symbol->st_value;
230  elf_symbol->paddr = Elf_(rz_bin_elf_v2p)(bin, elf_symbol->vaddr);
231  }
232  }
233 
234  if (!set_elf_symbol_name(bin, segment, elf_symbol, symbol, section)) {
235  return false;
236  }
237 
238  elf_symbol->type = symbol_type_to_str(bin, elf_symbol, symbol);
239 
240  return true;
241 }
242 
243 static bool has_already_been_processed(ELFOBJ *bin, ut64 offset, HtUU *set) {
244  bool found;
245  ht_uu_find(set, offset, &found);
246 
247  return found;
248 }
249 
250 static void elf_symbol_fini(void *e, RZ_UNUSED void *user) {
251  RzBinElfSymbol *ptr = e;
252  free(ptr->name);
253 }
254 
255 static bool compute_symbols_from_segment(ELFOBJ *bin, RzVector *result, struct symbols_segment *segment, RzBinElfSymbolFilter filter, HtUU *set) {
256  ut64 offset = segment->offset + segment->entry_size;
257 
258  for (size_t i = 1; i < segment->number; i++) {
260  offset += segment->entry_size;
261  continue;
262  }
263 
264  if (!ht_uu_insert(set, offset, offset)) {
265  return false;
266  }
267 
268  Elf_(Sym) entry;
269  if (!get_symbol_entry(bin, offset, &entry)) {
270  return false;
271  }
272 
273  if (!filter(bin, &entry, segment->dynamic)) {
274  offset += segment->entry_size;
275  continue;
276  }
277 
278  RzBinElfSymbol symbol = { 0 };
279 
280  if (!convert_elf_symbol_entry(bin, segment, &symbol, &entry, i)) {
281  return false;
282  }
283 
284  if (!rz_vector_push(result, &symbol)) {
285  elf_symbol_fini(&symbol, NULL);
286  return false;
287  }
288 
289  offset += segment->entry_size;
290  }
291 
292  return true;
293 }
294 
297  return true;
298  }
299 
300  ut64 addr;
303  return true;
304  }
305 
307  if (offset == UT64_MAX) {
308  return true;
309  }
310 
311  Elf_(Word) number = Elf_(rz_bin_elf_get_number_of_dynamic_symbols)(bin);
312  if (!number) {
313  return true;
314  }
315 
316  struct symbols_segment segment = symbols_segment_init(offset, number, entry_size, true, bin->dynstr);
317 
318  if (!compute_symbols_from_segment(bin, result, &segment, filter, set)) {
319  return false;
320  }
321 
322  return true;
323 }
324 
326  size_t i;
329  if (!section->is_valid) {
330  continue;
331  }
332 
333  if (section->type != SHT_SYMTAB && section->type != SHT_DYNSYM) {
334  continue;
335  }
336 
337  if (!section->link) {
338  RZ_LOG_WARN("The section %zu has a null link.\n", i);
339  continue;
340  }
341 
342  RzBinElfSection *strtab_section = Elf_(rz_bin_elf_get_section)(bin, section->link);
343  if (!strtab_section) {
344  continue;
345  }
346 
347  RzBinElfStrtab *strtab = Elf_(rz_bin_elf_strtab_new)(bin, strtab_section->offset, strtab_section->size);
348  if (!strtab) {
349  continue;
350  }
351 
352  ut64 number = (section->size / sizeof(Elf_(Sym)));
353 
354  struct symbols_segment segment = symbols_segment_init(section->offset, number, sizeof(Elf_(Sym)), false, strtab);
355 
356  if (!compute_symbols_from_segment(bin, result, &segment, filter, set)) {
358  return false;
359  }
360 
362  }
363 
364  return true;
365 }
366 
368  // Get symbols from .gnu_debugdata according to https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html
369  bool res = false;
370  const RzBinElfSection *gnu_debugdata = Elf_(rz_bin_elf_get_section_with_name)(bin, ".gnu_debugdata");
371  if (!gnu_debugdata) {
372  return false;
373  }
374 
375  RzBuffer *data_buf = rz_buf_new_slice(bin->b, gnu_debugdata->offset, gnu_debugdata->size);
376  if (!data_buf) {
377  return false;
378  }
379 
380  RzBuffer *dec_buf = rz_buf_new_empty(0);
381  if (!dec_buf) {
382  goto data_buf_err;
383  }
384 
385  if (!rz_lzma_dec_buf(data_buf, dec_buf, 1 << 13, NULL)) {
386  goto dec_buf_err;
387  }
388 
389  RzBinObjectLoadOptions obj_opts = {
390  .baseaddr = UT64_MAX,
391  .loadaddr = 0,
392  .elf_load_sections = true,
393  };
394  ELFOBJ *debug_data_bin = Elf_(rz_bin_elf_new_buf)(dec_buf, &obj_opts);
395  if (!debug_data_bin) {
396  goto dec_buf_err;
397  }
398 
399  RzVector *debug_symbols = Elf_(rz_bin_elf_compute_symbols)(debug_data_bin, filter);
400  if (!debug_symbols) {
401  goto debug_data_err;
402  }
403 
404  HtPP *name_set = ht_pp_new0();
405  if (!name_set) {
406  goto debug_symbols_err;
407  }
408 
409  RzBinElfSymbol *sym;
410  rz_vector_foreach(result, sym) {
411  ht_pp_insert(name_set, sym->name, sym);
412  }
413 
414  rz_vector_foreach(debug_symbols, sym) {
415  bool found;
416  ht_pp_find(name_set, sym->name, &found);
417  if (found) {
418  continue;
419  }
420 
421  rz_vector_push(result, sym);
422  }
423  // The ownership has been moved to `result`, no need to free the elements.
424  debug_symbols->len = 0;
425  res = true;
426 
427  ht_pp_free(name_set);
428 debug_symbols_err:
429  rz_vector_free(debug_symbols);
430 debug_data_err:
431  Elf_(rz_bin_elf_free)(debug_data_bin);
432 dec_buf_err:
433  rz_buf_free(dec_buf);
434 data_buf_err:
435  rz_buf_free(data_buf);
436  return res;
437 }
438 
439 static bool filter_symbol(RZ_UNUSED ELFOBJ *bin, Elf_(Sym) * symbol, RZ_UNUSED bool is_dynamic) {
440  return symbol->st_shndx != SHT_NULL;
441 }
442 
443 Elf_(Word) Elf_(rz_bin_elf_get_number_of_dynamic_symbols)(RZ_NONNULL ELFOBJ *bin) {
445 
447  if (result) {
448  return result;
449  }
450 
452  if (result) {
453  return result;
454  }
455 
456  RZ_LOG_WARN("Neither hash nor gnu_hash exist. Falling back to heuristics for deducing the number of dynamic symbols...\n");
457 
458  result = get_number_of_symbols_from_section(bin);
459  if (result) {
460  return result;
461  }
462 
463  result = get_number_of_symbols_from_heuristic(bin);
464  if (result) {
465  return result;
466  }
467 
468  RZ_LOG_ERROR("Failed to determine the number of dynamic symbols from heuristics.\n");
469 
470  return 0;
471 }
472 
475 
476  RzBinElfSymbol *symbol;
478  if (symbol->ordinal == ordinal) {
479  return symbol;
480  }
481  }
482 
483  return NULL;
484 }
485 
488  if (!result) {
489  return NULL;
490  }
491 
492  HtUU *set = ht_uu_new0();
493  if (!set) {
494  rz_vector_free(result);
495  return NULL;
496  }
497 
498  if (!get_dynamic_elf_symbols(bin, result, filter, set)) {
499  rz_vector_free(result);
500  ht_uu_free(set);
501  return NULL;
502  }
503 
504  if (!get_section_elf_symbols(bin, result, filter, set)) {
505  rz_vector_free(result);
506  ht_uu_free(set);
507  return NULL;
508  }
509 
510  // Parsing .gnu_debugdata is completely optional, ignore errors if any and just continue
511  (void)get_gnu_debugdata_elf_symbols(bin, result, filter, set);
512 
513  ht_uu_free(set);
514 
515  if (!rz_vector_len(result)) {
516  rz_vector_free(result);
517  return NULL;
518  }
519 
520  return result;
521 }
522 
525 
527  if (!result) {
528  return NULL;
529  }
530 
531  return result;
532 }
533 
535  rz_return_val_if_fail(bin, false);
536  return bin->symbols;
537 }
#define e(frag)
lzma_index ** i
Definition: index.h:629
#define NULL
Definition: cris-opc.c:27
int bool
uint32_t ut32
ut64 Elf_() rz_bin_elf_p2v(RZ_NONNULL ELFOBJ *bin, ut64 paddr)
Convert a physical address to the virtual address.
Definition: elf.c:400
void Elf_() rz_bin_elf_free(RZ_NONNULL ELFOBJ *bin)
Free the elf binary.
Definition: elf.c:366
RZ_OWN ELFOBJ *Elf_() rz_bin_elf_new_buf(RZ_NONNULL RzBuffer *buf, RZ_NONNULL RzBinObjectLoadOptions *options)
Definition: elf.c:339
ut64 Elf_() rz_bin_elf_v2p(RZ_NONNULL ELFOBJ *bin, ut64 vaddr)
Convert a virtual address to the physical address.
Definition: elf.c:429
bool(* RzBinElfSymbolFilter)(ELFOBJ *bin, Elf_(Sym) *entry, bool is_dynamic)
Definition: elf.h:366
size_t Elf_() rz_bin_elf_get_number_of_symbols_from_hash_table(RZ_NONNULL ELFOBJ *bin)
Definition: elf_hash.c:122
#define rz_bin_elf_enumerate_sections(bin, section, i)
Definition: elf.h:34
#define rz_bin_elf_foreach_symbols(bin, symbol)
Definition: elf.h:46
bool Elf_() rz_bin_elf_is_executable(RZ_NONNULL ELFOBJ *bin)
Check if the elf binary is executable.
Definition: elf_info.c:1648
bool Elf_() rz_bin_elf_read_addr(RZ_NONNULL ELFOBJ *bin, RZ_NONNULL RZ_INOUT ut64 *offset, RZ_NONNULL RZ_OUT Elf_(Addr) *result)
Definition: elf_misc.c:82
#define ELFOBJ
Definition: elf.h:24
bool Elf_() rz_bin_elf_read_char(RZ_NONNULL ELFOBJ *bin, RZ_NONNULL RZ_INOUT ut64 *offset, RZ_NONNULL RZ_OUT ut8 *result)
Definition: elf_misc.c:52
RZ_BORROW RzBinElfSection *Elf_() rz_bin_elf_get_section(RZ_NONNULL ELFOBJ *bin, Elf_(Half) index)
Definition: elf_sections.c:264
bool Elf_() rz_bin_elf_read_word(RZ_NONNULL ELFOBJ *bin, RZ_NONNULL RZ_INOUT ut64 *offset, RZ_NONNULL RZ_OUT Elf_(Word) *result)
Definition: elf_misc.c:62
bool Elf_() rz_bin_elf_read_xword(RZ_NONNULL ELFOBJ *bin, RZ_NONNULL RZ_INOUT ut64 *offset, RZ_NONNULL RZ_OUT Elf_(Xword) *result)
Definition: elf_misc.c:72
RZ_BORROW RzBinElfSection *Elf_() rz_bin_elf_get_section_with_name(RZ_NONNULL ELFOBJ *bin, RZ_NONNULL const char *name)
Definition: elf_sections.c:278
RZ_OWN RzBinElfStrtab *Elf_() rz_bin_elf_strtab_new(RZ_NONNULL ELFOBJ *bin, ut64 offset, ut64 size)
Definition: elf_strtab.c:18
void Elf_() rz_bin_elf_strtab_free(RzBinElfStrtab *ptr)
Definition: elf_strtab.c:72
bool Elf_() rz_bin_elf_read_section(RZ_NONNULL ELFOBJ *bin, RZ_NONNULL RZ_INOUT ut64 *offset, RZ_NONNULL RZ_OUT Elf_(Section) *result)
Definition: elf_misc.c:100
bool Elf_() rz_bin_elf_get_dt_info(RZ_NONNULL ELFOBJ *bin, ut64 key, RZ_OUT ut64 *info)
Definition: elf_dynamic.c:120
bool Elf_() rz_bin_elf_is_relocatable(RZ_NONNULL ELFOBJ *bin)
Check if the elf binary is relocatable.
Definition: elf_info.c:1662
RZ_OWN char *Elf_() rz_bin_elf_strtab_get_dup(RZ_NONNULL RzBinElfStrtab *strtab, ut64 index)
Definition: elf_strtab.c:52
size_t Elf_() rz_bin_elf_get_number_of_symbols_from_gnu_hash_table(RZ_NONNULL ELFOBJ *bin)
Definition: elf_hash.c:106
#define EM_AARCH64
Definition: elf_specs.h:161
static bool convert_elf_symbol_entry(ELFOBJ *bin, struct symbols_segment *segment, RzBinElfSymbol *elf_symbol, Elf_(Sym) *symbol, size_t ordinal)
Definition: elf_symbols.c:215
static const struct symbol_type_translation symbol_type_translation_table[]
Definition: elf_symbols.c:41
static bool is_special_symbol(ELFOBJ *bin, Elf_(Sym) *sym, const char *name)
Definition: elf_symbols.c:119
static Elf_(Word)
Definition: elf_symbols.c:66
RZ_BORROW RzBinElfSymbol *Elf_() rz_bin_elf_get_symbol(RZ_NONNULL ELFOBJ *bin, ut32 ordinal)
Definition: elf_symbols.c:473
static const char * symbol_bind_to_str(Elf_(Sym) *sym)
Definition: elf_symbols.c:143
static bool filter_symbol(RZ_UNUSED ELFOBJ *bin, Elf_(Sym) *symbol, RZ_UNUSED bool is_dynamic)
Definition: elf_symbols.c:439
static bool get_symbol_entry(ELFOBJ *bin, ut64 offset, Elf_(Sym) *result)
Definition: elf_symbols.c:171
static bool has_already_been_processed(ELFOBJ *bin, ut64 offset, HtUU *set)
Definition: elf_symbols.c:243
static bool get_section_elf_symbols(ELFOBJ *bin, RzVector *result, RzBinElfSymbolFilter filter, HtUU *set)
Definition: elf_symbols.c:325
static bool get_gnu_debugdata_elf_symbols(ELFOBJ *bin, RzVector *result, RzBinElfSymbolFilter filter, HtUU *set)
Definition: elf_symbols.c:367
static bool compute_symbols_from_segment(ELFOBJ *bin, RzVector *result, struct symbols_segment *segment, RzBinElfSymbolFilter filter, HtUU *set)
Definition: elf_symbols.c:255
static struct symbols_segment symbols_segment_init(ut64 offset, ut64 number, ut64 entry_size, bool dynamic, RzBinElfStrtab *strtab)
Definition: elf_symbols.c:56
RZ_OWN RzVector *Elf_() rz_bin_elf_compute_symbols(ELFOBJ *bin, RzBinElfSymbolFilter filter)
Definition: elf_symbols.c:486
RZ_OWN RzVector *Elf_() rz_bin_elf_symbols_new(RZ_NONNULL ELFOBJ *bin)
Definition: elf_symbols.c:523
static bool is_section_local_symbol(ELFOBJ *bin, Elf_(Sym) *symbol)
Definition: elf_symbols.c:180
static struct symbol_bind_translation symbol_bind_translation_table[]
Definition: elf_symbols.c:30
static void elf_symbol_fini(void *e, RZ_UNUSED void *user)
Definition: elf_symbols.c:250
static const char * symbol_type_to_str(ELFOBJ *bin, RzBinElfSymbol *ret, Elf_(Sym) *sym)
Definition: elf_symbols.c:129
static bool set_elf_symbol_name(ELFOBJ *bin, struct symbols_segment *segment, RzBinElfSymbol *elf_symbol, Elf_(Sym) *symbol, RzBinElfSection *section)
Definition: elf_symbols.c:197
bool Elf_() rz_bin_elf_has_symbols(RZ_NONNULL ELFOBJ *bin)
Definition: elf_symbols.c:534
static bool is_special_arm_symbol(ELFOBJ *bin, Elf_(Sym) *sym, const char *name)
Definition: elf_symbols.c:100
static bool get_symbol_entry_aux(ELFOBJ *bin, ut64 offset, Elf_(Sym) *result)
Definition: elf_symbols.c:153
static bool get_dynamic_elf_symbols(ELFOBJ *bin, RzVector *result, RzBinElfSymbolFilter filter, HtUU *set)
Definition: elf_symbols.c:295
#define STB_NUM
Definition: glibc_elf.h:581
#define STT_NUM
Definition: glibc_elf.h:597
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
RZ_API const KEY_TYPE bool * found
Definition: ht_inc.h:130
voidpf uLong offset
Definition: ioapi.h:144
#define STT_COMMON
Definition: common.h:493
#define SHT_NULL
Definition: common.h:331
#define DT_SYMTAB
Definition: common.h:543
#define SHT_SYMTAB
Definition: common.h:333
#define STB_LOPROC
Definition: common.h:485
#define STV_DEFAULT
Definition: common.h:520
#define STT_HIPROC
Definition: common.h:500
#define STB_HIPROC
Definition: common.h:486
#define STT_HIOS
Definition: common.h:498
#define STB_LOCAL
Definition: common.h:480
#define STB_GLOBAL
Definition: common.h:481
#define STB_HIOS
Definition: common.h:484
#define STT_FILE
Definition: common.h:492
#define STT_FUNC
Definition: common.h:490
#define STT_SECTION
Definition: common.h:491
#define STT_NOTYPE
Definition: common.h:488
#define SHT_DYNSYM
Definition: common.h:342
#define ELF_ST_BIND(val)
Definition: common.h:455
#define SHN_UNDEF
Definition: common.h:505
#define STB_LOOS
Definition: common.h:483
#define STT_OBJECT
Definition: common.h:489
#define DT_SYMENT
Definition: common.h:548
#define STB_WEAK
Definition: common.h:482
#define EM_ARM
Definition: common.h:129
#define ELF_ST_VISIBILITY(v)
Definition: common.h:471
#define STT_TLS
Definition: common.h:494
#define ELF_ST_TYPE(val)
Definition: common.h:456
#define STT_LOPROC
Definition: common.h:499
#define STT_LOOS
Definition: common.h:497
#define DT_STRTAB
Definition: common.h:542
static bool filter(RzParse *p, ut64 addr, RzFlag *f, RzAnalysisHint *hint, char *data, char *str, int len, bool big_endian)
Definition: filter.c:185
int dynamic(struct state *s)
Definition: puff.c:665
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define RZ_BIN_TYPE_HIOS_STR
Definition: rz_bin.h:130
#define RZ_BIN_TYPE_COMMON_STR
Definition: rz_bin.h:126
#define RZ_BIN_BIND_WEAK_STR
Definition: rz_bin.h:108
#define RZ_BIN_BIND_HIPROC_STR
Definition: rz_bin.h:113
#define RZ_BIN_TYPE_OBJECT_STR
Definition: rz_bin.h:118
#define RZ_BIN_BIND_LOPROC_STR
Definition: rz_bin.h:112
#define RZ_BIN_TYPE_TLS_STR
Definition: rz_bin.h:127
#define RZ_BIN_TYPE_NOTYPE_STR
Definition: rz_bin.h:117
#define RZ_BIN_TYPE_NUM_STR
Definition: rz_bin.h:128
#define RZ_BIN_TYPE_LOOS_STR
Definition: rz_bin.h:129
#define RZ_BIN_TYPE_LOPROC_STR
Definition: rz_bin.h:131
#define RZ_BIN_BIND_HIOS_STR
Definition: rz_bin.h:111
#define RZ_BIN_BIND_NUM_STR
Definition: rz_bin.h:109
#define RZ_BIN_BIND_LOCAL_STR
Definition: rz_bin.h:106
#define RZ_BIN_BIND_LOOS_STR
Definition: rz_bin.h:110
#define RZ_BIN_BIND_GLOBAL_STR
Definition: rz_bin.h:107
#define RZ_BIN_TYPE_FILE_STR
Definition: rz_bin.h:125
#define RZ_BIN_TYPE_FUNC_STR
Definition: rz_bin.h:119
#define RZ_BIN_TYPE_HIPROC_STR
Definition: rz_bin.h:132
#define RZ_BIN_TYPE_UNKNOWN_STR
Definition: rz_bin.h:134
#define RZ_BIN_TYPE_SECTION_STR
Definition: rz_bin.h:124
#define RZ_BIN_TYPE_SPECIAL_SYM_STR
Definition: rz_bin.h:133
#define RZ_BIN_BIND_UNKNOWN_STR
Definition: rz_bin.h:115
RZ_API void rz_buf_free(RzBuffer *b)
Free all internal data hold by the buffer and the buffer.
Definition: buf.c:1253
RZ_API RZ_OWN RzBuffer * rz_buf_new_empty(ut64 len)
Creates a new empty buffer with a predefined size;.
Definition: buf.c:285
RZ_API RZ_OWN RzBuffer * rz_buf_new_slice(RzBuffer *b, ut64 offset, ut64 size)
Creates a new buffer from a slice of another buffer.
Definition: buf.c:364
RZ_API bool rz_lzma_dec_buf(RZ_NONNULL RzBuffer *src, RZ_NONNULL RzBuffer *dst, ut64 block_size, ut8 *src_consumed)
Decompress the src buffer with LZMA algorithm and put the decompressed data in dst.
Definition: compression.c:462
#define RZ_LOG_WARN(fmtstr,...)
Definition: rz_log.h:56
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
RZ_API char * rz_str_new(const char *str)
Definition: str.c:865
#define RZ_OWN
Definition: rz_types.h:62
#define RZ_UNUSED
Definition: rz_types.h:73
#define RZ_NONNULL
Definition: rz_types.h:64
#define RZ_ARRAY_SIZE(x)
Definition: rz_types.h:300
#define PFMT64x
Definition: rz_types.h:393
#define RZ_BORROW
Definition: rz_types.h:63
#define UT64_MAX
Definition: rz_types_base.h:86
RZ_API void * rz_vector_push(RzVector *vec, void *x)
Definition: vector.c:197
#define rz_vector_foreach(vec, it)
Definition: rz_vector.h:169
RZ_API void rz_vector_free(RzVector *vec)
Definition: vector.c:75
RZ_API RzVector * rz_vector_new(size_t elem_size, RzVectorFree free, void *free_user)
Definition: vector.c:42
static size_t rz_vector_len(const RzVector *vec)
Definition: rz_vector.h:82
Definition: malloc.c:26
Definition: zipcmp.c:77
Definition: z80asm.h:102
RZ_OWN char * name
Definition: elf.h:140
const char * bind
Definition: elf.h:138
const char * type
Definition: elf.h:139
ut64 baseaddr
where the linker maps the binary in memory
Definition: rz_bin.h:248
size_t len
Definition: rz_vector.h:47
uint32_t offset
uint32_t size
unsigned char bind
Definition: elf_symbols.c:21
unsigned char type
Definition: elf_symbols.c:26
RZ_BORROW RzBinElfStrtab * strtab
Definition: elf_symbols.c:17
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58