From: Eli Bendersky Date: Wed, 14 Sep 2011 03:18:28 +0000 (+0300) Subject: added segment attribute formatting for 64-bit, and fixed some words to xwords in... X-Git-Tag: v0.10~125 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a41c3c06ed272a45f1a8593b3e516bdea900ff03;p=pyelftools.git added segment attribute formatting for 64-bit, and fixed some words to xwords in the segment struct definition --- diff --git a/elftools/elf/structs.py b/elftools/elf/structs.py index bb685cf..5808820 100644 --- a/elftools/elf/structs.py +++ b/elftools/elf/structs.py @@ -112,9 +112,9 @@ class ELFStructs(object): self.Elf_offset('p_offset'), self.Elf_addr('p_vaddr'), self.Elf_addr('p_paddr'), - self.Elf_word('p_filesz'), - self.Elf_word('p_memsz'), - self.Elf_word('p_align'), + self.Elf_xword('p_filesz'), + self.Elf_xword('p_memsz'), + self.Elf_xword('p_align'), ) def _create_shdr(self): diff --git a/scripts/readelf.py b/scripts/readelf.py index 982add4..2b21549 100644 --- a/scripts/readelf.py +++ b/scripts/readelf.py @@ -129,6 +129,18 @@ class ReadElf(object): self._format_hex(segment['p_memsz'], fieldsize=5), describe_p_flags(segment['p_flags']), self._format_hex(segment['p_align']))) + else: # 64 + self._emitline('%s %s %s' % ( + self._format_hex(segment['p_offset'], fullhex=True), + self._format_hex(segment['p_vaddr'], fullhex=True), + self._format_hex(segment['p_paddr'], fullhex=True))) + self._emitline(' %s %s %-3s %s' % ( + self._format_hex(segment['p_filesz'], fullhex=True), + self._format_hex(segment['p_memsz'], fullhex=True), + describe_p_flags(segment['p_flags']), + # lead0x set to False for p_align, to mimic readelf. + # No idea why the difference from 32-bit mode :-| + self._format_hex(segment['p_align'], lead0x=False))) if isinstance(segment, InterpSegment): self._emitline(' [Requesting program interpreter: %s]' %