public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Freddie Chopin <freddie_chopin@op.pl>
To: GCC Development <gcc@gcc.gnu.org>
Subject: Re: LTO vs GCC 8
Date: Fri, 11 May 2018 15:50:00 -0000	[thread overview]
Message-ID: <ef5578b315ac6ce4dea84483b4e76b20bedd092b.camel@op.pl> (raw)
In-Reply-To: <5AF5793A.1050900@westcontrol.com>

On Fri, 2018-05-11 at 13:06 +0200, David Brown wrote:
> For the Cortex-M devices (and probably many other RISC targets),
> -fdata-sections comes at a big cost - it effectively blocks
> -fsection-anchors and makes access to file-static data a lot bigger.
> People often use -fdata-sections and -ffunction-sections along with
> -Wl,--gc-sections with the aim of removing unused code and data (and
> thus saving space, useful on small devices) - I would expect LTO
> would
> manage that anyway.  The other purpose of these is to improve
> locality
> of reference - again LTO should do that for you.  But even without
> LTO,
> I find the cost of -fdata-sections high compared to -fsection-
> anchors.

Unfortunatelly having LTO doesn't make -ffunction-sections + -fdata-
sections + --gc-sections useless.

My test project compiled:
- without LTO and without these attributes - 150824 B ROM + 4240 B RAM
- with LTO and without these attributes - 133812 B ROM + 4208 B RAM
- without LTO and with these attributes - 124456 B ROM + 3484 B RAM
- with LTO and with these attributes - 120280 B ROM + 3680 B RAM

As you see these attributes give much more than LTO in terms of size.

As for the -fsection-anchors I guess this has no use for non-PIC code
for arm-none-eabi. Whether I use it or not, the sizes are identical.

Regards,
FCh

  reply	other threads:[~2018-05-11 15:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 21:32 Freddie Chopin
2018-05-11  9:19 ` Richard Biener
2018-05-11 11:06   ` David Brown
2018-05-11 15:50     ` Freddie Chopin [this message]
2018-05-11 16:51       ` Richard Biener
2018-05-15 19:39         ` Freddie Chopin
2018-05-15 20:13           ` Freddie Chopin
2018-05-16  5:26             ` Richard Biener
2018-05-14 14:34       ` David Brown
2018-05-15 20:04         ` Freddie Chopin
2018-05-16  7:37           ` David Brown
2018-05-11 15:33   ` Freddie Chopin

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=ef5578b315ac6ce4dea84483b4e76b20bedd092b.camel@op.pl \
    --to=freddie_chopin@op.pl \
    --cc=gcc@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).