public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/4][MSP430] Tweaks to default configuration to reduce code size
@ 2019-11-07 21:31 Jozef Lawrynowicz
  2019-11-07 21:34 ` [PATCH 1/4] MSP430: Disable TM clone registry by default Jozef Lawrynowicz
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Jozef Lawrynowicz @ 2019-11-07 21:31 UTC (permalink / raw)
  To: gcc-patches

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).

The following patches change the default configuration for msp430-elf with the
aim of reducing code size by removing these unsupported features.

Related generic changes to GCC have been submitted here:
https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00415.html
(But note that the first patch to disable eh frame registry has been retracted
as it's no longer necessary).

I picked random C and C++ programs from the testsuite to give an
indication of the size reduction:

$ msp430-elf-gcc testsuite/gcc.dg/20000108-1.c -Os -msim -ffunction-sections \
    -fdata-sections -Wl,-gc-sections
Before:
   text    data     bss     dec     hex filename
    708     242      28     978     3d2 20000108-1.exe
After:
   text    data     bss     dec     hex filename
    444     234       2     680     2a8 20000108-1.exe

$ msp430-elf-g++ -msim -Os testsuite/g++.dg/abi/covariant5.C \
    -ffunction-sections -fdata-sections -Wl,-gc-sections
Before:
   text    data     bss     dec     hex filename
   4090     396      18    4504    1198 covariant5.exe
Before (-fno-exceptions):
   text    data     bss     dec     hex filename
   3912     396      18    4326    10e6 a.out
After:
   text    data     bss     dec     hex filename
   3396     122       2    3520     dc0 covariant5.exe

The writeup for the -minrt patch has some more code size comparisons related to
that option.

Successfully regtested for msp430-elf.

Ok to apply?

Jozef Lawrynowicz (4):
  MSP430: Disable TM clone registry by default
  MSP430: Disable exception handling by default for C++
  MSP430: Disable __cxa_atexit
  MSP430: Remove -minrt option

 config-ml.in                                  | 13 +++++++++
 gcc/config.gcc                                |  7 +++++
 gcc/config/msp430/msp430.c                    |  9 +++++++
 gcc/config/msp430/msp430.h                    | 20 +++++++++++---
 gcc/config/msp430/msp430.opt                  |  4 +--
 gcc/config/msp430/t-msp430                    |  9 ++++---
 gcc/doc/install.texi                          |  3 +++
 gcc/doc/invoke.texi                           | 15 ++++-------
 gcc/testsuite/g++.dg/cpp1y/sized-dealloc2.C   |  2 +-
 gcc/testsuite/g++.dg/cpp2a/explicit1.C        |  2 +-
 gcc/testsuite/g++.dg/cpp2a/explicit2.C        |  2 +-
 gcc/testsuite/g++.dg/cpp2a/explicit5.C        |  2 +-
 gcc/testsuite/g++.dg/dg.exp                   |  9 ++++++-
 gcc/testsuite/g++.dg/eh/array1.C              |  2 +-
 gcc/testsuite/g++.dg/eh/spec11.C              |  2 +-
 gcc/testsuite/g++.dg/eh/spec6.C               |  2 +-
 gcc/testsuite/g++.dg/ext/vla4.C               |  2 +-
 gcc/testsuite/g++.dg/init/dso_handle1.C       |  1 +
 gcc/testsuite/g++.dg/init/dso_handle2.C       |  1 +
 gcc/testsuite/g++.dg/ipa/pr64612.C            |  2 +-
 gcc/testsuite/g++.dg/other/cxa-atexit1.C      |  1 +
 gcc/testsuite/g++.dg/other/error32.C          |  2 +-
 gcc/testsuite/g++.dg/torture/dg-torture.exp   |  9 ++++++-
 gcc/testsuite/g++.dg/torture/pr34850.C        |  2 +-
 gcc/testsuite/g++.dg/tree-ssa/ivopts-3.C      |  2 +-
 gcc/testsuite/g++.dg/tree-ssa/pr33615.C       |  2 +-
 gcc/testsuite/g++.dg/warn/Wcatch-value-1.C    |  2 +-
 gcc/testsuite/g++.dg/warn/Wcatch-value-2.C    |  2 +-
 gcc/testsuite/g++.dg/warn/Wcatch-value-3.C    |  2 +-
 .../g++.dg/warn/Wstringop-truncation-2.C      |  2 +-
 gcc/testsuite/g++.dg/warn/Wterminate1.C       |  2 +-
 gcc/testsuite/g++.dg/warn/pr83054.C           |  2 +-
 gcc/testsuite/g++.old-deja/g++.other/cond5.C  |  2 +-
 gcc/testsuite/g++.old-deja/old-deja.exp       |  9 ++++++-
 gcc/testsuite/lib/gcc-dg.exp                  | 10 +++++++
 gcc/testsuite/lib/target-supports.exp         | 27 ++++++++++++++++---
 libgcc/config.host                            |  3 ++-
 libgcc/config/msp430/t-msp430                 |  6 +++++
 libgcc/configure                              |  9 +++++++
 libgcc/configure.ac                           |  8 ++++++
 40 files changed, 166 insertions(+), 47 deletions(-)

-- 
2.17.1

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

end of thread, other threads:[~2019-11-27 13:17 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 21:31 [PATCH 0/4][MSP430] Tweaks to default configuration to reduce code size Jozef Lawrynowicz
2019-11-07 21:34 ` [PATCH 1/4] MSP430: Disable TM clone registry by default Jozef Lawrynowicz
2019-11-17 19:32   ` Jeff Law
2019-11-24 14:22     ` Jozef Lawrynowicz
2019-11-24 17:24       ` Jeff Law
2019-11-24 17:55         ` Jozef Lawrynowicz
2019-11-07 21:37 ` [PATCH 2/4] MSP430: Disable exception handling by default for C++ Jozef Lawrynowicz
2019-11-08  0:07   ` Oleg Endo
2019-11-08 13:26     ` Jozef Lawrynowicz
2019-11-12 21:13       ` Richard Sandiford
2019-11-27 13:51         ` Jozef Lawrynowicz
2019-11-07 21:39 ` [PATCH 3/4] MSP430: Disable __cxa_atexit Jozef Lawrynowicz
2019-11-07 21:41 ` [PATCH 4/4] MSP430: Deprecate -minrt option Jozef Lawrynowicz
2019-11-17 21:02   ` Jeff Law
2019-11-24 16:38     ` Jozef Lawrynowicz
2019-11-08 12:14 ` [PATCH 0/4][MSP430] Tweaks to default configuration to reduce code size Oleg Endo
2019-11-08 13:27   ` Jozef Lawrynowicz
2019-11-08 13:59     ` Oleg Endo
2019-11-08 14:32       ` Jozef Lawrynowicz

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).