summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>2000-04-24 17:56:35 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>2000-04-24 17:56:35 +0000
commit115051500c1b0fcca5a375bb4434d305e124f557 (patch)
tree5f9a5378920aa0631aad078f15326e41e555f600 /gnu
parentca1f29d08580914e45090bdeb2163fc8b4f79111 (diff)
Make dlopened modules prefer symbols defined locally
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/ld/rtld/rtld.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/gnu/usr.bin/ld/rtld/rtld.c b/gnu/usr.bin/ld/rtld/rtld.c
index 40cb78cc220..2485ffec926 100644
--- a/gnu/usr.bin/ld/rtld/rtld.c
+++ b/gnu/usr.bin/ld/rtld/rtld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld.c,v 1.16 2000/02/03 17:19:07 millert Exp $ */
+/* $OpenBSD: rtld.c,v 1.17 2000/04/24 17:56:34 niklas Exp $ */
/* $NetBSD: rtld.c,v 1.43 1996/01/14 00:35:17 pk Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -1100,10 +1100,10 @@ long
binder(jsp)
jmpslot_t *jsp;
{
- struct so_map *smp, *src_map = NULL;
+ struct so_map *smp, *src_map;
long addr;
char *sym;
- struct nzlist *np;
+ struct nzlist *np = NULL;
int index;
/*
@@ -1124,7 +1124,18 @@ binder(jsp)
sym = LM_STRINGS(smp) +
LM_SYMBOL(smp,RELOC_SYMBOL(&LM_REL(smp)[index]))->nz_strx;
- np = lookup(sym, &src_map, 1);
+ /*
+ * If this is a call from a dlopen(3) object, try to resolve locally
+ * first
+ */
+ if (LM_PRIVATE(smp)->spd_flags & RTLD_DL) {
+ src_map = smp;
+ np = lookup(sym, &src_map, 1);
+ }
+ if (np == NULL) {
+ src_map = NULL;
+ np = lookup(sym, &src_map, 1);
+ }
if (np == NULL)
errx(1, "Undefined symbol \"%s\" called from %s:%s at %#x",
sym, main_progname, smp->som_path, jsp);