title: How to get the name of a segment by using its `Elf64_Phdr` program header?
body: <p>As I know, a ELF object consists of a number of segments, each of which has a corresponding program header describing the segment. In <code>libelf</code>, a program header is defined as a <code>Elf64_Phdr</code> (or <code>Elf32_Phdr</code>) structure, and a <code>Elf64_Phdr</code> structure is defined like this:</p>
  
  <pre><code>typedef struct {
      Elf32_Word  p_type;    /* Segment type */
      Elf32_Off   p_offset;  /* Segment file offset */
      Elf32_Addr  p_vaddr;   /* Segment virtual address */
      Elf32_Addr  p_paddr;   /* Segment physical address */
      Elf32_Word  p_filesz;  /* Segment size in file */
      Elf32_Word  p_memsz;   /* Segment size in memory */
      Elf32_Word  p_flags;   /* Segment flags */
      Elf32_Word  p_align;   /* Segment alignment */
  } Elf32_Phdr;
  </code></pre>
  
  <p>However, segments have names (don't they?) and <code>Elf64_Phdr</code> structures don't have a field which points to their corresponding names. So, how to get a name of a segment of an ELF file from its corresponding program header? Or is the <code>p_type</code> field enough to identify a segment, so that segments don't have names?</p>