From 478a4593d2b7ee39a6821a242bc66c7cf1c94bba Mon Sep 17 00:00:00 2001 From: Yann Rouillard Date: Fri, 31 May 2013 21:01:25 +0200 Subject: [PATCH] Remove Table from GNU version sections class name --- elftools/elf/elffile.py | 16 ++++++++-------- elftools/elf/gnuversions.py | 12 ++++++------ scripts/readelf.py | 16 ++++++++-------- test/test_gnuversions.py | 10 +++++----- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/elftools/elf/elffile.py b/elftools/elf/elffile.py index 979ed2d..b15b1ec 100644 --- a/elftools/elf/elffile.py +++ b/elftools/elf/elffile.py @@ -17,8 +17,8 @@ from .sections import ( from .dynamic import DynamicSection, DynamicSegment from .relocation import RelocationSection, RelocationHandler from .gnuversions import ( - GNUVerNeedTableSection, GNUVerDefTableSection, - GNUVerSymTableSection) + GNUVerNeedSection, GNUVerDefSection, + GNUVerSymSection) from .segments import Segment, InterpSegment from .enums import ENUM_RELOC_TYPE_i386, ENUM_RELOC_TYPE_x64 from ..dwarf.dwarfinfo import DWARFInfo, DebugSectionDescriptor, DwarfConfig @@ -286,31 +286,31 @@ class ELFFile(object): symboltable=strtab_section) def _make_gnu_verneed_section(self, section_header, name): - """ Create a GNUVerNeedTableSection + """ Create a GNUVerNeedSection """ linked_strtab_index = section_header['sh_link'] strtab_section = self.get_section(linked_strtab_index) - return GNUVerNeedTableSection( + return GNUVerNeedSection( section_header, name, self.stream, elffile=self, stringtable=strtab_section) def _make_gnu_verdef_section(self, section_header, name): - """ Create a GNUVerDefTableSection + """ Create a GNUVerDefSection """ linked_strtab_index = section_header['sh_link'] strtab_section = self.get_section(linked_strtab_index) - return GNUVerDefTableSection( + return GNUVerDefSection( section_header, name, self.stream, elffile=self, stringtable=strtab_section) def _make_gnu_versym_section(self, section_header, name): - """ Create a GNUVerSymTableSection + """ Create a GNUVerSymSection """ linked_strtab_index = section_header['sh_link'] strtab_section = self.get_section(linked_strtab_index) - return GNUVerSymTableSection( + return GNUVerSymSection( section_header, name, self.stream, elffile=self, symboltable=strtab_section) diff --git a/elftools/elf/gnuversions.py b/elftools/elf/gnuversions.py index 79110d7..5965659 100644 --- a/elftools/elf/gnuversions.py +++ b/elftools/elf/gnuversions.py @@ -51,12 +51,12 @@ class VersionAuxiliary(object): return self.entry[name] -class GNUVerNeedTableSection(Section): +class GNUVerNeedSection(Section): """ ELF SUNW or GNU Version Needed table section. Has an associated StringTableSection that's passed in the constructor. """ def __init__(self, header, name, stream, elffile, stringtable): - super(GNUVerNeedTableSection, self).__init__(header, name, stream) + super(GNUVerNeedSection, self).__init__(header, name, stream) self.elffile = elffile self.elfstructs = self.elffile.structs self.stringtable = stringtable @@ -141,12 +141,12 @@ class GNUVerNeedTableSection(Section): entry_offset += entry['vn_next'] -class GNUVerDefTableSection(Section): +class GNUVerDefSection(Section): """ ELF SUNW or GNU Version Definition table section. Has an associated StringTableSection that's passed in the constructor. """ def __init__(self, header, name, stream, elffile, stringtable): - super(GNUVerDefTableSection, self).__init__(header, name, stream) + super(GNUVerDefSection, self).__init__(header, name, stream) self.elffile = elffile self.elfstructs = self.elffile.structs self.stringtable = stringtable @@ -214,12 +214,12 @@ class GNUVerDefTableSection(Section): entry_offset += entry['vd_next'] -class GNUVerSymTableSection(Section): +class GNUVerSymSection(Section): """ ELF SUNW or GNU Versym table section. Has an associated SymbolTableSection that's passed in the constructor. """ def __init__(self, header, name, stream, elffile, symboltable): - super(GNUVerSymTableSection, self).__init__(header, name, stream) + super(GNUVerSymSection, self).__init__(header, name, stream) self.elffile = elffile self.elfstructs = self.elffile.structs self.symboltable = symboltable diff --git a/scripts/readelf.py b/scripts/readelf.py index e516b66..06a6edd 100755 --- a/scripts/readelf.py +++ b/scripts/readelf.py @@ -26,8 +26,8 @@ from elftools.elf.enums import ENUM_D_TAG from elftools.elf.segments import InterpSegment from elftools.elf.sections import SymbolTableSection from elftools.elf.gnuversions import ( - GNUVerSymTableSection, GNUVerDefTableSection, - GNUVerNeedTableSection, + GNUVerSymSection, GNUVerDefSection, + GNUVerNeedSection, ) from elftools.elf.relocation import RelocationSection from elftools.elf.descriptions import ( @@ -424,7 +424,7 @@ class ReadElf(object): return for section in self.elffile.iter_sections(): - if isinstance(section, GNUVerSymTableSection): + if isinstance(section, GNUVerSymSection): self._print_version_section_header( section, 'Version symbols', lead0x=False) @@ -455,7 +455,7 @@ class ReadElf(object): self._emitline() - elif isinstance(section, GNUVerDefTableSection): + elif isinstance(section, GNUVerDefSection): self._print_version_section_header( section, 'Version definition', indent=2) @@ -488,7 +488,7 @@ class ReadElf(object): offset += verdef['vd_next'] - elif isinstance(section, GNUVerNeedTableSection): + elif isinstance(section, GNUVerNeedSection): self._print_version_section_header(section, 'Version needs') offset = 0 @@ -697,11 +697,11 @@ class ReadElf(object): 'verneed': None, 'type': None} for section in self.elffile.iter_sections(): - if isinstance(section, GNUVerSymTableSection): + if isinstance(section, GNUVerSymSection): self._versioninfo['versym'] = section - elif isinstance(section, GNUVerDefTableSection): + elif isinstance(section, GNUVerDefSection): self._versioninfo['verdef'] = section - elif isinstance(section, GNUVerNeedTableSection): + elif isinstance(section, GNUVerNeedSection): self._versioninfo['verneed'] = section elif isinstance(section, DynamicSection): for tag in section.iter_tags(): diff --git a/test/test_gnuversions.py b/test/test_gnuversions.py index a989aeb..8c1786a 100644 --- a/test/test_gnuversions.py +++ b/test/test_gnuversions.py @@ -15,8 +15,8 @@ setup_syspath() from elftools.elf.elffile import ELFFile from elftools.elf.constants import VER_FLAGS from elftools.elf.gnuversions import ( - GNUVerNeedTableSection, GNUVerDefTableSection, - GNUVerSymTableSection) + GNUVerNeedSection, GNUVerDefSection, + GNUVerSymSection) class TestSymbolVersioning(unittest.TestCase): @@ -57,7 +57,7 @@ class TestSymbolVersioning(unittest.TestCase): elf = ELFFile(f) versym_section = None for section in elf.iter_sections(): - if isinstance(section, GNUVerSymTableSection): + if isinstance(section, GNUVerSymSection): versym_section = section break @@ -87,7 +87,7 @@ class TestSymbolVersioning(unittest.TestCase): elf = ELFFile(f) verneed_section = None for section in elf.iter_sections(): - if isinstance(section, GNUVerNeedTableSection): + if isinstance(section, GNUVerNeedSection): verneed_section = section break @@ -137,7 +137,7 @@ class TestSymbolVersioning(unittest.TestCase): elf = ELFFile(f) verneed_section = None for section in elf.iter_sections(): - if isinstance(section, GNUVerDefTableSection): + if isinstance(section, GNUVerDefSection): verdef_section = section break -- 2.30.2