Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 04 Jan 2009 18:32:17 -0800
From:      Marcel Moolenaar <xcllnt@mac.com>
To:        Maxim Sobolev <sobomax@FreeBSD.org>
Cc:        Luigi Rizzo <rizzo@iet.unipi.it>, current@FreeBSD.org
Subject:   Re: upcoming elfdump refactoring
Message-ID:  <0AE16877-C02A-40A1-9F3B-FE839CB7B9E5@mac.com>
In-Reply-To: <49615475.2030803@FreeBSD.org>
References:  <20090104234238.GA44381@onelab2.iet.unipi.it> <49615475.2030803@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jan 4, 2009, at 4:29 PM, Maxim Sobolev wrote:

> 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?

Please don't. libelf has a standard and well-documented
API. Don't add random or one-off functions simply on
the basis of them having "elf" in the name.

In fact, elfdump(1) should really use libelf(3) to read
ELF files.

-- 
Marcel Moolenaar
xcllnt@mac.com






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0AE16877-C02A-40A1-9F3B-FE839CB7B9E5>