Skip to content

Commit

Permalink
Speed up processing of symbols slightly, by not checking for each entry
Browse files Browse the repository at this point in the history
  • Loading branch information
zachriggle committed Jan 17, 2017
1 parent 9ace73a commit 300f8e0
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions pwnlib/elf/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,21 +545,14 @@ def _populate_symbols(self):
continue

for symbol in section.iter_symbols():
if not symbol.entry.st_value:
value = symbol.entry.st_value
if not value:
continue
self.symbols[symbol.name] = value

self.symbols[symbol.name] = symbol.entry.st_value

# Add 'plt.foo' and 'got.foo' to the symbols for entries,
# iff there is no symbol for that address
for sym, addr in self.plt.items():
if addr not in self.symbols.values():
self.symbols['plt.%s' % sym] = addr

for sym, addr in self.got.items():
if addr not in self.symbols.values():
self.symbols['got.%s' % sym] = addr

# Add 'plt.foo' and 'got.foo' to the symbols for entries
self.symbols.update({'plt.%s' % sym: addr for sym, addr in self.plt.items()})
self.symbols.update({'got.%s' % sym: addr for sym, addr in self.got.items()})

def _populate_got_plt(self):
"""Loads the GOT and the PLT symbols and addresses.
Expand Down

0 comments on commit 300f8e0

Please sign in to comment.