public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Brian Dessent <brian@dessent.net>
To: gcc-help@gcc.gnu.org
Subject: Re: --gc-sections on x86
Date: Tue, 05 Dec 2006 09:57:00 -0000	[thread overview]
Message-ID: <45754266.671DDF7E@dessent.net> (raw)
In-Reply-To: <45753BC9.4030306@jeuxvideo.com>

Gabriel Linder wrote:

> I am trying to remove some unused functions from our programs, with gcc
> flag -ffunction-sections and ld flag --gc-sections, but it doesn't seem
> to work at all :-(
> 
> I use gcc 3.2.2, and I get the following (sample source attached, 18
> lines) :
> 2828 bytes with gcc -march=i686 -O2 -ffunction-sections
> -Wl,--gc-sections oblivion.c -o oblivion && strip -s oblivion
> 2812 bytes with gcc -DNOTHING -march=i686 -O2 -ffunction-sections
> -Wl,--gc-sections oblivion.c -o oblivion && strip -s oblivion
> 
> Is this a known problem ? Is a workaround available ?

This testcase may not be actually showing you what you want.  You have
to balance the extra overhead of having a section for each function
against the savings, and in this case the function being removed is
completely trivial.  When you're looking at a 2800 byte ELF file the
noise (headers, padding, etc) is going to overwhelm everything.  Try a
more realistic testcase.

Brian

  reply	other threads:[~2006-12-05  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-05  9:28 Gabriel Linder
2006-12-05  9:57 ` Brian Dessent [this message]
2006-12-05 10:13   ` Gabriel Linder
2006-12-05 14:27     ` Perry Smith
2006-12-05 13:04 ` John Love-Jensen

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=45754266.671DDF7E@dessent.net \
    --to=brian@dessent.net \
    --cc=gcc-help@gcc.gnu.org \
    /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).