More renaming & cleaning up
authorEli Bendersky <eliben@gmail.com>
Sat, 25 May 2013 13:10:23 +0000 (06:10 -0700)
committerEli Bendersky <eliben@gmail.com>
Sat, 25 May 2013 13:10:23 +0000 (06:10 -0700)
elftools/elf/elffile.py
elftools/elf/enums.py
elftools/elf/sections.py
elftools/elf/structs.py

index 7e18c92b408e54b38ef6c77c1e6ff174bf75b830..a8e605ffad8e8bde0b89fc73d8a6976cc124cdca 100644 (file)
@@ -265,7 +265,7 @@ class ELFFile(object):
             stringtable=strtab_section)
 
     def _make_sunwsyminfo_table_section(self, section_header, name):
-        """ Create a SymbolTableSection
+        """ Create a SUNWSyminfoTableSection
         """
         linked_strtab_index = section_header['sh_link']
         strtab_section = self.get_section(linked_strtab_index)
index 2c3028236a1a77bd9ff3ab366973b947ad1f1661..121c287be2154cd67ee394f61c429a0173da1018 100644 (file)
@@ -447,8 +447,8 @@ ENUM_RELOC_TYPE_x64 = dict(
     _default_=Pass,
 )
 
-# Syminfo Bound To special values
-ENUM_SYMINFO_BOUNDTO = dict(
+# Sunw Syminfo Bound To special values
+ENUM_SUNW_SYMINFO_BOUNDTO = dict(
     SYMINFO_BT_SELF=0xffff,
     SYMINFO_BT_PARENT=0xfffe,
     SYMINFO_BT_NONE=0xfffd,
index 1446ccf9d114eddebea2e34f9f3f9f7071a4fcbb..ce6245057ee798380755e0e60c426bc144897d15 100644 (file)
@@ -13,7 +13,7 @@ from ..common.utils import struct_parse, elf_assert, parse_cstring_from_stream
 class Section(object):
     """ Base class for ELF sections. Also used for all sections types that have
         no special functionality.
-        
+
         Allows dictionary-like access to the section header. For example:
          > sec = Section(...)
          > sec['sh_type']  # section type
@@ -22,7 +22,7 @@ class Section(object):
         self.header = header
         self.name = name
         self.stream = stream
-    
+
     def data(self):
         """ The section data from the file.
         """
@@ -33,7 +33,7 @@ class Section(object):
         """ Is this a null section?
         """
         return False
-        
+
     def __getitem__(self, name):
         """ Implement dict-like access to header entries
         """
@@ -51,14 +51,14 @@ class NullSection(Section):
 
     def is_null(self):
         return True
-        
+
 
 class StringTableSection(Section):
     """ ELF string table section.
     """
     def __init__(self, header, name, stream):
         super(StringTableSection, self).__init__(header, name, stream)
-        
+
     def get_string(self, offset):
         """ Get the string stored at the given offset in this string table.
         """
@@ -85,7 +85,7 @@ class SymbolTableSection(Section):
         """ Number of symbols in the table
         """
         return self['sh_size'] // self['sh_entsize']
-        
+
     def get_symbol(self, n):
         """ Get the symbol at index #n from the table (Symbol object)
         """
@@ -139,14 +139,14 @@ class SUNWSyminfoTableSection(Section):
         return self['sh_size'] // self['sh_entsize'] - 1
 
     def get_symbol(self, n):
-        """ Get the symbol at index #n from the table (Symbol object)
+        """ Get the symbol at index #n from the table (Symbol object).
             It begins at 1 and not 0 since the first entry is used to
-            store the current version of the syminfo table
+            store the current version of the syminfo table.
         """
         # Grab the symbol's entry from the stream
         entry_offset = self['sh_offset'] + n * self['sh_entsize']
         entry = struct_parse(
-            self.elfstructs.Elf_Syminfo,
+            self.elfstructs.Elf_Sunw_Syminfo,
             self.stream,
             stream_pos=entry_offset)
         # Find the symbol name in the associated symbol table
index 93edd1305c29804fb0757153d546667efbe6756a..72d07fab7fd21e6b109297afb2ce320f186695b4 100644 (file)
@@ -19,20 +19,20 @@ from .enums import *
 
 class ELFStructs(object):
     """ Accessible attributes:
-    
+
             Elf_{byte|half|word|word64|addr|offset|sword|xword|xsword}:
-                Data chunks, as specified by the ELF standard, adjusted for 
+                Data chunks, as specified by the ELF standard, adjusted for
                 correct endianness and word-size.
 
             Elf_Ehdr:
                 ELF file header
-            
+
             Elf_Phdr:
                 Program header
-            
+
             Elf_Shdr:
                 Section header
-            
+
             Elf_Sym:
                 Symbol table entry
 
@@ -42,9 +42,9 @@ class ELFStructs(object):
     def __init__(self, little_endian=True, elfclass=32):
         assert elfclass == 32 or elfclass == 64
         self.little_endian = little_endian
-        self.elfclass = elfclass        
+        self.elfclass = elfclass
         self._create_structs()
-    
+
     def _create_structs(self):
         if self.little_endian:
             self.Elf_byte = ULInt8
@@ -66,15 +66,15 @@ class ELFStructs(object):
             self.Elf_sword = SBInt32
             self.Elf_xword = UBInt32 if self.elfclass == 32 else UBInt64
             self.Elf_sxword = SBInt32 if self.elfclass == 32 else SBInt64
-        
+
         self._create_ehdr()
         self._create_phdr()
         self._create_shdr()
         self._create_sym()
         self._create_rel()
         self._create_dyn()
-        self._create_syminfo()
-    
+        self._create_sunw_syminfo()
+
     def _create_ehdr(self):
         self.Elf_Ehdr = Struct('Elf_Ehdr',
             Struct('e_ident',
@@ -100,7 +100,7 @@ class ELFStructs(object):
             self.Elf_half('e_shnum'),
             self.Elf_half('e_shstrndx'),
         )
-    
+
     def _create_phdr(self):
         if self.elfclass == 32:
             self.Elf_Phdr = Struct('Elf_Phdr',
@@ -123,8 +123,8 @@ class ELFStructs(object):
                 self.Elf_xword('p_filesz'),
                 self.Elf_xword('p_memsz'),
                 self.Elf_xword('p_align'),
-            )   
-        
+            )
+
     def _create_shdr(self):
         self.Elf_Shdr = Struct('Elf_Shdr',
             self.Elf_word('sh_name'),
@@ -138,7 +138,7 @@ class ELFStructs(object):
             self.Elf_xword('sh_addralign'),
             self.Elf_xword('sh_entsize'),
         )
-    
+
     def _create_rel(self):
         # r_info is also taken apart into r_info_sym and r_info_type.
         # This is done in Value to avoid endianity issues while parsing.
@@ -204,8 +204,8 @@ class ELFStructs(object):
                 self.Elf_xword('st_size'),
             )
 
-    def _create_syminfo(self):
-        self.Elf_Syminfo = Struct('Elf_Syminfo',
-            Enum(self.Elf_half('si_boundto'), **ENUM_SYMINFO_BOUNDTO),
+    def _create_sunw_syminfo(self):
+        self.Elf_Sunw_Syminfo = Struct('Elf_Sunw_Syminfo',
+            Enum(self.Elf_half('si_boundto'), **ENUM_SUNW_SYMINFO_BOUNDTO),
             self.Elf_half('si_flags'),
         )