be6651
diff -rup binutils-2.27.orig/bfd/elf-eh-frame.c binutils-2.27/bfd/elf-eh-frame.c
be6651
--- binutils-2.27.orig/bfd/elf-eh-frame.c	2017-01-16 17:27:46.411632857 +0000
be6651
+++ binutils-2.27/bfd/elf-eh-frame.c	2017-01-16 17:30:03.663437755 +0000
be6651
@@ -2296,7 +2296,15 @@ write_dwarf_eh_frame_hdr (bfd *abfd, str
be6651
 		  != sec->output_section->vma + val))
be6651
 	    overflow = TRUE;
be6651
 	  bfd_put_32 (abfd, val, contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
be6651
-	  if (i != 0
be6651
+	  if (i > 0
be6651
+	      && hdr_info->u.dwarf.array[i].initial_loc
be6651
+	      == hdr_info->u.dwarf.array[i - 1].initial_loc
be6651
+	      && hdr_info->u.dwarf.array[i].range
be6651
+	      == hdr_info->u.dwarf.array[i - 1].range)
be6651
+	    /* Duplicate FDE entry.  We should probably discard it
be6651
+	       but for now just ignore it.  */
be6651
+	    ;
be6651
+	  else if (i != 0
be6651
 	      && (hdr_info->u.dwarf.array[i].initial_loc
be6651
 		  < (hdr_info->u.dwarf.array[i - 1].initial_loc
be6651
 		     + hdr_info->u.dwarf.array[i - 1].range)))