diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2005-04-27 20:16:08 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2005-04-27 20:16:08 +0000 |
commit | 26c61ae50be6d702a8d40bf3c968048a1801057a (patch) | |
tree | 4400e57d620b45863bbf39aa77acb03ae13e8719 /bfd/elf.c | |
parent | dce669a1fd56f2017d9af535d05694a41d1f9398 (diff) | |
download | gdb-26c61ae50be6d702a8d40bf3c968048a1801057a.zip gdb-26c61ae50be6d702a8d40bf3c968048a1801057a.tar.gz gdb-26c61ae50be6d702a8d40bf3c968048a1801057a.tar.bz2 |
2005-04-27 H.J. Lu <hongjiu.lu@intel.com>
* elf-bfd.h (bfd_elf_sym_name): Also take "asection *".
* elf.c (bfd_elf_sym_name): Updated.
(group_signature): Likewise.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_edit_opd): Likewise.
(ppc64_elf_edit_toc): Likewise.
(ppc64_elf_relocate_section): Likewise.
* elfcode.h (elf_slurp_symbol_table): Likewise.
* elflink.c (elf_link_input_bfd): Likewise.
* elfxx-ia64.c (elfNN_ia64_relocate_section): Call
bfd_elf_sym_name to get local symbol name when reporting errors.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -407,10 +407,13 @@ bfd_elf_get_elf_syms (bfd *ibfd, const char * bfd_elf_sym_name (bfd *abfd, Elf_Internal_Shdr *symtab_hdr, - Elf_Internal_Sym *isym) + Elf_Internal_Sym *isym, + asection *sym_sec) { + const char *name; unsigned int iname = isym->st_name; unsigned int shindex = symtab_hdr->sh_link; + if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION /* Check for a bogus st_shndx to avoid crashing. */ && isym->st_shndx < elf_numsections (abfd) @@ -420,7 +423,13 @@ bfd_elf_sym_name (bfd *abfd, shindex = elf_elfheader (abfd)->e_shstrndx; } - return bfd_elf_string_from_elf_section (abfd, shindex, iname); + name = bfd_elf_string_from_elf_section (abfd, shindex, iname); + if (name == NULL) + name = "(null)"; + else if (sym_sec && *name == '\0') + name = bfd_section_name (abfd, sym_sec); + + return name; } /* Elf_Internal_Shdr->contents is an array of these for SHT_GROUP @@ -453,7 +462,7 @@ group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr) &isym, esym, &eshndx) == NULL) return NULL; - return bfd_elf_sym_name (abfd, hdr, &isym); + return bfd_elf_sym_name (abfd, hdr, &isym, NULL); } /* Set next_in_group list pointer, and group name for NEWSECT. */ |