This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Listing and removing unused objects
- From: AWLaFramboise at aol dot com
- To: gcc at gnu dot org
- Date: Sat, 25 Jan 2003 22:55:11 -0500
- Subject: Listing and removing unused objects
Hi,
I am interested in two possible features.
1) Is it possible
to trivially use GCC to generate a list of symbols that are defined
and used in a file, and imported (and presumably defined elsewhere)?
I would like this so I can generate a list of symbols that are unused
within an entire program build (unused functions, data).
2) Is there
a way to cause GCC to not emit functions/data for a list of symbols?
This would be useful in combination with the list of dead symbols from #1
to eliminate these unused objects from the final executable.
If GCC
can not do this directly, is there some combination of shell scripting
and usual UNIX development tools (binutils, etc) that could be used to
accomplish it? If not, can someone advise me on how I might best modify
GCC to facilitate this?
Having found an unbeleivable amount of dead
code in my executables, I've started taking considerable interest in
trimming this fat. All compilers I have looked at do decidedly poorly in
this department. I was actually suprised by how little interest there is
in this, and in fact the only interest I have seen in the GNU development
tools is the GNU ld --gc-sections option, which never works for this kind
of thing in practical situations due to a combination of technicalities.
Thank you for your time and assistance,
Aaron W. LaFramboise