2003-06-07 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Sat, 7 Jun 2003 15:51:05 +0000 (15:51 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 7 Jun 2003 15:51:05 +0000 (15:51 +0000)
* 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.

gdb/ChangeLog
gdb/elfread.c

index e02ee217356c253018fb9eb2a6f71b54dd3dd896..4f817ee2625651bc1e757241724c6b3c6139ab24 100644 (file)
@@ -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.
index cecae4205b841b6d3477e498eb1d827d60da8074..ff766fb7c26da1fa1abffdf1685d398e4cafe389 100644 (file)
@@ -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;