Skip to content

Commit

Permalink
Support for old gcc .plt.sec
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanpencil committed Jan 25, 2021
1 parent af17e0c commit 9e2e633
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions librw/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ def load_data_sections(self, seclist, section_filter=lambda x: True):
for sec in seclist:
if sec == '.plt':
self.container.plt_base = seclist[sec]['base']
if sec == ".plt.got":
if sec == '.plt.sec': # support old gcc version, skip one plt entry
self.container.plt_base = seclist[sec]['base'] - 16
if sec == ".plt.got" or sec == ".plt.sec":
section = self.elffile.get_section_by_name(sec)
data = section.data()
entries = list(
disasm_bytes(section.data(), seclist[sec]['base']))
self.container.gotplt_base = seclist[sec]['base']
self.container.gotplt_sz = seclist[sec]['sz']
self.container.gotplt_sz = seclist[sec]['sz'] + 16
self.container.gotplt_entries = entries

def load_relocations(self, relocs):
Expand Down

0 comments on commit 9e2e633

Please sign in to comment.