- struct HREC * hptr;
- int flag = !iscommon(type);
-
- if (vflag > 1)
- {
- printf("hash_add(%s,%s,%lx,", sym, ofile->o_name, value);
- printf("%x,%s)\n", (unsigned int)type, (flag ? "GLOBAL" : "COMMON"));
- }
-
- if ((hptr = lookup(sym)) == NULL)
- {
- return add_to_hlist(&htable[DoHash(sym)], sym, ofile, value, type);
- }
-
- // Already there!
- if (iscommon(type) && !iscommon(hptr->h_type))
- {
- // Mismatch: global came first; warn and keep the global one
- if (wflag)
- {
- printf("Warning: %s: global from ", sym);
- put_name(hptr->h_ofile);
- printf(" used, common from ");
- put_name(ofile);
- printf(" discarded.\n");
- }
-
- putword(sym + 8, ABST_EXTERN);
- putlong(sym + 10, 0L);
- }
- else if (iscommon(hptr->h_type) && !iscommon(type))
- {
- // Mismatch: common came first; warn and keep the global one
- if (wflag)
- {
- printf("Warning: %s: global from ", sym);
- put_name(ofile);
- printf(" used, common from ");
- put_name(hptr->h_ofile);
- printf(" discarded.\n");
- }