Date: Thu, 13 Dec 2001 09:04:36 -0800 (PST) From: John Polstra <jdp@polstra.com> To: stable@freebsd.org Cc: joe@zircon.seattle.wa.us Subject: Re: rtld-elf issues Message-ID: <200112131704.fBDH4aM14501@vashon.polstra.com> In-Reply-To: <15382.36337.945315.693398@zircon.zircon.seattle.wa.us> References: <15382.36337.945315.693398@zircon.zircon.seattle.wa.us>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <15382.36337.945315.693398@zircon.zircon.seattle.wa.us>, Joe Kelsey <joe@zircon.seattle.wa.us> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112131704.fBDH4aM14501>