From: Nick Clifton Date: Fri, 7 Feb 2003 14:27:59 +0000 (+0000) Subject: Generate an error message if a section cannot be found for a symbol. X-Git-Tag: binutils-2_14-branchpoint~906 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=589e6347e9c78e09e51a5cebcd022a5ef995048a;p=thirdparty%2Fbinutils-gdb.git Generate an error message if a section cannot be found for a symbol. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6d96a71d842..85bffb4ccc0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,8 +1,14 @@ +2003-02-07 Nick Clifton + + * elf.c (swap_out_syms): Generate an error message if an + equivalent output section cannot be found for a symbol. + 2003-02-07 Jakub Jelinek * elf64-alpha.c (elf64_alpha_relax_section): Don't crash if local_got_entries is NULL. + 2003-02-06 Andreas Schwab * elf-eh-frame.c (get_DW_EH_PE_signed): Define. diff --git a/bfd/elf.c b/bfd/elf.c index be0025d0a4d..e4b90cf971a 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -5309,7 +5309,7 @@ swap_out_syms (abfd, sttp, relocatable_p) symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx); } - /* now generate the data (for "contents") */ + /* Now generate the data (for "contents"). */ { /* Fill in zeroth symbol and swap it out. */ Elf_Internal_Sym sym; @@ -5375,6 +5375,7 @@ swap_out_syms (abfd, sttp, relocatable_p) value += sec->output_offset; sec = sec->output_section; } + /* Don't add in the section vma for relocatable output. */ if (! relocatable_p) value += sec->vma; @@ -5426,7 +5427,16 @@ swap_out_syms (abfd, sttp, relocatable_p) section of a symbol to be a section that is actually in the output file. */ sec2 = bfd_get_section_by_name (abfd, sec->name); - BFD_ASSERT (sec2 != 0); + if (sec2 == NULL) + { + _bfd_error_handler (_("\ +Unable to find equivalent output section for symbol '%s' from section '%s'"), + syms[idx]->name ? syms[idx]->name : "", + sec->name); + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + shndx = _bfd_elf_section_from_bfd_section (abfd, sec2); BFD_ASSERT (shndx != -1); } @@ -5447,7 +5457,7 @@ swap_out_syms (abfd, sttp, relocatable_p) if (syms[idx]->section->flags & SEC_THREAD_LOCAL) type = STT_TLS; - /* Processor-specific types */ + /* Processor-specific types. */ if (type_ptr != NULL && bed->elf_backend_get_symbol_type) type = ((*bed->elf_backend_get_symbol_type)