def elf_segment_names(elf):
    """Return a hash of elf segment names, indexed by segment number."""
    table = {}

    seg_names_sect = elf.find_section_named(".segment_names")

    if seg_names_sect is not None:
        names = seg_names_sect.get_strings()[1:]

        for i in range(len(names)):
            table[i] = names[i]

    return table