I changed this up slightly to always prefer the first definition,
and since the kernel's symbols are always defined first, this has
the effect you desired.
Using first definition instead of last is how symbol resolution
normally works in linkers. Doing otherwise is just confusing.
I checked this in to vger's cvs.
r~
Index: depmod/depmod.c
===================================================================
RCS file: /disk1/u4/cvs/modutils/depmod/depmod.c,v
retrieving revision 1.6
diff -c -p -d -r1.6 depmod.c
*** depmod.c 1999/03/25 15:13:03 1.6
--- depmod.c 1999/07/29 22:12:16
*************** static void resolve(void)
*** 160,184 ****
for (resolved = 1, n = 0, sym = mod->undefs.symtab;
n < mod->undefs.n_syms; ++sym, ++n) {
! SYMBOL *psym = *sym;
! if (psym->status == SYM_UNDEF) {
! /*
! * This is an undefined symbol.
! * Find first definition.
! * Symbol hash linked list has newest first.
! */
! SYMBOL *find;
! for (find = symhash[psym->hashval]; find; find = find->next) {
! if (strcmp(find->name, psym->name) == 0) {
! psym->status = SYM_RESOLVED;
! psym->module = find->module;
! break;
! }
}
! if (!find)
! resolved = 0; /* still unresolved */
}
}
mod->resolved = resolved;
}
--- 160,186 ----
for (resolved = 1, n = 0, sym = mod->undefs.symtab;
n < mod->undefs.n_syms; ++sym, ++n) {
! SYMBOL *psym = *sym, *find;
! if (psym->status != SYM_UNDEF)
! continue;
!
! /* This is an undefined symbol. Find first
! definition. Symbol hash linked list has
! newest first, so we want the last match in
! the chain. In particular, this prefers
! kernel symbols to that of any module. */
!
! find = symhash[psym->hashval];
! while (find) {
! if (strcmp(find->name, psym->name) == 0) {
! psym->status = SYM_RESOLVED;
! psym->module = find->module;
}
! find = find->next;
}
+ if (psym->status == SYM_UNDEF)
+ resolved = 0;
}
mod->resolved = resolved;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/