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.
This commit is contained in:
Andrew Cagney 2003-06-07 15:51:05 +00:00
parent 5262831592
commit 9a90a78063
2 changed files with 32 additions and 47 deletions

View 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> 2003-06-06 Mark Mitchell <mark@codesourcery.com>
* elfread.c (elf_symtab_read): Avoid use of SECT_OFF_MAX. * elfread.c (elf_symtab_read): Avoid use of SECT_OFF_MAX.

View File

@ -177,7 +177,6 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
asymbol **symbol_table; asymbol **symbol_table;
long number_of_symbols; long number_of_symbols;
long i; long i;
int index;
struct cleanup *back_to; struct cleanup *back_to;
CORE_ADDR symaddr; CORE_ADDR symaddr;
CORE_ADDR offset; CORE_ADDR offset;
@ -372,28 +371,21 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
} }
else if (sym->flags & BSF_LOCAL) else if (sym->flags & BSF_LOCAL)
{ {
int special_local_sym_p = 0; /* Named Local variable in a Data section.
/* Named Local variable in a Data section. Check its Check its name for stabs-in-elf. The STREQ
name for stabs-in-elf. The STREQ macro checks the macro checks the first character inline, so
first character inline, so we only actually do a we only actually do a strcmp function call on
strcmp function call on names that start with 'B' names that start with 'B' or 'D'. */
or 'D' */ int special_local_sect;
if (STREQ ("Bbss.bss", sym->name)) if (strcmp ("Bbss.bss", sym->name) == 0)
{ special_local_sect = SECT_OFF_BSS (objfile);
index = SECT_OFF_BSS (objfile); else if (strcmp ("Ddata.data", sym->name) == 0)
special_local_sym_p = 1; special_local_sect = SECT_OFF_DATA (objfile);
} else if (strcmp ("Drodata.rodata", sym->name) == 0)
else if (STREQ ("Ddata.data", sym->name)) special_local_sect = SECT_OFF_RODATA (objfile);
{ else
index = SECT_OFF_DATA (objfile); special_local_sect = -1;
special_local_sym_p = 1; if (special_local_sect >= 0)
}
else if (STREQ ("Drodata.rodata", sym->name))
{
index = SECT_OFF_RODATA (objfile);
special_local_sym_p = 1;
}
if (special_local_sym_p)
{ {
/* Found a special local symbol. Allocate a /* Found a special local symbol. Allocate a
sectinfo, if needed, and fill it in. */ sectinfo, if needed, and fill it in. */
@ -425,36 +417,23 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
(char *) filesym->name; (char *) filesym->name;
} }
} }
if (index != -1) if (sectinfo->sections[special_local_sect] != 0)
{ complaint (&symfile_complaints,
if (sectinfo->sections[index] != 0) "duplicated elf/stab section information for %s",
{ sectinfo->filename);
complaint (&symfile_complaints, /* BFD symbols are section relative. */
"duplicated elf/stab section information for %s",
sectinfo->filename);
}
}
else
internal_error (__FILE__, __LINE__,
"Section index uninitialized.");
/* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma; 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) if (sym->section != &bfd_abs_section)
{ symaddr += offset;
symaddr += offset; sectinfo->sections[special_local_sect] = symaddr;
}
if (index != -1)
sectinfo->sections[index] = symaddr;
else
internal_error (__FILE__, __LINE__,
"Section index uninitialized.");
/* The special local symbols don't go in the /* The special local symbols don't go in the
minimal symbol table, so ignore this one. */ minimal symbol table, so ignore this one. */
continue; continue;
} }
/* Not a special stabs-in-elf symbol, do regular /* Not a special stabs-in-elf symbol, do regular
symbol processing. */ symbol processing. */
if (sym->section->flags & SEC_LOAD) if (sym->section->flags & SEC_LOAD)
{ {
ms_type = mst_file_data; ms_type = mst_file_data;