/* FIXME: coff/internal.h and aout/aout64.h both define N_ABS. We
want the definition from aout/aout64.h. */
#undef N_ABS
-/* FIXME: coff/mips.h and aout/aout64.h both define ZMAGIC. We don't
- use it. */
-#undef ZMAGIC
#include "libaout.h" /* Private BFD a.out information. */
#include "aout/aout64.h"
add_symbol (s, top_stack->cur_block);
break;
+ case stStaticProc:
+ /* I believe this is used only for file-local functions.
+ The comment in symconst.h ("load time only static procs") isn't
+ particularly clear on this point. */
+ prim_record_minimal_symbol (name, sh->value, mst_file_text);
+ /* FALLTHROUGH */
+
case stProc: /* Procedure, usually goes into global block */
- case stStaticProc: /* Static procedure, goes into current block */
s = new_symbol (name);
SYMBOL_NAMESPACE (s) = VAR_NAMESPACE;
SYMBOL_CLASS (s) = LOC_BLOCK;
ecoff_swap_sym_in (cur_bfd, ext_tsym, &tsym);
- if (tsym.st == stEnd)
- break;
-
- if (tsym.st == stMember)
+ switch (tsym.st)
{
+ case stEnd:
+ goto end_of_fields;
+
+ case stMember:
if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
/* If the type of the member is Nil (or Void),
without qualifiers, assume the tag is an
nfields++;
if (tsym.value > max_value)
max_value = tsym.value;
+ break;
+
+ case stTypedef:
+ case stConstant:
+ case stStaticProc:
+ complain (&block_member_complaint, tsym.st);
+ /* These are said to show up in cfront-generated programs.
+ Apparently processing them like the following prevents
+ core dumps. */
+ /* FALLTHROUGH */
+
+ case stBlock:
+ case stUnion:
+ case stEnum:
+ case stStruct:
+ case stParsed:
+ {
+#if 0
+ /* This is a no-op; is it trying to tell us something
+ we should be checking? */
+ if (tsym.sc == scVariant); /*UNIMPLEMENTED*/
+#endif
+ if (tsym.index != 0)
+ {
+ /* This is something like a struct within a
+ struct. Skip over the fields of the inner
+ struct. The -1 is because the for loop will
+ increment ext_tsym. */
+ ext_tsym = (ecoff_data (cur_bfd)->external_sym
+ + cur_fdr->isymBase
+ + tsym.index
+ - 1);
+ }
+ }
+ break;
+
+ default:
+ complain (&block_member_complaint, tsym.st);
}
- else if (tsym.st == stBlock
- || tsym.st == stUnion
- || tsym.st == stEnum
- || tsym.st == stStruct
- || tsym.st == stParsed)
- {
- if (tsym.sc == scVariant); /*UNIMPLEMENTED*/
- if (tsym.index != 0)
- {
- /* This is something like a struct within a
- struct. Skip over the fields of the inner
- struct. The -1 is because the for loop will
- increment ext_tsym. */
- ext_tsym = (ecoff_data (cur_bfd)->external_sym
- + cur_fdr->isymBase
- + tsym.index
- - 1);
- }
- }
- else
- complain (&block_member_complaint, tsym.st);
}
+ end_of_fields:;
/* In an stBlock, there is no way to distinguish structs,
unions, and enums at this point. This is a bug in the
complain (&bad_tag_guess_complaint, name);
TYPE_CODE (tp) = type_code;
}
- if (TYPE_TAG_NAME (tp) == NULL || !STREQ (TYPE_TAG_NAME (tp), name))
+ /* Do not set the tag name if it is a compiler generated tag name
+ (.Fxx or .xxfake) for unnamed struct/union/enums. */
+ if (name[0] == '.')
+ TYPE_TAG_NAME (tp) = NULL;
+ else if (TYPE_TAG_NAME (tp) == NULL || !STREQ (TYPE_TAG_NAME (tp), name))
TYPE_TAG_NAME (tp) = obsavestring (name, strlen (name),
¤t_objfile->type_obstack);
}
images that have been partially stripped (ld -x) have been deprived
of local symbols, and we have to cope with them here. FIRST_OFF is
the offset of the first procedure for this FDR; we adjust the
- address by this amount, but I don't know why. */
+ address by this amount, but I don't know why. SEARCH_SYMTAB is the symtab
+ to look for the function which contains the MIPS_EFI_SYMBOL_NAME symbol
+ in question, or NULL to use top_stack->cur_block. */
+
+static void parse_procedure PARAMS ((PDR *, struct symtab *, unsigned long));
static void
-parse_procedure (pr, have_stabs, first_off)
+parse_procedure (pr, search_symtab, first_off)
PDR *pr;
- int have_stabs;
+ struct symtab *search_symtab;
unsigned long first_off;
{
struct symbol *s, *i;
sh_name = ecoff_data (cur_bfd)->ss + cur_fdr->issBase + sh.iss;
}
- if (have_stabs)
+ if (search_symtab != NULL)
{
+#if 0
+ /* This loses both in the case mentioned (want a static, find a global),
+ but also if we are looking up a non-mangled name which happens to
+ match the name of a mangled function. */
/* We have to save the cur_fdr across the call to lookup_symbol.
If the pdr is for a static function and if a global function with
the same name exists, lookup_symbol will eventually read in the symtab
FDR *save_cur_fdr = cur_fdr;
s = lookup_symbol (sh_name, NULL, VAR_NAMESPACE, 0, NULL);
cur_fdr = save_cur_fdr;
+#else
+ s = mylookup_symbol
+ (sh_name,
+ BLOCKVECTOR_BLOCK (BLOCKVECTOR (search_symtab), STATIC_BLOCK),
+ VAR_NAMESPACE,
+ LOC_BLOCK);
+#endif
}
else
s = mylookup_symbol (sh_name, top_stack->cur_block,
first_off = pr.adr;
first_pdr = 0;
}
- parse_procedure (&pr, 1, first_off);
+ parse_procedure (&pr, st, first_off);
}
}
else
/* Careful, we might be looking at .o files */
if (sh.iss == 0)
*pname = "<undefined>";
+ else if (rn->rfd == 0xfff && rn->index == 0)
+ /* For structs, unions and enums, rn->rfd is 0xfff and the index
+ is a relative symbol number for the type, but an index of 0
+ seems to mean that we don't know. This is said to fix a problem
+ with "info func opendir" on an SGI showing
+ "struct BSDopendir.c *BSDopendir();". */
+ *pname = "<unknown>";
else
*pname = ecoff_data (cur_bfd)->ss + fh->issBase + sh.iss;
if (SYMBOL_NAME (sym)[0] == inc
&& SYMBOL_NAMESPACE (sym) == namespace
&& SYMBOL_CLASS (sym) == class
- && STREQ (SYMBOL_NAME (sym), name))
+ && strcmp (SYMBOL_NAME (sym), name) == 0)
return sym;
bot++;
}
e->pdr.fregmask = -1;
e->pdr.fregoffset = -(7 * sizeof (int));
e->pdr.isym = (long) s;
+ e->pdr.adr = sigtramp_address;
current_objfile = st->objfile; /* Keep new_symbol happy */
s = new_symbol (MIPS_EFI_SYMBOL_NAME);