Some embedded devices are so memory constrained that using -Os or -Oz
is the only way to get the code to fit. Such devices want to use this
option with everything they link, including system libraries like
libc, libm and libgcc.

This series, which will be part of Zephyr SDK version 1.0, adds a new
gcc config option, --enable-multilib-space, that automatically doubles
the set of multilib configurations, creating a new configuration
selected when -Os or -Oz is specified on the compile command line.

When --enable-multilib-space is specified without --enable-multilib,
multilib is implicitly enabled with two configurations.

There are three possible settings for --enable-multilib-space:

--enable-multilib-space=no

    Does nothing (default)

--enable-multilib-space=except

    Adds new -Os variants but doesn't change CXXFLAGS.

--enable-multilib-space=yes

    Adds new -Os variants and includes -fno-exceptions and
    -fno-asynchronous-unwind-tables in CXXFLAGS while building
    target libraries (including libstdc++).

This new option conflicts with the operation of
--enable-target-optspace, so the patch includes code which checks to
see if both are enabled at the same time and emits an error message
during configure.

An earlier version of this series is part of the changes Zephyr SDK
1.0 adds to gcc 14.3 and has been verified to work correctly for all
twelve of those targets.

When not enabled, there should be no effect on the build at all.

There are two preparatory patches:

  1. When building libgcc, respect a -Os or -Oz option that appears
     anywhere in the CC or CFLAGS values by explicitly appending those
     to INTERNAL_CFLAGS and CRTSTUFF_FLAGS

  2. Clean up the ARM multilib configuration settings. That was missing
     some explicit default values, -marm and -mfloat-abi=soft.

Keith Packard (3):
  libgcc: Use -Os/-Oz from CC or CFLAGS
  arm: Add missing multilib default values
  gcc: Add --enable-multilib-space option

 config-ml.in              | 17 +++++++++++++----
 config/multi.m4           | 19 +++++++++++++++++++
 configure.ac              |  6 ++++++
 gcc/Makefile.in           | 32 +++++++++++++++++++++++++++-----
 gcc/config/arm/arm-mlib.h |  2 +-
 gcc/configure.ac          | 10 ++++++++++
 gcc/doc/install.texi      | 12 ++++++++++++
 libgcc/Makefile.in        | 10 +++++++---
 8 files changed, 95 insertions(+), 13 deletions(-)

-- 
2.51.0

Reply via email to