public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Melvin Blades <melvin.blades@gmail.com>
Cc: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: removing unused functions during final link
Date: Wed, 27 Aug 2014 21:22:00 -0000	[thread overview]
Message-ID: <CAKOQZ8w_2Rg85sfHTwvZSYngGw4=n+oeVz7rWcU2x2ngJRebqA@mail.gmail.com> (raw)
In-Reply-To: <CAG=1SRt3jGm2invypb+qa_viFefd7_v9oq8bFs2ji72hvbcU1Q@mail.gmail.com>

On Wed, Aug 27, 2014 at 2:02 PM, Melvin Blades <melvin.blades@gmail.com> wrote:
>
> What command line options can I use to get the linker to strip unused
> functions from the final executable?

Compile with -ffunction-sections -fdata-sections.

Link with -Wl,--gc-sections.

Ian

  reply	other threads:[~2014-08-27 21:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 21:02 Melvin Blades
2014-08-27 21:22 ` Ian Lance Taylor [this message]
2014-09-03  3:20   ` Melvin Blades
2014-09-03 10:21     ` Andrew Haley
2014-09-03 15:09       ` Melvin Blades
2014-09-03 15:13         ` Andrew Haley
2014-09-05 15:24           ` Melvin Blades

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKOQZ8w_2Rg85sfHTwvZSYngGw4=n+oeVz7rWcU2x2ngJRebqA@mail.gmail.com' \
    --to=iant@google.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=melvin.blades@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).