From c1e65e244c4bf99ef58ca7b15d613b3478fcd418 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 25 Jan 1996 22:35:51 +0000 Subject: [PATCH] Make eabi error messages include symbol name if it is an external symbol --- bfd/ChangeLog | 3 ++- bfd/elf32-ppc.c | 25 +++++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 70bfedca01f..daf0730adc8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -16,7 +16,8 @@ Thu Jan 25 12:08:51 1996 Michael Meissner (ppc_elf_add_symbol_hook): Use the value of -G nn to determine whether to put something in .sbss or not. (ppc_elf_relocate_section): Add support for more relocations. Add - in sec->output_offset where appropriate. + in sec->output_offset where appropriate. Make error messages + include the symbol name. * elflink.c (_bfd_elf_create_linker_section): Lookup symbol before trying to add it to the symbol table, so _GLOBAL_OFFSET_TABLE_ diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 81b92a96c15..b599c12cd49 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2076,6 +2076,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Sym *sym = (Elf_Internal_Sym *)0; asection *sec = (asection *)0; struct elf_link_hash_entry *h = (struct elf_link_hash_entry *)0; + const char *sym_name = (const char *)0; reloc_howto_type *howto; unsigned long r_symndx; bfd_vma relocation; @@ -2127,6 +2128,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; + sym_name = ""; + relocation = (sec->output_section->vma + sec->output_offset + sym->st_value); @@ -2134,6 +2137,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + sym_name = h->root.root.string; if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { @@ -2161,9 +2165,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, switch ((int)r_type) { default: - (*_bfd_error_handler) ("%s: unknown relocation type %d", + (*_bfd_error_handler) ("%s: unknown relocation type %d for symbol %s", bfd_get_filename (input_bfd), - (int)r_type); + (int)r_type, sym_name); bfd_set_error (bfd_error_bad_value); ret = false; @@ -2257,8 +2261,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (strcmp (bfd_get_section_name (abfd, sec), ".sdata") != 0 && strcmp (bfd_get_section_name (abfd, sec), ".sbss") != 0) { - (*_bfd_error_handler) ("%s: The target of a %s relocation is in the wrong section (%s)", + (*_bfd_error_handler) ("%s: The target (%s) of a %s relocation is in the wrong section (%s)", bfd_get_filename (input_bfd), + sym_name, ppc_elf_howto_table[ (int)r_type ]->name, bfd_get_section_name (abfd, sec)); @@ -2278,8 +2283,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (strcmp (bfd_get_section_name (abfd, sec), ".sdata2") != 0 && strcmp (bfd_get_section_name (abfd, sec), ".sbss2") != 0) { - (*_bfd_error_handler) ("%s: The target of a %s relocation is in the wrong section (%s)", + (*_bfd_error_handler) ("%s: The target (%s) of a %s relocation is in the wrong section (%s)", bfd_get_filename (input_bfd), + sym_name, ppc_elf_howto_table[ (int)r_type ]->name, bfd_get_section_name (abfd, sec)); @@ -2324,8 +2330,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { - (*_bfd_error_handler) ("%s: The target of a %s relocation is in the wrong section (%s)", + (*_bfd_error_handler) ("%s: The target (%s) of a %s relocation is in the wrong section (%s)", bfd_get_filename (input_bfd), + sym_name, ppc_elf_howto_table[ (int)r_type ]->name, bfd_get_section_name (abfd, sec)); @@ -2391,9 +2398,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case (int)R_PPC_EMB_RELST_HI: case (int)R_PPC_EMB_RELST_HA: case (int)R_PPC_EMB_BIT_FLD: - (*_bfd_error_handler) ("%s: Relocation %s is not yet supported.", + (*_bfd_error_handler) ("%s: Relocation %s is not yet supported for symbol %s.", bfd_get_filename (input_bfd), - ppc_elf_howto_table[ (int)r_type ]->name); + ppc_elf_howto_table[ (int)r_type ]->name, + sym_name); bfd_set_error (bfd_error_invalid_operation); ret = false; @@ -2402,9 +2410,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, #ifdef DEBUG - fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n", + fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, offset = %ld, addend = %ld\n", howto->name, (int)r_type, + sym_name, r_symndx, (long)offset, (long)addend); -- 2.30.2