From 9e2e633e9ab165681733f3255e648a62b22e6368 Mon Sep 17 00:00:00 2001 From: cyanpencil Date: Mon, 25 Jan 2021 16:31:22 +0100 Subject: [PATCH] Support for old gcc .plt.sec --- librw/loader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/librw/loader.py b/librw/loader.py index 459ecf76..d26dd0c9 100644 --- a/librw/loader.py +++ b/librw/loader.py @@ -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):