public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Dropping unused functions out of linked file
@ 2005-05-26  0:01 Brian Smith
  2005-05-26  0:24 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Smith @ 2005-05-26  0:01 UTC (permalink / raw)
  To: gcc-help

Dear GCC-Help,

Is there any way during the link or compile processes to drop out functions 
and variables that are not used? Part of my source code includes generic 
modules provided by another vendor and I only need about 30% of the code 
that is in those source files. The optimisation -Os does not drop them out 
and I can see no options in the link process to do this. I am using the 
MSP430 port of gcc though this seems to be a GCC thing rather than specific 
to the MSP430 port.

Any ideas?

Brian


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Dropping unused functions out of linked file
  2005-05-26  0:01 Dropping unused functions out of linked file Brian Smith
@ 2005-05-26  0:24 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2005-05-26  0:24 UTC (permalink / raw)
  To: Brian Smith; +Cc: gcc-help

"Brian Smith" <bsmith@tytronics.com.au> writes:

> Is there any way during the link or compile processes to drop out
> functions and variables that are not used? Part of my source code
> includes generic modules provided by another vendor and I only need
> about 30% of the code that is in those source files. The optimisation
> -Os does not drop them out and I can see no options in the link
> process to do this. I am using the MSP430 port of gcc though this
> seems to be a GCC thing rather than specific to the MSP430 port.

Compile with -ffunction-sections -fdata-sections.  Link with
-Wl,--gc-sections.  This only works if you are using the GNU linker.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-26  0:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-26  0:01 Dropping unused functions out of linked file Brian Smith
2005-05-26  0:24 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).