unsigned char type;
unsigned max_symnum;
register bfd *abfd;
- struct symtab *rtn;
struct objfile *objfile;
int sym_offset; /* Offset to start of symbols to read */
int sym_size; /* Size of symbols to read */
.stab "foo:V...",N_STSYM is relative (section base subtracted).
This leaves us no choice but to search for the 'S' or 'V'...
(or pass the whole section_offsets stuff down ONE MORE function
- call level, which we really don't want to do). */
+ call level, which we really don't want to do).
+
+ The above is indeed true for Solaris 2.1. I'm not sure what
+ happens in Solaris 2.3, in which ld stops relocating stabs. */
{
char *p;
p = strchr (name, ':');
{
/* FIXME! We relocate it by the TEXT offset, in case the
whole module moved in memory. But this is wrong, since
- the sections can side around independently. */
+ the sections can side around independently. (I suspect that
+ the text offset is always zero anyway--elfread.c doesn't
+ process (and Sun cc doesn't produce) Ttext.text symbols). */
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
goto define_a_symbol;
}
previous function. This means that we can use the
minimal symbol table to get the address. */
- if (type == N_GSYM || type == N_STSYM)
+ /* On solaris up to 2.2, the N_FUN stab gets relocated.
+ On Solaris 2.3, ld no longer relocates stabs (which
+ is good), and the N_FUN's value is now always zero.
+ We only provide this correction for functions, not for
+ all N_FUN symbols, because that is easiest and all
+ readonly variables seem to go in the .rodata on Solaris. */
+
+ if (type == N_GSYM || type == N_STSYM
+ || (type == N_FUN && valu == 0))
{
struct minimal_symbol *m;
int l = colon_pos - name;
DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
DBX_SYMTAB_OFFSET (objfile) = staboffset;
- if (stabstrsize < 0 /* FIXME: stabstrsize is unsigned; never true! */
- || stabstrsize > bfd_get_size (sym_bfd))
+ if (stabstrsize > bfd_get_size (sym_bfd))
error ("ridiculous string table size: %d bytes", stabstrsize);
DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->psymbol_obstack, stabstrsize+1);