bool Target::isSuitable()
{
  enum
  {
    CMP_SIZE_1 = offsetof(Elf32_Ehdr, e_entry),
    CMP_SIZE_2 = offsetof(Elf32_Ehdr, e_shentsize)
    - offsetof(Elf32_Ehdr, e_flags)
  };
  Elf32_Ehdr* self = (Elf32_Ehdr*)0x8048000;
  Elf32_Phdr* self_phdr = (Elf32_Phdr*)((char*)self + self->e_phoff);
  phdr = (Elf32_Phdr*)(p.b + p.ehdr->e_phoff);

  if (0 != memcmp(&p.ehdr->e_ident, &self->e_ident, CMP_SIZE_1))
    return false;
  if (p.ehdr->e_phoff != self->e_phoff)
    return false;
  if (0 != memcmp(&p.ehdr->e_flags, &self->e_flags, CMP_SIZE_2))
    return false;

  /* the type of these headers must be PT_LOAD */
  if (phdr[2].p_type != self_phdr[2].p_type)
    return false;
  if (phdr[3].p_type != self_phdr[3].p_type)
    return false;

  /* a code segment with trailing 0-bytes makes no sense, anyway */
  if (phdr[2].p_filesz != phdr[2].p_memsz)
    return false;

  end_of_cs = phdr[2].p_offset + phdr[2].p_filesz;
  aligned_end_of_cs = alignUp(end_of_cs);

  return true;
}
