Subject: undefined symbol bug in 'netbind' (#139) Index: sys/conf/netbind.c 2.11BSD Description: There is a bug in the program which resolves symbols between the kernel (/unix) and the networking (/netnix) images. If the same symbol is undefined in both 'netbind' will not report the symbol undefined in the networking image and will instead use the kernel definition. Repeat-By: This bug was seen when testing the updated compiler which supports the 'unsigned long' data type. The unsigned long shift 'ulsh' routine was undefined in both /unix and /netnix but 'netbind' did not declare the symbol undefined in /netnix, using instead the value from the kernel. Fix: The problem was that symbols were declared to be 'external' and 'absolute' by default. This could fool 'netbind' into thinking the symbol had been "defined" with a value of 0. ===============================cut here============================= *** /usr/src/sys/conf/netbind.c.old Mon May 2 08:18:33 1988 --- /usr/src/sys/conf/netbind.c Sun Jun 6 16:16:19 1993 *************** *** 232,250 **** if (!strncmp(sp->s_name, np->n_name, sizeof(np->n_name))) { int type = (np->n_type & N_TYPE); - sp->s_type = N_EXT|N_ABS; switch (type) { case N_TEXT: case N_ABS: sp->s_value = np->n_value; break; case N_DATA: case N_BSS: if (ep->a_flag) sp->s_value = np->n_value; else sp->s_value = np->n_value - ep->a_text; break; default: printf("netbind: symbol %.8s, unhandled type 0x%x\n", np->n_name, np->n_type); --- 232,253 ---- if (!strncmp(sp->s_name, np->n_name, sizeof(np->n_name))) { int type = (np->n_type & N_TYPE); switch (type) { case N_TEXT: case N_ABS: + sp->s_type = N_EXT|N_ABS; sp->s_value = np->n_value; break; case N_DATA: case N_BSS: + sp->s_type = N_EXT|N_ABS; if (ep->a_flag) sp->s_value = np->n_value; else sp->s_value = np->n_value - ep->a_text; break; + case N_UNDF: + return(0); default: printf("netbind: symbol %.8s, unhandled type 0x%x\n", np->n_name, np->n_type); *************** *** 286,292 **** qsort(symtab, symfree - symtab, sizeof(struct symbol), scmp); for (sp = symtab; sp < symfree; sp++) ! if (sp->s_type == N_UNDF) printf("%.8s\n", sp->s_name); } --- 289,295 ---- qsort(symtab, symfree - symtab, sizeof(struct symbol), scmp); for (sp = symtab; sp < symfree; sp++) ! if ((sp->s_type & N_TYPE) == N_UNDF) printf("%.8s\n", sp->s_name); }