Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Mar 2007 18:52:39 +0530
From:      "Sam Arun Raj Seeniraj" <samarunraj@gmail.com>
To:        current@freebsd.org
Subject:   Resurrecting old FreeBSD size with a rewrite using libelf
Message-ID:  <4fd6fc030703250622g36ddd5f9r833fb4440958a249@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
------=_Part_169866_31505932.1174828959441
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello there,

This patch is to resurrect the old FreeBSD size with a rewrite using
libelf. Currently supports elf objects, ar(1) archives and core dumps
in elf.

Can handle ELF of various architectures using libelf but doesn't
support any other object file formats unlike the GNU size. The cmdline
parameters as similar to the GNU size minus the long formats. The
output will be also be similar save for difference in indentation.

This is my first patch to FreeBSD & new to the code style, recent
convert from Windows :). Looking for a public review.

Tested by doing,
- make universe
- Comparing output of GNU size versus this against a vast number of
elf objects from different architectures.
- core dumps from i386,amd64 and sparc64 - These were the only ones I
could lay my hands on.

(NOTE: Will disable GNU size)
Apply against,
  /usr in -current as "patch -p0 < size.diff"


Cheers,
-Sam Arun Raj
samarunraj@gmail.com

------=_Part_169866_31505932.1174828959441
Content-Type: text/x-diff; name=size.diff; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: base64
X-Attachment-Id: f_ezpit4so
Content-Disposition: attachment; filename="size.diff"

ZGlmZiAtTmF1ciBzcmMvZ251L3Vzci5iaW4vYmludXRpbHMvTWFrZWZpbGUgc3JjMS9nbnUvdXNy
LmJpbi9iaW51dGlscy9NYWtlZmlsZQotLS0gc3JjL2dudS91c3IuYmluL2JpbnV0aWxzL01ha2Vm
aWxlCUZyaSBKdW4gMjUgMTM6MDQ6NTYgMjAwNAorKysgc3JjMS9nbnUvdXNyLmJpbi9iaW51dGls
cy9NYWtlZmlsZQlTdW4gSmFuIDE0IDA1OjQ5OjQwIDIwMDcKQEAgLTIsNiArMiw2IEBACiAKIFNV
QkRJUj0JC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k7CisJaWYg
KGFyX25hbWUgIT0gTlVMTCAmJiBuYW1lICE9IE5VTEwpCisJCSh2b2lkKSBwcmludGYoIiVzICgl
cyAlcylcbiIsIGFyX25hbWUsIG1zZywgbmFtZSk7CisJZWxzZSBpZiAoYXJfbmFtZSAhPSBOVUxM
ICYmIG5hbWUgPT0gTlVMTCkKKwkJKHZvaWQpIHByaW50ZigiJXMgKCVzKVxuIiwgYXJfbmFtZSwg
bXNnKTsKKwllbHNlCisJCSh2b2lkKSBwcmludGYoIiVzXG4iLCBuYW1lKTsKK30KKwordm9pZAor
dXNhZ2UoKQoreworCSh2b2lkKSBmcHJpbnRmKHN0ZGVyciwgInVzYWdlOiBzaXplIFstQWRob3R4
XSBmaWxlIC4uLlxuIik7CisJZXhpdChFWF9VU0FHRSk7Cit9Cg==
------=_Part_169866_31505932.1174828959441--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4fd6fc030703250622g36ddd5f9r833fb4440958a249>