diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-03-25 20:29:15 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-03-25 20:34:53 +0100 |
| commit | aaf55a1e2d620015756367d929bcfa04ee0ce9ab (patch) | |
| tree | 49e11e7d657d1800c04c99293a375a6534d3f137 /miasm2/analysis/binary.py | |
| parent | 7bb3dc12e22251f913201713f1be32799f4981cd (diff) | |
| download | focaccia-miasm-aaf55a1e2d620015756367d929bcfa04ee0ce9ab.tar.gz focaccia-miasm-aaf55a1e2d620015756367d929bcfa04ee0ce9ab.zip | |
Container: add dynsym symbols
Diffstat (limited to 'miasm2/analysis/binary.py')
| -rw-r--r-- | miasm2/analysis/binary.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/miasm2/analysis/binary.py b/miasm2/analysis/binary.py index 4ff9dac0..6073e126 100644 --- a/miasm2/analysis/binary.py +++ b/miasm2/analysis/binary.py @@ -194,19 +194,23 @@ class ContainerELF(Container): raise ContainerParsingException('Cannot read ELF: %s' % error) # Add known symbols - symtab = self._executable.getsectionbyname(".symtab") - if symtab is not None: - for name, symb in symtab.symbols.iteritems(): + for symb_source_name in [".symtab", ".dynsym"]: + symb_source = self._executable.getsectionbyname(symb_source_name) + if symb_source is None: + continue + for name, symb in symb_source.symbols.iteritems(): offset = symb.value - if offset != 0: - try: - self._symbol_pool.add_label(name, offset) - except ValueError: - # Two symbols points on the same offset - log.warning("Same offset (%s) for %s and %s", (hex(offset), - name, - self._symbol_pool.getby_offset(offset))) - continue + if offset == 0: + continue + try: + self._symbol_pool.add_label(name, offset) + except ValueError: + # Two symbols points on the same offset + log.warning("Same offset (%s) for %s and %s", + (hex(offset), + name, + self._symbol_pool.getby_offset(offset))) + continue |