From owner-freebsd-stable@FreeBSD.ORG Tue Jun 17 11:09:01 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D9E1437B401; Tue, 17 Jun 2003 11:09:01 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 580FA43F93; Tue, 17 Jun 2003 11:09:00 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h5HI8wKF019321; Tue, 17 Jun 2003 13:08:58 -0500 (CDT) (envelope-from dan) Date: Tue, 17 Jun 2003 13:08:58 -0500 From: Dan Nelson To: Marcel Moolenaar Message-ID: <20030617180858.GL64929@dan.emsphone.com> References: <3EEE4717.2090409@mail.flyingcroc.net> <1055804020.79093.2.camel@rushlight.kf8nh.apk.net> <3EEF19D5.9040706@mail.flyingcroc.net> <20030617154208.GA584@dhcp01.pn.xcllnt.net> <3EEF3883.1080500@mail.flyingcroc.net> <20030617160141.GB584@dhcp01.pn.xcllnt.net> <20030617130236.7c683e4c.ak03@gte.com> <20030617174834.GA1012@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030617174834.GA1012@dhcp01.pn.xcllnt.net> X-OS: FreeBSD 5.1-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i cc: stable@freebsd.org cc: questions@freebsd.org cc: Joe Kelsey Subject: Re: Tools to modify shared libraries X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jun 2003 18:09:02 -0000 In the last episode (Jun 17), Marcel Moolenaar said: > On Tue, Jun 17, 2003 at 01:02:36PM -0400, Alexander Kabaev wrote: > > On Tue, 17 Jun 2003 09:01:41 -0700 > > Marcel Moolenaar wrote: > > > On Tue, Jun 17, 2003 at 08:49:23AM -0700, Joe Kelsey wrote: Linux > > > uses the same linker (GNU ld). Fixing the linker will have the > > > same effect on Linux as it will have on FreeBSD and hence will > > > prevent unnecessary dependencies in Linux libraries to Linux > > > libraries and thus remove the need to patch ELF files in the long > > > run. > > > > > > > LD putting a library in DT_NEEDED regardless of whether or not > > library exports any required symbols as long as it appears on > > command line is a feature, not a bug AFAIK. > > It's a bug because DT_NEEDED serves the purpose of recording library > dependencies. Any library that does not contribute to symbol > resolution is by definition not a dependency. Hence, its presence in > DT_NEEDED only makes the dependency information wrong. Dependency > information that's wrong is untrustworthy and unreliable and thus > unusable. Hence, a bug. Immediate consequences of broken dependency > information is the increased startup time of shared binaries, the > restriction in use of libraries in cases where they can be used and > the obstruction in replacing libraries with different implementations > by possibly causing artificial conflicts due to unnecessary loading > of libraries. > > Only explicit user directives should allow adding libraries to DT_NEEDED > regardless of whether there's actually a dependency. Dependencies can change after a program is linked, though. How about the contrived case of a program needing the openpty function, so -lutil is linked in. Then 6 months later openpty is moved to libc, making the dependency on libutil unneeded. The end result is the same as if a new program is unnecessarily linked with -lutil, but cannot be "fixed" with ld because at the time it was linked, the first program actually did need libutil. -- Dan Nelson dnelson@allantgroup.com