aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2009-06-18 14:18:29 +0000
committerAlan Modra <amodra@gmail.com>2009-06-18 14:18:29 +0000
commit87d72d41b073d51b7409d2b0e7f0bbb7b840e1e6 (patch)
treeacf55c4342fb883110374281890a211aa7ae2c7d /bfd/elf.c
parentc098b58b165ac735c3908e5167d0c1efc37f9a41 (diff)
downloadgdb-87d72d41b073d51b7409d2b0e7f0bbb7b840e1e6.zip
gdb-87d72d41b073d51b7409d2b0e7f0bbb7b840e1e6.tar.gz
gdb-87d72d41b073d51b7409d2b0e7f0bbb7b840e1e6.tar.bz2
* elf-bfd.h (struct sym_sec_cache): Delete.
(struct sym_cache): New. (bfd_section_from_r_symndx): Delete prototype. (bfd_sym_from_r_symndx): Define prototype. * elf.c (bfd_section_from_r_symndx): Delete, replace with.. (bfd_sym_from_r_symndx): ..new function. * elf32-arm.c: Update all uses of struct sym_sec_cache and bfd_section_from_r_symndx to new struct and function. * elf32-bfin.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68hc1x.h: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-sparc.h: Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index c7151be..e377d68 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1921,28 +1921,24 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
return TRUE;
}
-/* Return the section for the local symbol specified by ABFD, R_SYMNDX.
- Return SEC for sections that have no elf section, and NULL on error. */
+/* Return the local symbol specified by ABFD, R_SYMNDX. */
-asection *
-bfd_section_from_r_symndx (bfd *abfd,
- struct sym_sec_cache *cache,
- asection *sec,
- unsigned long r_symndx)
+Elf_Internal_Sym *
+bfd_sym_from_r_symndx (struct sym_cache *cache,
+ bfd *abfd,
+ unsigned long r_symndx)
{
unsigned int ent = r_symndx % LOCAL_SYM_CACHE_SIZE;
- asection *s;
if (cache->abfd != abfd || cache->indx[ent] != r_symndx)
{
Elf_Internal_Shdr *symtab_hdr;
unsigned char esym[sizeof (Elf64_External_Sym)];
Elf_External_Sym_Shndx eshndx;
- Elf_Internal_Sym isym;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
if (bfd_elf_get_elf_syms (abfd, symtab_hdr, 1, r_symndx,
- &isym, esym, &eshndx) == NULL)
+ &cache->sym[ent], esym, &eshndx) == NULL)
return NULL;
if (cache->abfd != abfd)
@@ -1951,14 +1947,9 @@ bfd_section_from_r_symndx (bfd *abfd,
cache->abfd = abfd;
}
cache->indx[ent] = r_symndx;
- cache->shndx[ent] = isym.st_shndx;
}
- s = bfd_section_from_elf_index (abfd, cache->shndx[ent]);
- if (s != NULL)
- return s;
-
- return sec;
+ return &cache->sym[ent];
}
/* Given an ELF section number, retrieve the corresponding BFD