Blame SOURCES/binutils-2.28-dynamic-section-warning.patch

0b07f1
diff -rup binutils.orig/binutils/readelf.c binutils-2.28/binutils/readelf.c
0b07f1
--- binutils.orig/binutils/readelf.c	2017-03-20 17:06:41.260789454 +0000
0b07f1
+++ binutils-2.28/binutils/readelf.c	2017-03-20 17:08:09.181289807 +0000
0b07f1
@@ -4965,12 +4965,6 @@ process_program_headers (FILE * file)
0b07f1
 	     section in the DYNAMIC segment.  */
0b07f1
 	  dynamic_addr = segment->p_offset;
0b07f1
 	  dynamic_size = segment->p_filesz;
0b07f1
-	  /* PR binutils/17512: Avoid corrupt dynamic section info in the segment.  */
0b07f1
-	  if (dynamic_addr + dynamic_size >= current_file_size)
0b07f1
-	    {
0b07f1
-	      error (_("the dynamic segment offset + size exceeds the size of the file\n"));
0b07f1
-	      dynamic_addr = dynamic_size = 0;
0b07f1
-	    }
0b07f1
 
0b07f1
 	  /* Try to locate the .dynamic section. If there is
0b07f1
 	     a section header table, we can easily locate it.  */
0b07f1
@@ -5005,6 +4999,16 @@ process_program_headers (FILE * file)
0b07f1
 		warn (_("the .dynamic section is not the first section"
0b07f1
 			" in the dynamic segment.\n"));
0b07f1
 	    }
0b07f1
+
0b07f1
+	  /* PR binutils/17512: Avoid corrupt dynamic section info in the
0b07f1
+	     segment.  Check this after matching against the section headers
0b07f1
+	     so we don't warn on debuginfo file (which have NOBITS .dynamic
0b07f1
+	     sections).  */
0b07f1
+	  if (dynamic_addr + dynamic_size >= current_file_size)
0b07f1
+	    {
0b07f1
+	      error (_("the dynamic segment offset + size exceeds the size of the file\n"));
0b07f1
+	      dynamic_addr = dynamic_size = 0;
0b07f1
+	    }
0b07f1
 	  break;
0b07f1
 
0b07f1
 	case PT_INTERP: