From owner-freebsd-questions@FreeBSD.ORG Tue Jun 17 06:38:46 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 92CAD37B401; Tue, 17 Jun 2003 06:38:46 -0700 (PDT) Received: from gilliam.users.flyingcroc.net (gilliam.users.flyingcroc.net [207.246.128.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id D32C143FBD; Tue, 17 Jun 2003 06:38:45 -0700 (PDT) (envelope-from joek@mail.flyingcroc.net) Received: from mail.flyingcroc.net (zircon.staff.flyingcroc.net [207.246.150.92])h5HDcTAv002283; Tue, 17 Jun 2003 06:38:30 -0700 (PDT) Message-ID: <3EEF19D5.9040706@mail.flyingcroc.net> Date: Tue, 17 Jun 2003 06:38:29 -0700 From: Joe Kelsey User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030515 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "\"Brandon S. Allbery \"KF8NH" References: <3EEE4717.2090409@mail.flyingcroc.net> <1055804020.79093.2.camel@rushlight.kf8nh.apk.net> In-Reply-To: <1055804020.79093.2.camel@rushlight.kf8nh.apk.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: stable@freebsd.org cc: questions@freebsd.org Subject: Re: Tools to modify shared libraries X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jun 2003 13:38:46 -0000 Brandon S. Allbery KF8NH wrote: > On Mon, 2003-06-16 at 18:39, Joe Kelsey wrote: > >>Has anyone ever come across general-purpose tools for modifying shared >>libraries? What I want to do is to edit the list of "needed" shared >>libraries to correct the common mistakes that developers make in >>creating shared objects with large lists of shared libraries. > GNU objcopy --- but it's a bit *too* general; you'd need to extract the > .dynamic section, edit it using some binary editing tool, and re-add it. I have tried and failed... I even looked at the code. objcopy is horrible as far as it goes. Maybe if I could learn more about bfd in general, there might be something I could do with objcopy, but it does not look promising. > I doubt there are any tools of the kind you're looking for because the > details are too different between different systypes; even if someone > had developed one, it's just as likely to be for Linux or Solaris as for > *BSD, and as a result wouldn't be particularly useful. All 32-bit Elf libraries look the same as far as the DT_NEEDED entries in the DYNAMIC section. In fact, *all* ELF libraries look the same relative to the size of the string table offset used for entries. The DYNAMIC section is the simplest of all sections, generally consisting of a tag and a value, both in the native word size (e.g., 32 or 64). I am surprised that no one has done this yet. I tried elfsh, but the version in ports is too old. I got the most recent version from the website, but it has a lot of linuxisms in it. Basically, what I want to do is remove several entries from the *front* of the dynamic section. Actually, I would settle for just removing all of a certain tag (such as DT_NEEDED) from the dynamic section. /Joe