This option adds a per-multilib variant that specifies -Os instead of the default. With this, all multilib libraries will be built with -Os as well as -O2; the appropriate one selected automatically at link time based upon the optimization level selected.
This could be done in the target configuration, but adding it globally allows it to be used with any existing target. gcc/ChangeLog: * Makefile.in: Expand multilib set when --enable-multilib-space * configure.ac: Support --enable-multilib-space option * configure: Regenerate Signed-off-by: Keith Packard <kei...@keithp.com> --- gcc/Makefile.in | 16 ++++++++++++++-- gcc/configure | 13 +++++++++++++ gcc/configure.ac | 7 +++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index b7735908de7..56df632dc94 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2304,6 +2304,18 @@ libgcc.mvars: config.status Makefile specs xgcc$(exeext) mv tmp-libgcc.mvars libgcc.mvars +ifeq (@enable_multilib_space@,yes) +MULTILIB_OPTIONS += Os +MULTILIB_DIRNAMES += space +MULTILIB_MATCHES += Os=Oz + +MULTILIB_REQUIRED_SPACE = $(if $(MULTILIB_REQUIRED),Os $(foreach REQ, $(MULTILIB_REQUIRED), $(REQ) $(REQ)/Os),) +MULTILIB_EXCEPTIONS_SPACE = $(foreach EXC, $(MULTILIB_EXCEPTIONS), $(EXC) $(EXC)/Os) +else +MULTILIB_REQUIRED_SPACE = $(MULTILIB_REQUIRED) +MULTILIB_EXCEPTIONS_SPACE = $(MULTILIB_EXCEPTIONS) +endif + # Use the genmultilib shell script to generate the information the gcc # driver program needs to select the library directory based on the # switches. @@ -2315,11 +2327,11 @@ s-mlib: $(srcdir)/genmultilib Makefile "$(MULTILIB_OPTIONS)" \ "$(MULTILIB_DIRNAMES)" \ "$(MULTILIB_MATCHES)" \ - "$(MULTILIB_EXCEPTIONS)" \ + "$(MULTILIB_EXCEPTIONS_SPACE)" \ "$(MULTILIB_EXTRA_OPTS)" \ "$(MULTILIB_EXCLUSIONS)" \ "$(MULTILIB_OSDIRNAMES)" \ - "$(MULTILIB_REQUIRED)" \ + "$(MULTILIB_REQUIRED_SPACE)" \ "$(if $(MULTILIB_OSDIRNAMES),,$(MULTIARCH_DIRNAME))" \ "$(MULTILIB_REUSE)" \ "@enable_multilib@" \ diff --git a/gcc/configure b/gcc/configure index 5acc42c1e4d..2a12a7cd224 100755 --- a/gcc/configure +++ b/gcc/configure @@ -856,6 +856,7 @@ DEFAULT_MATCHPD_PARTITIONS with_float with_cpu enable_multiarch +enable_multilib_space enable_multilib coverage_flags valgrind_command @@ -977,6 +978,7 @@ enable_coverage enable_gather_detailed_mem_stats enable_valgrind_annotations enable_multilib +enable_multilib_space enable_multiarch with_stack_clash_protection_guard_size with_matchpd_partitions @@ -1718,6 +1720,7 @@ Optional Features: --enable-valgrind-annotations enable valgrind runtime interaction --enable-multilib enable library support for multiple ABIs + --enable-multilib-space enable extra -Os variant for every multilib ABI --enable-multiarch enable support for multiarch paths --enable-__cxa_atexit enable __cxa_atexit for C++ --enable-decimal-float={no,yes,bid,dpd} @@ -7834,6 +7837,16 @@ fi +# Determine whether or not -Os multilibs are enabled. +# Check whether --enable-multilib-space was given. +if test "${enable_multilib_space+set}" = set; then : + enableval=$enable_multilib_space; +else + enable_multilib_space=yes +fi + + + # Determine whether or not multiarch is enabled. # Check whether --enable-multiarch was given. if test "${enable_multiarch+set}" = set; then : diff --git a/gcc/configure.ac b/gcc/configure.ac index 23f4884eff9..84faf3a7645 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -848,6 +848,13 @@ AC_ARG_ENABLE(multilib, [], [enable_multilib=yes]) AC_SUBST(enable_multilib) +# Determine whether or not -Os multilibs are enabled. +AC_ARG_ENABLE(multilib-space, +[AS_HELP_STRING([--enable-multilib-space], + [enable extra -Os variant for every multilib ABI])], +[], [enable_multilib_space=yes]) +AC_SUBST(enable_multilib_space) + # Determine whether or not multiarch is enabled. AC_ARG_ENABLE(multiarch, [AS_HELP_STRING([--enable-multiarch], -- 2.45.2