add, notably symbol flags, a section, and an offset. The
symbol flags include such things as <<BSF_WEAK>> or
<<BSF_INDIRECT>>. The section is a section in the object
- file, or something like <<bfd_und_section>> for an undefined
- symbol or <<bfd_com_section>> for a common symbol.
+ file, or something like <<bfd_und_section_ptr>> for an undefined
+ symbol or <<bfd_com_section_ptr>> for a common symbol.
If the <<_bfd_final_link>> routine is also going to need to
read the symbol information, the <<_bfd_link_add_symbols>>
((struct archive_hash_entry *) \
bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
+/* Allocate space in an archive hash table. */
+
+#define archive_hash_allocate(t, size) bfd_hash_allocate (&(t)->table, (size))
+
/* Free an archive hash table. */
#define archive_hash_table_free(t) bfd_hash_table_free (&(t)->table)
arh = archive_hash_lookup (&arsym_hash, arsym->name, true, false);
if (arh == (struct archive_hash_entry *) NULL)
goto error_return;
- l = (struct archive_list *)
- obstack_alloc (&(&(&arsym_hash)->table)->memory,
- sizeof (struct archive_list));
+ l = ((struct archive_list *)
+ archive_hash_allocate (&arsym_hash, sizeof (struct archive_list)));
if (l == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- goto error_return;
- }
+ goto error_return;
l->indx = indx;
for (pp = &arh->defs;
*pp != (struct archive_list *) NULL;
will be linked in. */
h->type = bfd_link_hash_common;
h->u.c.size = bfd_asymbol_value (p);
- if (p->section == &bfd_com_section)
+ if (p->section == bfd_com_section_ptr)
h->u.c.section = bfd_make_section_old_way (symbfd, "COMMON");
else
h->u.c.section = bfd_make_section_old_way (symbfd,
| BSF_GLOBAL
| BSF_CONSTRUCTOR
| BSF_WEAK)) != 0
- || bfd_get_section (p) == &bfd_und_section
+ || bfd_is_und_section (bfd_get_section (p))
|| bfd_is_com_section (bfd_get_section (p))
- || bfd_get_section (p) == &bfd_ind_section)
+ || bfd_is_ind_section (bfd_get_section (p)))
{
const char *name;
const char *string;
name = bfd_asymbol_name (p);
if ((p->flags & BSF_INDIRECT) != 0
- || p->section == &bfd_ind_section)
+ || bfd_is_ind_section (p->section))
string = bfd_asymbol_name ((asymbol *) p->value);
else if ((p->flags & BSF_WARNING) != 0)
{
if (info->hash->creator == abfd->xvec)
{
if (h->sym == (asymbol *) NULL
- || (bfd_get_section (p) != &bfd_und_section
+ || (! bfd_is_und_section (bfd_get_section (p))
&& (! bfd_is_com_section (bfd_get_section (p))
- || (bfd_get_section (h->sym) == &bfd_und_section))))
+ || bfd_is_und_section (bfd_get_section (h->sym)))))
{
h->sym = p;
/* BSF_OLD_COMMON is a hack to support COFF reloc
NAME is the name of the symbol.
FLAGS is the BSF_* bits associated with the symbol.
SECTION is the section in which the symbol is defined; this may be
- bfd_und_section or bfd_com_section.
+ bfd_und_section_ptr or bfd_com_section_ptr.
VALUE is the value of the symbol, relative to the section.
STRING is used for either an indirect symbol, in which case it is
the name of the symbol to indirect to, or a warning symbol, in
struct bfd_link_hash_entry *h;
boolean cycle;
- if (section == &bfd_ind_section
+ if (bfd_is_ind_section (section)
|| (flags & BSF_INDIRECT) != 0)
row = INDR_ROW;
else if ((flags & BSF_WARNING) != 0)
row = WARN_ROW;
else if ((flags & BSF_CONSTRUCTOR) != 0)
row = SET_ROW;
- else if (section == &bfd_und_section)
+ else if (bfd_is_und_section (section))
{
if ((flags & BSF_WEAK) != 0)
row = UNDEFW_ROW;
bfd_link_add_undef (info->hash, h);
h->type = bfd_link_hash_common;
h->u.c.size = value;
- if (section == &bfd_com_section)
+ if (section == bfd_com_section_ptr)
{
h->u.c.section = bfd_make_section_old_way (abfd, "COMMON");
h->u.c.section->flags = SEC_ALLOC;
mval = h->u.def.value;
break;
case bfd_link_hash_common:
- msec = &bfd_com_section;
+ msec = bfd_com_section_ptr;
mval = h->u.c.size;
break;
case bfd_link_hash_indirect:
- msec = &bfd_ind_section;
+ msec = bfd_ind_section_ptr;
mval = 0;
break;
default:
| BSF_GLOBAL
| BSF_CONSTRUCTOR
| BSF_WEAK)) != 0
- || bfd_get_section (sym) == &bfd_und_section
+ || bfd_is_und_section (bfd_get_section (sym))
|| bfd_is_com_section (bfd_get_section (sym))
- || bfd_get_section (sym) == &bfd_ind_section)
+ || bfd_is_ind_section (bfd_get_section (sym)))
{
h = _bfd_generic_link_hash_lookup (_bfd_generic_hash_table (info),
bfd_asymbol_name (sym),
sym->flags |= BSF_GLOBAL;
if (! bfd_is_com_section (sym->section))
{
- BFD_ASSERT (sym->section == &bfd_und_section);
- sym->section = &bfd_com_section;
+ BFD_ASSERT (bfd_is_und_section (sym->section));
+ sym->section = bfd_com_section_ptr;
}
/* We do not set the section of the symbol to
h->root.u.c.section. That value was saved so
else
output = false;
}
- else if (sym->section == &bfd_ind_section)
+ else if (bfd_is_ind_section (sym->section))
output = false;
else if ((sym->flags & BSF_DEBUGGING) != 0)
{
else
output = false;
}
- else if (sym->section == &bfd_und_section
+ else if (bfd_is_und_section (sym->section)
|| bfd_is_com_section (sym->section))
output = false;
else if ((sym->flags & BSF_LOCAL) != 0)
case bfd_link_hash_new:
abort ();
case bfd_link_hash_undefined:
- sym->section = &bfd_und_section;
+ sym->section = bfd_und_section_ptr;
sym->value = 0;
break;
case bfd_link_hash_weak:
- sym->section = &bfd_und_section;
+ sym->section = bfd_und_section_ptr;
sym->value = 0;
sym->flags |= BSF_WEAK;
break;
case bfd_link_hash_common:
sym->value = h->root.u.c.size;
if (sym->section == NULL)
- sym->section = &bfd_com_section;
+ sym->section = bfd_com_section_ptr;
else if (! bfd_is_com_section (sym->section))
{
- BFD_ASSERT (sym->section == &bfd_und_section);
- sym->section = &bfd_com_section;
+ BFD_ASSERT (bfd_is_und_section (sym->section));
+ sym->section = bfd_com_section_ptr;
}
/* Do not set the section; see _bfd_generic_link_output_symbols. */
break;