summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/ld
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2001-07-08 17:49:45 +0000
committerMarc Espie <espie@cvs.openbsd.org>2001-07-08 17:49:45 +0000
commit9f6b2c42cd06a58a875bb5160fd875e39e6c8998 (patch)
treea99f241c2e5b341a724a8c3e88f3bd5d70143082 /gnu/usr.bin/ld
parent8d9d23ec26b72162942c4c2fff2c8b0d26bc9ab3 (diff)
Fix an obscure bug: make sure aliases are referenced.
Otherwise, if a shared library uses an aliased symbol in another library, the alias will only be partially resolved (everything setup... except for the real symbol marked as referenced, so the relocation ends up being zero and causes core-dumps on runtimes). Caused quite a few crashes: Xfree's 4 GL (linked with libc_r) or kerberosV exhibited the problem...
Diffstat (limited to 'gnu/usr.bin/ld')
-rw-r--r--gnu/usr.bin/ld/ld.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c
index a0a49abbf0e..7856a21893a 100644
--- a/gnu/usr.bin/ld/ld.c
+++ b/gnu/usr.bin/ld/ld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.c,v 1.17 2000/09/21 12:03:12 espie Exp $ */
+/* $OpenBSD: ld.c,v 1.18 2001/07/08 17:49:44 espie Exp $ */
/* $NetBSD: ld.c,v 1.52 1998/02/20 03:12:51 jonathan Exp $ */
/*-
@@ -1437,11 +1437,14 @@ enter_global_ref(lsp, name, entry)
} else {
if ((entry->flags & E_DYNAMIC) == 0)
global_alias_count++;
+ if (sp->flags & GS_REFERENCED) {
+ if (!(sp->alias->flags & GS_REFERENCED)) {
+ sp->alias->flags |= GS_REFERENCED;
+ if (!sp->alias->defined)
+ undefined_global_sym_count++;
+ }
+ }
}
-#if 0
- if (sp->flags & GS_REFERENCED)
- sp->alias->flags |= GS_REFERENCED;
-#endif
}
if (entry->flags & E_DYNAMIC) {