dead code removal

Daniel Jacobowitz drow at
Thu Nov 25 17:53:32 EST 1999

That kind of stripping can not be done by the compiler.  It could
theoretically be done by the linker, and there MIGHT be a linker option
to give the warnings you want - what if another object file in your
program called DummyFunc?  Or worse, what if a shared library expected
DummyFunc to be available?

On Wed, Nov 24, 1999 at 05:10:03PM -0800, Jim Reekes wrote:
> I have a little program that contains a routine DummyFunc() which is
> never reference in the code. Building this single source file in any way
> I've tried results in a binary which contains DummyFunc(). Using nm and
> objdump, as far as I can determine GCC 2.95 does not dead-code strip.
> (which I find amazing!). So I have two questions.
> Am I missing something and GCC actually does dead-code stripping?
>  - or - 
> How can I find unused/unreferenced symbols in my code so that I can bury
> the dead code manually?
> Jim
> P.S. I have always compared programming to ditch digging, and now I'm
> convinced.


/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         dan at         |  |       dmj+ at      |
\--------------------------------/  \--------------------------------/

** Sent via the linuxppc-dev mail list. See

More information about the Linuxppc-dev mailing list