diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2000-02-11 23:45:07 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2000-02-11 23:45:07 +0000 |
commit | 74b93166e8b7af91577567879955f26f73d83a0e (patch) | |
tree | 855954c3eba598368d55941f64f6cddc881a8429 /gnu | |
parent | df4a3d3cecf2e3097e36ddfda4f0a27b5fa874d6 (diff) |
Let weak symbols take precedence over symbols read from 2nd hand libraries.
This fixes an important bug: libc now uses weak symbols a lot.
Without this patch, dynamic linking with libraries that reference libc
would mean those symbols would not be resolved, as weak symbols are good
enough for linking, but 2nd hand libraries symbols are not.
Not 100% sure this won't trigger problems later (nothing yet), but this
fixes the immediate problem.
Approved by niklas@ and millert@
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/ld/ld.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c index 4ee1d71ac31..4067441b55a 100644 --- a/gnu/usr.bin/ld/ld.c +++ b/gnu/usr.bin/ld/ld.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ld.c,v 1.12 1999/05/24 23:22:01 espie Exp $ */ +/* $OpenBSD: ld.c,v 1.13 2000/02/11 23:45:06 espie Exp $ */ /* $NetBSD: ld.c,v 1.52 1998/02/20 03:12:51 jonathan Exp $ */ /*- @@ -1882,6 +1882,7 @@ digest_pass1() FOR_EACH_SYMBOL(i, sp) { symbol *spsave; struct localsymbol *lsp; + struct nlist *q; int defs = 0; if (!(sp->flags & GS_REFERENCED)) { @@ -2029,6 +2030,11 @@ digest_pass1() common_defined_global_count--; undefined_global_sym_count++; } + /* Let WEAK symbols take precedence over second class */ + if (q != 0 && N_ISWEAK(q) && + (lsp->entry->flags & E_SECONDCLASS)) + continue; + q = p; sp->def_lsp = lsp; sp->so_defined = type; |