61cb3a6
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.32/bfd/elf-bfd.h
61cb3a6
--- binutils.orig/bfd/elf-bfd.h	2019-07-02 16:03:41.758007318 +0100
61cb3a6
+++ binutils-2.32/bfd/elf-bfd.h	2019-07-02 16:04:02.025862020 +0100
61cb3a6
@@ -2749,6 +2749,8 @@ extern bfd_vma elf64_r_sym (bfd_vma);
61cb3a6
 extern bfd_vma elf32_r_info (bfd_vma, bfd_vma);
61cb3a6
 extern bfd_vma elf32_r_sym (bfd_vma);
61cb3a6
 
61cb3a6
+extern bfd_boolean is_debuginfo_file (bfd *);
61cb3a6
+
61cb3a6
 /* Large common section.  */
61cb3a6
 extern asection _bfd_elf_large_com_section;
61cb3a6
 
61cb3a6
Only in binutils-2.32/bfd: elf-bfd.h.orig
61cb3a6
diff -rup binutils.orig/bfd/elf.c binutils-2.32/bfd/elf.c
61cb3a6
--- binutils.orig/bfd/elf.c	2019-07-02 16:03:42.101004858 +0100
61cb3a6
+++ binutils-2.32/bfd/elf.c	2019-07-02 16:04:23.909705141 +0100
61cb3a6
@@ -5807,6 +5807,35 @@ assign_file_positions_for_load_sections
61cb3a6
   return TRUE;
61cb3a6
 }
61cb3a6
 
61cb3a6
+/* Determine if a bfd is a debuginfo file.  Unfortunately there
61cb3a6
+   is no defined method for detecting such files, so we have to
61cb3a6
+   use heuristics instead.  */
61cb3a6
+
61cb3a6
+bfd_boolean
61cb3a6
+is_debuginfo_file (bfd *abfd)
61cb3a6
+{
61cb3a6
+  if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_elf_flavour)
61cb3a6
+    return FALSE;
61cb3a6
+
61cb3a6
+  Elf_Internal_Shdr **start_headers = elf_elfsections (abfd);
61cb3a6
+  Elf_Internal_Shdr **end_headers = start_headers + elf_numsections (abfd);
61cb3a6
+  Elf_Internal_Shdr **headerp;
61cb3a6
+
61cb3a6
+  for (headerp = start_headers; headerp < end_headers; headerp ++)
61cb3a6
+    {
61cb3a6
+      Elf_Internal_Shdr *header = * headerp;
61cb3a6
+
61cb3a6
+      /* Debuginfo files do not have any allocated SHT_PROGBITS sections.
61cb3a6
+	 The only allocated sections are SHT_NOBITS or SHT_NOTES.  */
61cb3a6
+      if ((header->sh_flags & SHF_ALLOC) == SHF_ALLOC
61cb3a6
+	  && header->sh_type != SHT_NOBITS
61cb3a6
+	  && header->sh_type != SHT_NOTE)
61cb3a6
+	return FALSE;
61cb3a6
+    }
61cb3a6
+
61cb3a6
+  return TRUE;
61cb3a6
+}
61cb3a6
+
61cb3a6
 /* Assign file positions for the other sections.  */
61cb3a6
 
61cb3a6
 static bfd_boolean
61cb3a6
@@ -5840,7 +5869,13 @@ assign_file_positions_for_non_load_secti
61cb3a6
 	BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
61cb3a6
       else if ((hdr->sh_flags & SHF_ALLOC) != 0)
61cb3a6
 	{
61cb3a6
-	  if (hdr->sh_size != 0)
61cb3a6
+	  if (hdr->sh_size != 0
61cb3a6
+	      /* PR 24717 - debuginfo files are known to be not strictly
61cb3a6
+		 compliant with the ELF standard.  In particular they often
61cb3a6
+		 have .note.gnu.property sections that are outside of any
61cb3a6
+		 loadable segment.  This is not a problem for such files,
61cb3a6
+		 so do not warn about them.  */
61cb3a6
+	      && ! is_debuginfo_file (abfd))
61cb3a6
 	    _bfd_error_handler
61cb3a6
 	      /* xgettext:c-format */
61cb3a6
 	      (_("%pB: warning: allocated section `%s' not in segment"),
61cb3a6
Only in binutils-2.32/bfd: elf.c.orig