Blame SOURCES/binutils-do-not-warn-about-debuginfo-files.patch

0519c2
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
0519c2
--- binutils.orig/bfd/elf-bfd.h	2020-04-06 13:08:43.081659992 +0100
0519c2
+++ binutils-2.30/bfd/elf-bfd.h	2020-04-06 13:09:17.040517295 +0100
0519c2
@@ -2722,6 +2722,8 @@ extern unsigned int _bfd_elf_symbol_sect
0519c2
   (bfd *, elf_symbol_type *);
0519c2
 
0519c2
 
0519c2
+extern bfd_boolean is_debuginfo_file (bfd *);
0519c2
+
0519c2
 /* Large common section.  */
0519c2
 extern asection _bfd_elf_large_com_section;
0519c2
 
0519c2
Only in binutils-2.30/bfd: elf-bfd.h.orig
0519c2
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
0519c2
--- binutils.orig/bfd/elf.c	2020-04-06 13:08:43.104659896 +0100
0519c2
+++ binutils-2.30/bfd/elf.c	2020-04-06 13:09:17.042517287 +0100
0519c2
@@ -5749,6 +5749,35 @@ assign_file_positions_for_load_sections
0519c2
 #define IS_TBSS(s) \
0519c2
   ((s->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) == SEC_THREAD_LOCAL)
0519c2
 
0519c2
+/* Determine if a bfd is a debuginfo file.  Unfortunately there
0519c2
+   is no defined method for detecting such files, so we have to
0519c2
+   use heuristics instead.  */
0519c2
+
0519c2
+bfd_boolean
0519c2
+is_debuginfo_file (bfd *abfd)
0519c2
+{
0519c2
+  if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_elf_flavour)
0519c2
+    return FALSE;
0519c2
+
0519c2
+  Elf_Internal_Shdr **start_headers = elf_elfsections (abfd);
0519c2
+  Elf_Internal_Shdr **end_headers = start_headers + elf_numsections (abfd);
0519c2
+  Elf_Internal_Shdr **headerp;
0519c2
+
0519c2
+  for (headerp = start_headers; headerp < end_headers; headerp ++)
0519c2
+    {
0519c2
+      Elf_Internal_Shdr *header = * headerp;
0519c2
+
0519c2
+      /* Debuginfo files do not have any allocated SHT_PROGBITS sections.
0519c2
+	 The only allocated sections are SHT_NOBITS or SHT_NOTES.  */
0519c2
+      if ((header->sh_flags & SHF_ALLOC) == SHF_ALLOC
0519c2
+	  && header->sh_type != SHT_NOBITS
0519c2
+	  && header->sh_type != SHT_NOTE)
0519c2
+	return FALSE;
0519c2
+    }
0519c2
+
0519c2
+  return TRUE;
0519c2
+}
0519c2
+
0519c2
 /* Assign file positions for the other sections.  */
0519c2
 
0519c2
 static bfd_boolean
0519c2
@@ -5782,7 +5811,13 @@ assign_file_positions_for_non_load_secti
0519c2
 	BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
0519c2
       else if ((hdr->sh_flags & SHF_ALLOC) != 0)
0519c2
 	{
0519c2
-	  if (hdr->sh_size != 0)
0519c2
+	  if (hdr->sh_size != 0
0519c2
+	      /* PR 24717 - debuginfo files are known to be not strictly
0519c2
+		 compliant with the ELF standard.  In particular they often
0519c2
+		 have .note.gnu.property sections that are outside of any
0519c2
+		 loadable segment.  This is not a problem for such files,
0519c2
+		 so do not warn about them.  */
0519c2
+	      && ! is_debuginfo_file (abfd))
0519c2
 	    _bfd_error_handler
0519c2
 	      /* xgettext:c-format */
0519c2
 	      (_("%B: warning: allocated section `%s' not in segment"),
0519c2
Only in binutils-2.30/bfd: elf.c.orig