- asymbol *p = *q;
-
- /* If the symbol has an interesting definition, we could
- potentially want it. */
-
- if (p->flags & BSF_INDIRECT)
- {
- /** add_indirect(q);*/
- }
-
- if (bfd_is_com_section (p->section)
- || (p->flags & BSF_GLOBAL)
- || (p->flags & BSF_INDIRECT)
- || (p->flags & BSF_WEAK))
- {
- register ldsym_type *sp = ldsym_get_soft (p->name);
-
- /* If this symbol has not been hashed,
- we can't be looking for it. */
- if (sp != (ldsym_type *) NULL
- && sp->sdefs_chain == (asymbol **) NULL)
- {
- int check;
-
- /* A weak symbol is not considered to be a reference
- when pulling files out of an archive. An unresolved
- weak symbol winds up with a value of zero. See the
- SVR4 ABI, p. 4-27. */
- if (sp->scoms_chain != (asymbol **) NULL)
- check = 1;
- else if (sp->srefs_chain == (asymbol **) NULL)
- check = 0;
- else
- {
- asymbol **ptr;
-
- check = 0;
- for (ptr = sp->srefs_chain;
- ptr != (asymbol **) NULL;
- ptr = (asymbol **) ((*ptr)->udata))
- {
- if (((*ptr)->flags & BSF_WEAK) == 0)
- {
- check = 1;
- break;
- }
- }
- }
-
- if (check)
- {
- /* This is a symbol we are looking for. It is
- either common or not yet defined. If this is a
- common symbol, then if the symbol in the object
- file is common, we need to combine sizes. But if
- we already have a common symbol, and the symbol
- in the object file is not common, we don't want
- the object file: it is providing a definition for
- a symbol that we already have a definition for
- (this is the else condition below). */
- if (bfd_is_com_section (p->section))
- {
-
- /* If the symbol in the table is a constructor, we won't to
- anything fancy with it */
- if ((sp->flags & SYM_CONSTRUCTOR) == 0)
- {
- /* This libary member has something to
- say about this element. We should
- remember if its a new size */
- /* Move something from the ref list to the com list */
- if (sp->scoms_chain)
- {
- /* Already a common symbol, maybe update it */
- if (p->value > (*(sp->scoms_chain))->value)
- {
- (*(sp->scoms_chain))->value = p->value;
- }
- }
- else
- {
- /* Take a value from the ref chain
- Here we are moving a symbol from the owning bfd
- to another bfd. We must set up the
- common_section portion of the bfd thing */
-
-
-
- sp->scoms_chain = sp->srefs_chain;
- sp->srefs_chain =
- (asymbol **) ((*(sp->srefs_chain))->udata);
- (*(sp->scoms_chain))->udata = (PTR) NULL;
-
- (*(sp->scoms_chain))->section = p->section;
- (*(sp->scoms_chain))->flags = 0;
- /* Remember the size of this item */
- sp->scoms_chain[0]->value = p->value;
- commons_pending++;
- undefined_global_sym_count--;
- }
- {
- asymbol *com = *(sp->scoms_chain);
-
- if (((lang_input_statement_type *)
- (bfd_asymbol_bfd (com)->usrdata))->common_section ==
- (asection *) NULL)
- {
- ((lang_input_statement_type *)
- (bfd_asymbol_bfd (com)->usrdata))->common_section =
- bfd_make_section_old_way (bfd_asymbol_bfd (com), "COMMON");
- }
-
- /* If the symbol is not in the generic
- common section, we must make sure the
- BFD has a section to hang it on to. */
- if (com->section != &bfd_com_section
- && (com->section->owner
- != bfd_asymbol_bfd (com)))
- bfd_make_section
- (bfd_asymbol_bfd (com),
- bfd_get_section_name (bfd_asymbol_bfd (com),
- com->section));
- }
- }
- ASSERT (p->udata == 0);
- }
- else if (sp->scoms_chain == (asymbol **) NULL)
- {
- if (write_map)
- {
- info_msg ("%I needed due to %s\n", entry, sp->name);
- }
- return true;
- }
- }
- }
- }