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