-{
- asymbol *sym = *nlist_p;
- char *name = sym->name;
- ldsym_type *sp = ldsym_get (name);
-
- flagword this_symbol_flags = sym->flags;
-
-
- ASSERT(sym->udata == 0);
-
- /* Just place onto correct chain */
- if (flag_is_common(this_symbol_flags)) {
- /* If we have a definition of this symbol already then
- * this common turns into a reference. Also we only
- * ever point to the largest common, so if we
- * have a common, but it's bigger that the new symbol
- * the turn this into a reference too.
- */
- if (sp->sdefs_chain)
- {
- /* This is a common symbol, but we already have a definition
- for it, so just link it into the ref chain as if
- it were a reference
- */
- refize(sp, nlist_p);
- }
- else if (sp->scoms_chain) {
- /* If we have a previous common, keep only the biggest */
- if ( (*(sp->scoms_chain))->value > sym->value) {
- /* other common is bigger, throw this one away */
- refize(sp, nlist_p);
- }
- else if (sp->scoms_chain != nlist_p) {
- /* other common is smaller, throw that away */
- refize(sp, sp->scoms_chain);
- sp->scoms_chain = nlist_p;
- }
- }
- else {
- /* This is the first time we've seen a common, so
- * remember it - if it was undefined before, we know it's defined now
- */
- if (sp->srefs_chain)
- undefined_global_sym_count--;
-
- commons_pending++;
- sp->scoms_chain = nlist_p;
- }
- }
-
- else if (flag_is_defined(this_symbol_flags)) {
- /* This is the definition of a symbol, add to def chain */
- if (sp->sdefs_chain && (*(sp->sdefs_chain))->section != sym->section) {
- /* Multiple definition */
- asymbol *sy = *(sp->sdefs_chain);
- lang_input_statement_type *stat = (lang_input_statement_type *) sy->the_bfd->usrdata;
- lang_input_statement_type *stat1 = (lang_input_statement_type *) sym->the_bfd->usrdata;
- asymbol ** stat1_symbols = stat1 ? stat1->asymbols: 0;
- asymbol ** stat_symbols = stat ? stat->asymbols:0;
-
- multiple_def_count++;
- info("%C: multiple definition of `%T'\n",
- sym->the_bfd,
- sym->section,
- stat1_symbols,
- sym->value,
- sym);
-
- info("%C: first seen here\n",
- sy->the_bfd,
- sy->section,
- stat_symbols,
- sy->value);
- }
- else {
- sym->udata =(void *)( sp->sdefs_chain);
- sp->sdefs_chain = nlist_p;
- }
- /* A definition overrides a common symbol */
- if (sp->scoms_chain) {
- refize(sp, sp->scoms_chain);
- sp->scoms_chain = 0;
- commons_pending--;
- }
- else if (sp->srefs_chain) {
- /* If previously was undefined, then remember as defined */
- undefined_global_sym_count--;
- }
- }
- else {
- if (sp->scoms_chain == (asymbol **)NULL
- && sp->srefs_chain == (asymbol **)NULL
- && sp->sdefs_chain == (asymbol **)NULL) {
- /* And it's the first time we've seen it */
- undefined_global_sym_count++;