(bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *,
Elf_External_Sym_Shndx *);
extern char * bfd_elf_get_str_section (bfd *, unsigned int);
+extern const char *bfd_elf_sym_name_raw
+ (bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *);
extern const char *bfd_elf_sym_name
(bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, asection *);
/* Look up a symbol name. */
const char *
-bfd_elf_sym_name (bfd *abfd,
- Elf_Internal_Shdr *symtab_hdr,
- Elf_Internal_Sym *isym,
- asection *sym_sec)
+bfd_elf_sym_name_raw (bfd *abfd,
+ Elf_Internal_Shdr *symtab_hdr,
+ Elf_Internal_Sym *isym)
{
- const char *name;
unsigned int iname = isym->st_name;
unsigned int shindex = symtab_hdr->sh_link;
shindex = elf_elfheader (abfd)->e_shstrndx;
}
- name = bfd_elf_string_from_elf_section (abfd, shindex, iname);
- if (sym_sec && name && *name == '\0')
+ return bfd_elf_string_from_elf_section (abfd, shindex, iname);
+}
+
+const char *
+bfd_elf_sym_name (bfd *abfd,
+ Elf_Internal_Shdr *symtab_hdr,
+ Elf_Internal_Sym *isym,
+ asection *sym_sec)
+{
+ const char *name = bfd_elf_sym_name_raw (abfd, symtab_hdr, isym);
+ if (name == NULL)
+ name = "<null>";
+ else if (sym_sec && *name == '\0')
name = bfd_section_name (sym_sec);
return name;
&isym, esym, &eshndx) == NULL)
return NULL;
- return bfd_elf_sym_name (abfd, hdr, &isym, NULL);
+ return bfd_elf_sym_name_raw (abfd, hdr, &isym);
}
static bool
sym->symbol.name = (elf_tdata (abfd)->dt_strtab
+ isym->st_name);
else
- sym->symbol.name = bfd_elf_sym_name (abfd, hdr, isym, NULL);
+ sym->symbol.name = bfd_elf_sym_name_raw (abfd, hdr, isym);
sym->symbol.value = isym->st_value;
if (isym->st_shndx == SHN_UNDEF)