This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 0/4][MSP430] Tweaks to default configuration to reduce code size
- From: Jozef Lawrynowicz <jozef dot l at mittosystems dot com>
- To: Oleg Endo <oleg dot endo at t-online dot de>
- Cc: "gcc-patches at gcc dot gnu dot org\" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 8 Nov 2019 13:27:33 +0000
- Subject: Re: [PATCH 0/4][MSP430] Tweaks to default configuration to reduce code size
- References: <20191107213110.0ceea63a@jozef-kubuntu> <499598fe5ecee576412b6e2debbc77dfca32596b.camel@t-online.de>
On Fri, 08 Nov 2019 21:14:19 +0900
Oleg Endo <oleg.endo@t-online.de> wrote:
> On Thu, 2019-11-07 at 21:31 +0000, Jozef Lawrynowicz wrote:
> > When building small programs for MSP430, the impact of the unused
> > functions pulled in from the CRT libraries is quite noticeable. Most of these
> > relates to feature that will never be used for MSP430 (Transactional memory,
> > supporting shared objects and dynamic linking), or rarely used (exception
> > handling).
>
> There's a magic switch, which does the business, at least for me, most
> of the time:
>
> -flto
>
> If you're trying to bring down the executable size as much as possible,
> but don't use -flto, I think something is wrong.
>
> Cheers,
> Oleg
>
Yes, I should have used -flto in my examples. But it doesn't help remove these
CRT library functions which are normally either directly added to the
list of functions to run before main (via .init, .ctors or .init_array) or used
in functions which are themselves added to this list.
The unnecessary functions we want to remove are:
deregister_tm_clones
register_tm_clones
__do_global_dtors_aux
frame_dummy
LTO can't remove any of them.
Thanks,
Jozef