return StringTableSection(section_header, name, self.stream)
elif sectype == 'SHT_NULL':
return NullSection(section_header, name, self.stream)
- elif sectype in ('SHT_SYMTAB', 'SHT_DYNSYM'):
+ elif sectype in ('SHT_SYMTAB', 'SHT_DYNSYM', 'SHT_SUNW_LDYNSYM'):
return self._make_symbol_table_section(section_header, name)
elif sectype == 'SHT_SUNW_syminfo':
return self._make_sunwsyminfo_table_section(section_header, name)
SHT_LOUSER=0x80000000,
SHT_HIUSER=0xffffffff,
SHT_AMD64_UNWIND=0x70000001,
+ SHT_SUNW_LDYNSYM=0x6ffffff3,
SHT_SUNW_syminfo=0x6ffffffc,
SHT_ARM_EXIDX=0x70000001,
SHT_ARM_PREEMPTMAP=0x70000002,
except ImportError:
import unittest
import os
+import copy
from utils import setup_syspath; setup_syspath()
from elftools.elf.elffile import ELFFile
def test_SUNW_syminfo_section_sparc64(self):
self._test_SUNW_syminfo_section_generic('exe_solaris64_cc.elf.sparc')
+ ldsynsym_reference_data = [b'', b'exe_solaris32.elf', b'crti.s', b'crt1.o',
+ b'crt1.s', b'fsr.s', b'values-Xa.c',
+ b'exe_solaris64.elf.c', b'crtn.s']
+
+ def _test_SUNW_ldynsym_section_generic(self, testfile, reference_data):
+ with open(os.path.join('test', 'testfiles_for_unittests',
+ testfile), 'rb') as f:
+ elf = ELFFile(f)
+ ldynsym_section = elf.get_section_by_name(b'.SUNW_ldynsym')
+ self.assertIsNotNone(ldynsym_section)
+
+ for symbol, ref_symbol_name in zip(
+ ldynsym_section.iter_symbols(), reference_data):
+
+ self.assertEqual(symbol.name, ref_symbol_name)
+
+ def test_SUNW_ldynsym_section_x86(self):
+ reference_data = TestSolarisSupport.ldsynsym_reference_data
+ self._test_SUNW_ldynsym_section_generic('exe_solaris32_cc.elf',
+ reference_data)
+
+ def test_SUNW_ldynsym_section_x64(self):
+ reference_data = copy.deepcopy(
+ TestSolarisSupport.ldsynsym_reference_data)
+ reference_data[1] = b'exe_solaris64.elf'
+ reference_data[3] = b'crt1x.o'
+ reference_data[5] = b'fsrx.s'
+ self._test_SUNW_ldynsym_section_generic('exe_solaris64_cc.elf',
+ reference_data)
+
if __name__ == '__main__':
unittest.main()