Tools for removing code

Ted Gould ted at gould.cx
Wed Oct 4 22:00:16 MST 2006


On Wed, 2006-10-04 at 17:57 -0700, Daniel P. Stasinski wrote:
> I just started working on a project that involves removing a ton of
> code out of another project and it's proving to be tedious.  Is anyone
> familiar with techniques or specific Linux based tools for identifying
> unused functions in C apps? 
> 
> I believe there are gcc optimizations to remove the code at compile
> time, but for my own sanity I would rather remove them completely from
> the source.

I don't know of a tool to do specifically that.  But, one tool that
could be used for that (and is a really cool tool) is egypt [1].  Egypt
outputs a graphviz dot file, which has a really simple syntax.  I'm sure
you could parse it to find out which functions didn't have any callers.
I'm not sure how much optimization is done by GCC before the RTL level,
but I don't think functions are removed.  You can probably use -O0 to
force it not to.

		--Ted

[1] http://www.gson.org/egypt/egypt.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20061004/887dfa06/attachment.pgp 


More information about the PLUG-discuss mailing list