aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2019-08-23 13:22:02 +0100
committerNick Clifton <nickc@redhat.com>2019-08-23 13:22:02 +0100
commita7ba389645d178c43100ec47e513389ae8bf8f93 (patch)
treea7649e5de50bd8aa8e8f8021d880fe4d30ac46dd /bfd/elf.c
parent2600d80ccd04666f28608364be74d7ee552977ae (diff)
downloadgdb-a7ba389645d178c43100ec47e513389ae8bf8f93.zip
gdb-a7ba389645d178c43100ec47e513389ae8bf8f93.tar.gz
gdb-a7ba389645d178c43100ec47e513389ae8bf8f93.tar.bz2
Stop the BFD library from failing when encountering a second set of relocs for the same section.
PR 24456 * elf.c (bfd_section_from_shdr): Issue an informative warning message and continue processing other sections after encountering a reloc section for a section which already has other relocs associated with it.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 42ae162..5a061c9 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2466,9 +2466,18 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
else
p_hdr = &esdt->rel.hdr;
- /* PR 17512: file: 0b4f81b7. */
+ /* PR 17512: file: 0b4f81b7.
+ Also see PR 24456, for a file which deliberately has two reloc
+ sections. */
if (*p_hdr != NULL)
- goto fail;
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: warning: multiple relocation sections for section %pA \
+found - ignoring all but the first"),
+ abfd, target_sect);
+ goto success;
+ }
hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, sizeof (*hdr2));
if (hdr2 == NULL)
goto fail;