diff options
| author | Camille Mougey <commial@gmail.com> | 2017-03-26 03:17:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-26 03:17:14 +0200 |
| commit | 411603f8985def77a9785ba65cc6abf8dd8aa919 (patch) | |
| tree | 49e11e7d657d1800c04c99293a375a6534d3f137 | |
| parent | 7bb3dc12e22251f913201713f1be32799f4981cd (diff) | |
| parent | aaf55a1e2d620015756367d929bcfa04ee0ce9ab (diff) | |
| download | miasm-411603f8985def77a9785ba65cc6abf8dd8aa919.tar.gz miasm-411603f8985def77a9785ba65cc6abf8dd8aa919.zip | |
Merge pull request #505 from serpilliere/elf_infos
Container: add dynsym symbols
| -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 |