summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2001-08-21 01:02:41 +0000
committerH.J. Lu <hjl@lucon.org>2001-08-21 01:02:41 +0000
commitb341707f9d638d753dd861f69855e4bbea947b50 (patch)
tree04ea448400fde3ad0ce3721634dbf340d68a3de5
parente4fccb97fcfe1d7ccaf7535028c49d82567bd519 (diff)
downloadgdb-b341707f9d638d753dd861f69855e4bbea947b50.tar.gz
2001-08-20 H.J. Lu <hjl@gnu.org>
* elf-bfd.h (elf_obj_tdata): Add num_section_syms. (elf_num_section_syms): New for num_section_syms. * elf.c (elf_map_symbols): Set num_section_syms. (_bfd_elf_symbol_from_bfd_symbol): Check num_section_syms for the section symbol index.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf-bfd.h2
-rw-r--r--bfd/elf.c4
3 files changed, 14 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7f4b8272728..2902efa91c2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2001-08-20 H.J. Lu <hjl@gnu.org>
+
+ * elf-bfd.h (elf_obj_tdata): Add num_section_syms.
+ (elf_num_section_syms): New for num_section_syms.
+
+ * elf.c (elf_map_symbols): Set num_section_syms.
+ (_bfd_elf_symbol_from_bfd_symbol): Check num_section_syms for
+ the section symbol index.
+
2001-08-20 Nick Clifton <nickc@cambridge.redhat.com>
* elfxx-target.h (bfd_elfNN_bfd_link_hash_table_create): Never
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 1d684328d2e..66095422e04 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -813,6 +813,7 @@ struct elf_obj_tdata
struct bfd_strtab_hash *strtab_ptr;
int num_locals;
int num_globals;
+ int num_section_syms;
asymbol **section_syms; /* STT_SECTION symbols for each section */
Elf_Internal_Shdr symtab_hdr;
Elf_Internal_Shdr shstrtab_hdr;
@@ -954,6 +955,7 @@ struct elf_obj_tdata
#define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
#define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
#define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
+#define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
diff --git a/bfd/elf.c b/bfd/elf.c
index 8ff3ec8b309..79998036d61 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2091,6 +2091,7 @@ elf_map_symbols (abfd)
if (sect_syms == NULL)
return false;
elf_section_syms (abfd) = sect_syms;
+ elf_num_section_syms (abfd) = max_index;
for (idx = 0; idx < symcount; idx++)
{
@@ -3651,7 +3652,8 @@ _bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr)
indx = asym_ptr->section->output_section->index;
else
indx = asym_ptr->section->index;
- if (elf_section_syms (abfd)[indx])
+ if (indx < elf_num_section_syms (abfd)
+ && elf_section_syms (abfd)[indx] != NULL)
asym_ptr->udata.i = elf_section_syms (abfd)[indx]->udata.i;
}