aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-08-25 17:48:20 +0100
committerNick Clifton <nickc@redhat.com>2015-08-25 17:48:20 +0100
commit16ad13eca4a18139cd1dec214ec83fdc7c47ffda (patch)
tree5dc9c15960ebb772e82403d9008c15d466912f4b /bfd/elf.c
parentcdbfb8861732b496b9ee35b130af75b245e2bc02 (diff)
downloadgdb-16ad13eca4a18139cd1dec214ec83fdc7c47ffda.zip
gdb-16ad13eca4a18139cd1dec214ec83fdc7c47ffda.tar.gz
gdb-16ad13eca4a18139cd1dec214ec83fdc7c47ffda.tar.bz2
Replace assertions with warning messages about ELF binaries containing multiple symbol tables.
PR binutils/18854 * elf.c (bfd_section_from_shdr): Replace assertions with warnings about multiple symbol tables.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index f8e1295..81cc1db 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1833,7 +1833,15 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
goto success;
}
- BFD_ASSERT (elf_onesymtab (abfd) == 0);
+ /* PR 18854: A binary might contain more than one symbol table.
+ Unusual, but possible. Warn, but continue. */
+ if (elf_onesymtab (abfd) != 0)
+ {
+ (*_bfd_error_handler)
+ (_("%B: warning: multiple symbol tables detected - ignoring the table in section %u"),
+ abfd, shindex);
+ goto success;
+ }
elf_onesymtab (abfd) = shindex;
elf_tdata (abfd)->symtab_hdr = *hdr;
elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -1898,7 +1906,15 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
goto success;
}
- BFD_ASSERT (elf_dynsymtab (abfd) == 0);
+ /* PR 18854: A binary might contain more than one dynamic symbol table.
+ Unusual, but possible. Warn, but continue. */
+ if (elf_dynsymtab (abfd) != 0)
+ {
+ (*_bfd_error_handler)
+ (_("%B: warning: multiple dynamic symbol tables detected - ignoring the table in section %u"),
+ abfd, shindex);
+ goto success;
+ }
elf_dynsymtab (abfd) = shindex;
elf_tdata (abfd)->dynsymtab_hdr = *hdr;
elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->dynsymtab_hdr;