Don't let a single unrecognized ELF section break target matching.
bfd/
* elfcode.h (elf_object_p): Ignore errors from individual
bfd_section_from_shdr calls so a novel section type appearing in
the input doesn't break target-matching.
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8e8dc99..789f6cf 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2020-07-29 Roland McGrath <mcgrathr@google.com>
+
+ * elfcode.h (elf_object_p): Ignore errors from individual
+ bfd_section_from_shdr calls so a novel section type appearing in
+ the input doesn't break target-matching.
+
2020-07-29 Alan Modra <amodra@gmail.com>
* elflink.c (bfd_elf_final_link): Don't segfault on local dynsyms
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 2e2c534..f65160c 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -816,8 +816,11 @@
a dummy placeholder entry, so we ignore it. */
num_sec = elf_numsections (abfd);
for (shindex = 1; shindex < num_sec; shindex++)
- if (!bfd_section_from_shdr (abfd, shindex))
- goto got_no_match;
+ /* Ignore the return value here since an unrecognized section type
+ doesn't make the entire file unusable. The unrecognized section
+ simply won't be examined, and bfd_section_from_shdr will have
+ emitted an error message. */
+ bfd_section_from_shdr (abfd, shindex);
/* Set up ELF sections for SHF_GROUP and SHF_LINK_ORDER. */
if (! _bfd_elf_setup_sections (abfd))