Tidy elf_segment_map allocation
This cleans up elf_segment_map allocation when the section array is
empty. "amt += (to - from - 1) * sizeof (asection *)", when "to" and
"from" are unsigned int results in an unsigned value inside the
parentheses. When "to" and "from" are equal on a 64-bit host,
0xffffffff * 8 is added to "amt", not -8 as desired.
The patch also renames a variable for consistency with other functions
using a similar index.
* elf.c (make_mapping): Cope with zero size array at end of
struct elf_segment_map.
(_bfd_elf_map_sections_to_segments): Likewise.
(rewrite_elf_program_header, copy_elf_program_header): Likewise.
(_bfd_elf_map_sections_to_segments): Rename phdr_index to hdr_index.