return sym;
}
- fixup_section (&sym->ginfo, addr, objfile);
+ fixup_section (sym, addr, objfile);
return sym;
}
\f
-/* Helper function to initialize the fields of an objfile-owned symbol.
- It assumed that *SYM is already all zeroes. */
-
-static void
-initialize_objfile_symbol_1 (struct symbol *sym)
-{
- SYMBOL_OBJFILE_OWNED (sym) = 1;
- SYMBOL_SECTION (sym) = -1;
-}
-
/* Initialize the symbol SYM, and mark it as being owned by an objfile. */
void
initialize_objfile_symbol (struct symbol *sym)
{
- memset (sym, 0, sizeof (*sym));
- initialize_objfile_symbol_1 (sym);
+ SYMBOL_OBJFILE_OWNED (sym) = 1;
+ SYMBOL_SECTION (sym) = -1;
}
/* Allocate and initialize a new 'struct symbol' on OBJFILE's
struct symbol *
allocate_symbol (struct objfile *objfile)
{
- struct symbol *result;
+ struct symbol *result = new (&objfile->objfile_obstack) symbol ();
- result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol);
- initialize_objfile_symbol_1 (result);
+ initialize_objfile_symbol (result);
return result;
}
{
struct template_symbol *result;
- result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct template_symbol);
- initialize_objfile_symbol_1 (result);
+ result = new (&objfile->objfile_obstack) template_symbol ();
+ initialize_objfile_symbol (result);
return result;
}
if (minsym.minsym != nullptr)
return BMSYMBOL_VALUE_ADDRESS (minsym);
}
- return sym->ginfo.value.address;
+ return sym->value.address;
}
/* See symtab.h. */