From owner-freebsd-stable Thu Dec 13 9: 4:55 2001 Delivered-To: freebsd-stable@freebsd.org Received: from wall.polstra.com (wall-gw.polstra.com [206.213.73.130]) by hub.freebsd.org (Postfix) with ESMTP id D618737B416 for ; Thu, 13 Dec 2001 09:04:50 -0800 (PST) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.11.3/8.11.3) with ESMTP id fBDH4b076597; Thu, 13 Dec 2001 09:04:37 -0800 (PST) (envelope-from jdp@wall.polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.11.6/8.11.0) id fBDH4aM14501; Thu, 13 Dec 2001 09:04:36 -0800 (PST) (envelope-from jdp) Date: Thu, 13 Dec 2001 09:04:36 -0800 (PST) Message-Id: <200112131704.fBDH4aM14501@vashon.polstra.com> To: stable@freebsd.org From: John Polstra Cc: joe@zircon.seattle.wa.us Subject: Re: rtld-elf issues In-Reply-To: <15382.36337.945315.693398@zircon.zircon.seattle.wa.us> References: <15382.36337.945315.693398@zircon.zircon.seattle.wa.us> Organization: Polstra & Co., Seattle, WA Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In article <15382.36337.945315.693398@zircon.zircon.seattle.wa.us>, Joe Kelsey wrote: > What should rtld-elf do when asked to load an already loaded shared > object? > > Currently, if you manually request loading of a shared object via > dlopen, rtld-elf will recursively try to load any libraries that the > shared object references. If the shared library references an already > manually-loaded shared object, it still attempts to find the shared > object via the various paths in effect at the time of the dlopen call. > This is an unnecessary effort, since the module is already loaded, yet > the search can fail and abort the program due to phantom dlopen errors. For every library it tries to load (including libraries specified by dependencies), it first checks to see if it already has that exact pathname loaded. If so, it just increments a reference count without reloading the library. If there is no pathname match, it opens the library file found by its usual search rules (but doesn't load it yet). Then it checks the device and inode numbers against all currently loaded libraries to see if the same file is already loaded by a different pathname. If it finds a match it increments a reference count without reloading the library. What do you think it should do? > Shouldn't the loader notice that libjvm.so is already mapped into the > address space and skip checking for it on the disk? No, I don't think so. There could be any number of different libraries named "libjvm.so". Without an absolute pathname, it can't assume they're all the same. To get what you want, I think you might need to specify the appropriate -rpath arguments when building the shared libraries. Man ld(1) for details. John -- John Polstra John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message