aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-10-08 09:51:01 +1030
committerAlan Modra <amodra@gmail.com>2024-10-08 15:12:14 +1030
commite5375abb67e8c52c01d8ba40fffe2378cdcdb6e5 (patch)
tree4074c1fd7ada4dd8d32be8e1ea2751ee4c8166ad
parent9b09ceea7d2dd4d1fcb28675501ac634379c8bab (diff)
downloadbinutils-e5375abb67e8c52c01d8ba40fffe2378cdcdb6e5.zip
binutils-e5375abb67e8c52c01d8ba40fffe2378cdcdb6e5.tar.gz
binutils-e5375abb67e8c52c01d8ba40fffe2378cdcdb6e5.tar.bz2
Revert "bfd_elf_sym_name_raw"
This reverts commit 265757dc6e4d011a1b33ef1b3bfcd7f100f12f64.
-rw-r--r--bfd/elf-bfd.h2
-rw-r--r--bfd/elf.c25
-rw-r--r--bfd/elf32-i386.c2
-rw-r--r--bfd/elfcode.h2
4 files changed, 10 insertions, 21 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index cb147b4e..b89d3dd 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2277,8 +2277,6 @@ extern Elf_Internal_Sym *bfd_elf_get_elf_syms
(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 *);
diff --git a/bfd/elf.c b/bfd/elf.c
index 38bfb1c..7d3d206 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -531,10 +531,12 @@ bfd_elf_get_elf_syms (bfd *ibfd,
/* Look up a symbol name. */
const char *
-bfd_elf_sym_name_raw (bfd *abfd,
- Elf_Internal_Shdr *symtab_hdr,
- Elf_Internal_Sym *isym)
+bfd_elf_sym_name (bfd *abfd,
+ Elf_Internal_Shdr *symtab_hdr,
+ Elf_Internal_Sym *isym,
+ asection *sym_sec)
{
+ const char *name;
unsigned int iname = isym->st_name;
unsigned int shindex = symtab_hdr->sh_link;
@@ -546,19 +548,8 @@ bfd_elf_sym_name_raw (bfd *abfd,
shindex = elf_elfheader (abfd)->e_shstrndx;
}
- 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_elf_string_from_elf_section (abfd, shindex, iname);
+ if (sym_sec && name && *name == '\0')
name = bfd_section_name (sym_sec);
return name;
@@ -590,7 +581,7 @@ group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr)
&isym, esym, &eshndx) == NULL)
return NULL;
- return bfd_elf_sym_name_raw (abfd, hdr, &isym);
+ return bfd_elf_sym_name (abfd, hdr, &isym, NULL);
}
static bool
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 2e8d595..f27c062 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1723,7 +1723,7 @@ elf_i386_scan_relocs (bfd *abfd,
name = h->root.root.string;
else
name = bfd_elf_sym_name (abfd, symtab_hdr, isym,
- NULL);
+ NULL);
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: `%s' accessed both as normal and "
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 6aebcc6..3dcba4c 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1355,7 +1355,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bool dynamic)
sym->symbol.name = (elf_tdata (abfd)->dt_strtab
+ isym->st_name);
else
- sym->symbol.name = bfd_elf_sym_name_raw (abfd, hdr, isym);
+ sym->symbol.name = bfd_elf_sym_name (abfd, hdr, isym, NULL);
sym->symbol.value = isym->st_value;
if (isym->st_shndx == SHN_UNDEF)