From: Matthew Fortune Date: Wed, 5 Nov 2014 10:56:59 +0000 (+0000) Subject: Fix segfault when creating a dso with discarded .dynsym section. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=131e2f8ea152c814af559df088a0d3019f7f45f2;p=binutils-gdb.git Fix segfault when creating a dso with discarded .dynsym section. bfd/ * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Fix segfault when creating a dso with discarded dynsym section. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8df2fd7a117..721db9b85ee 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2014-11-05 James Cowgill + + * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Fix segfault + when creating a dso with discarded dynsym section. + 2014-11-05 Matthew Fortune * elfxx-mips.c (update_mips_abiflags_isa): Add E_MIPS_ARCH_32R6 diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index c599366396a..a88d17320df 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -11457,9 +11457,11 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, name = ".dynsym"; elemsize = MIPS_ELF_SYM_SIZE (output_bfd); s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - dyn.d_un.d_val = s->size / elemsize; + if (s != NULL) + dyn.d_un.d_val = s->size / elemsize; + else + dyn.d_un.d_val = 0; break; case DT_MIPS_HIPAGENO: