summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-11-08 07:40:26 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-11-08 07:40:26 +0000
commitdacf6ffc85c53dc9f8739793acce10b588532129 (patch)
tree328945a798db25b150821d5dd683e62c72d36ae7 /gnu/usr.bin
parent6859c30d4c78b187647616a4bba463e74c13480b (diff)
fixes netbsd PR #10940 and also uses main program's library search
path in dlopen(), from netbsd as well.
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/ld/rtld/rtld.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gnu/usr.bin/ld/rtld/rtld.c b/gnu/usr.bin/ld/rtld/rtld.c
index aa80b0f308a..471e6fcf908 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.19 2001/06/09 21:51:58 espie Exp $ */
+/* $OpenBSD: rtld.c,v 1.20 2001/11/08 07:40:25 fgsch Exp $ */
/* $NetBSD: rtld.c,v 1.43 1996/01/14 00:35:17 pk Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -294,6 +294,7 @@ rtld(version, crtp, dp)
(caddr_t)0, 0, crtp->crt_dp);
LM_PRIVATE(smp)->spd_refcount++;
LM_PRIVATE(smp)->spd_flags |= RTLD_MAIN;
+ main_map = smp;
smp = alloc_link_map(us, (struct sod *)0, (struct so_map *)0,
(caddr_t)crtp->crt_ba, 0, dp);
@@ -509,8 +510,6 @@ alloc_link_map(path, sodp, parent, addr, size, dp)
smp->som_dynamic = dp;
smp->som_spd = (caddr_t)smpp;
-/*XXX*/ if (addr == 0) main_map = smp;
-
smpp->spd_refcount = 0;
smpp->spd_flags = 0;
smpp->spd_parent = parent;
@@ -978,8 +977,11 @@ lookup(name, src_map, strong)
struct so_map *smp;
struct rt_symbol *rtsp;
- if ((rtsp = lookup_rts(name)) != NULL)
+ if ((rtsp = lookup_rts(name)) != NULL) {
+ /* Common symbol is not a member of particular shlib. */
+ *src_map = NULL;
return rtsp->rt_sp;
+ }
/*
* Search all maps for a definition of NAME
@@ -1085,6 +1087,9 @@ restart:
rtsp = enter_rts(name, (long)calloc(1, common_size),
N_UNDF + N_EXT, 0, common_size, NULL);
+ /* Common symbol is not a member of particular shlib. */
+ *src_map = NULL;
+
#if DEBUG
xprintf("Allocating common: %s size %d at %#x\n", name, common_size, rtsp->rt_sp->nz_value);
#endif
@@ -1517,7 +1522,7 @@ __dlopen(name, mode)
build_sod(name, sodp);
- if ((smp = map_object(sodp, 0)) == NULL) {
+ if ((smp = map_object(sodp, main_map)) == NULL) {
#ifdef DEBUG
xprintf("%s: %s\n", name, strerror(errno));
#endif