aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-06-07 15:51:05 +0000
committerAndrew Cagney <cagney@redhat.com>2003-06-07 15:51:05 +0000
commit9a90a78063be817c7fa1b4548ca8fd4c7ca8e843 (patch)
tree365479fb257cd308b9037231dca78ea5f9520156
parent5262831592fbfc43b9f107b29464f22d687b318f (diff)
downloadgdb-9a90a78063be817c7fa1b4548ca8fd4c7ca8e843.zip
gdb-9a90a78063be817c7fa1b4548ca8fd4c7ca8e843.tar.gz
gdb-9a90a78063be817c7fa1b4548ca8fd4c7ca8e843.tar.bz2
2003-06-07 Andrew Cagney <cagney@redhat.com>
* elfread.c (elf_symtab_read): Replace "special_local_sym_p" and "index" with "special_local_sect". Use strcmp instead of STREQ. Append period to coments.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/elfread.c73
2 files changed, 32 insertions, 47 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e02ee21..4f817ee 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2003-06-07 Andrew Cagney <cagney@redhat.com>
+
+ * elfread.c (elf_symtab_read): Replace "special_local_sym_p" and
+ "index" with "special_local_sect". Use strcmp instead of STREQ.
+ Append period to coments.
+
2003-06-06 Mark Mitchell <mark@codesourcery.com>
* elfread.c (elf_symtab_read): Avoid use of SECT_OFF_MAX.
diff --git a/gdb/elfread.c b/gdb/elfread.c
index cecae42..ff766fb 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -177,7 +177,6 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
asymbol **symbol_table;
long number_of_symbols;
long i;
- int index;
struct cleanup *back_to;
CORE_ADDR symaddr;
CORE_ADDR offset;
@@ -372,28 +371,21 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
}
else if (sym->flags & BSF_LOCAL)
{
- int special_local_sym_p = 0;
- /* Named Local variable in a Data section. Check its
- name for stabs-in-elf. The STREQ macro checks the
- first character inline, so we only actually do a
- strcmp function call on names that start with 'B'
- or 'D' */
- if (STREQ ("Bbss.bss", sym->name))
- {
- index = SECT_OFF_BSS (objfile);
- special_local_sym_p = 1;
- }
- else if (STREQ ("Ddata.data", sym->name))
- {
- index = SECT_OFF_DATA (objfile);
- special_local_sym_p = 1;
- }
- else if (STREQ ("Drodata.rodata", sym->name))
- {
- index = SECT_OFF_RODATA (objfile);
- special_local_sym_p = 1;
- }
- if (special_local_sym_p)
+ /* Named Local variable in a Data section.
+ Check its name for stabs-in-elf. The STREQ
+ macro checks the first character inline, so
+ we only actually do a strcmp function call on
+ names that start with 'B' or 'D'. */
+ int special_local_sect;
+ if (strcmp ("Bbss.bss", sym->name) == 0)
+ special_local_sect = SECT_OFF_BSS (objfile);
+ else if (strcmp ("Ddata.data", sym->name) == 0)
+ special_local_sect = SECT_OFF_DATA (objfile);
+ else if (strcmp ("Drodata.rodata", sym->name) == 0)
+ special_local_sect = SECT_OFF_RODATA (objfile);
+ else
+ special_local_sect = -1;
+ if (special_local_sect >= 0)
{
/* Found a special local symbol. Allocate a
sectinfo, if needed, and fill it in. */
@@ -425,36 +417,23 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
(char *) filesym->name;
}
}
- if (index != -1)
- {
- if (sectinfo->sections[index] != 0)
- {
- complaint (&symfile_complaints,
- "duplicated elf/stab section information for %s",
- sectinfo->filename);
- }
- }
- else
- internal_error (__FILE__, __LINE__,
- "Section index uninitialized.");
- /* Bfd symbols are section relative. */
+ if (sectinfo->sections[special_local_sect] != 0)
+ complaint (&symfile_complaints,
+ "duplicated elf/stab section information for %s",
+ sectinfo->filename);
+ /* BFD symbols are section relative. */
symaddr = sym->value + sym->section->vma;
- /* Relocate non-absolute symbols by the section offset. */
+ /* Relocate non-absolute symbols by the
+ section offset. */
if (sym->section != &bfd_abs_section)
- {
- symaddr += offset;
- }
- if (index != -1)
- sectinfo->sections[index] = symaddr;
- else
- internal_error (__FILE__, __LINE__,
- "Section index uninitialized.");
+ symaddr += offset;
+ sectinfo->sections[special_local_sect] = symaddr;
/* The special local symbols don't go in the
- minimal symbol table, so ignore this one. */
+ minimal symbol table, so ignore this one. */
continue;
}
/* Not a special stabs-in-elf symbol, do regular
- symbol processing. */
+ symbol processing. */
if (sym->section->flags & SEC_LOAD)
{
ms_type = mst_file_data;