From owner-freebsd-current@FreeBSD.ORG Mon Jan 5 00:29:48 2009 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00C6E106566B for ; Mon, 5 Jan 2009 00:29:48 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from sippysoft.com (gk1.360sip.com [72.236.70.240]) by mx1.freebsd.org (Postfix) with ESMTP id BF6468FC0C for ; Mon, 5 Jan 2009 00:29:47 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from [192.168.1.38] (S0106001372fd1e07.vs.shawcable.net [70.71.171.106]) (authenticated bits=0) by sippysoft.com (8.13.8/8.13.8) with ESMTP id n050TjsI011423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 4 Jan 2009 16:29:46 -0800 (PST) (envelope-from sobomax@FreeBSD.org) Message-ID: <49615475.2030803@FreeBSD.org> Date: Sun, 04 Jan 2009 16:29:41 -0800 From: Maxim Sobolev Organization: Sippy Software, Inc. User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Luigi Rizzo References: <20090104234238.GA44381@onelab2.iet.unipi.it> In-Reply-To: <20090104234238.GA44381@onelab2.iet.unipi.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: current@FreeBSD.org Subject: Re: upcoming elfdump refactoring X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2009 00:29:48 -0000 Luigi Rizzo wrote: > I need to extract value and size of some symbols from an ELF file, > and make them available to a C program, something like > > nm -S /boot/kernel/kernel | grep -E "(kernload|kernbase|uscanner_devs)" > > Rather than using the above tools plus popen() and some parsing code, > I have refactored src/usr.bin/elfdump/elfdump.c , > making the main routine externally callable, returning the > desired info in a struct rather than print them out. > > I don't know if/how other programs might need to call elfdump(), > but given that the changes I made have no functional or performance > drawback, I would like to commit them to the tree. > Objections ? > > (note, the diff will be large because in the process I also removed > global variables and staticize/constify things) Why not make this function part of libelf? -Maxim