tools/android/elf_compression/elf_headers.py
def _OrderProgramHeaders(self):
    """Orders program LOAD headers by p_vaddr to comply with standard."""

    def HeaderToKey(phdr):
      # ELF standard required PT_INTERP and PT_PHDR to be strictly before
      # PT_LOAD.
      if phdr.p_type == ProgramHeader.Type.PT_INTERP:
        return (0, phdr.p_vaddr)
      elif phdr.p_type == ProgramHeader.Type.PT_PHDR:
        return (1, phdr.p_vaddr)
      elif phdr.p_type == ProgramHeader.Type.PT_LOAD:
        return (2, phdr.p_vaddr)
      else:
        # We want to preserve the order of non LOAD segments.
        return (3, 0)

    self.phdrs.sort(key=HeaderToKey)
Orders program LOAD headers by p_vaddr to comply with standard.
Orders program LOAD headers by p_vaddr to comply with standard.
Orders program LOAD headers by p_vaddr to comply with standard .
def _OrderProgramHeaders(self):
    def HeaderToKey(phdr):
      if phdr.p_type == ProgramHeader.Type.PT_INTERP:
        return (0, phdr.p_vaddr)
      elif phdr.p_type == ProgramHeader.Type.PT_PHDR:
        return (1, phdr.p_vaddr)
      elif phdr.p_type == ProgramHeader.Type.PT_LOAD:
        return (2, phdr.p_vaddr)
      else:
        return (3, 0)
    self.phdrs.sort(key=HeaderToKey)
def _OrderProgramHeaders ( self ) : def HeaderToKey ( phdr ) : if phdr . p_type == ProgramHeader . Type . PT_INTERP : return ( 0 , phdr . p_vaddr ) elif phdr . p_type == ProgramHeader . Type . PT_PHDR : return ( 1 , phdr . p_vaddr ) elif phdr . p_type == ProgramHeader . Type . PT_LOAD : return ( 2 , phdr . p_vaddr ) else : return ( 3 , 0 ) self . phdrs . sort ( key = HeaderToKey )
Orders program LOAD headers by p_vaddr to comply with standard.
Orders program LOAD headers by p_vaddr to comply with standard .
"""Orders program LOAD headers by p_vaddr to comply with standard.""" # ELF standard required PT_INTERP and PT_PHDR to be strictly before # PT_LOAD. # We want to preserve the order of non LOAD segments.
self