diff mbox series

[RFC] New features for multilib control

Message ID 08c301d4031e$50758bd0$f160a370$@gmail.com
State New
Headers show
Series [RFC] New features for multilib control | expand

Commit Message

Matthew Fortune June 13, 2018, 1:56 p.m. UTC
Hi,

This patch was developed as part of preparing ever more complex multilib
combinations for the MIPS architecture and aims to solve several problems
in this area. I've attempted to be quite verbose in the description, so
that I can explain how I am using various terms as pretty much everyone
has a different understanding (and I don't claim mine to be 'right'
either).

The changes aim to:

1) Eliminate the fallback multilib
The fallback multilib (top level of 'lib') is often annoying because it is
used for any combination of options that do not match a specific multilib.
Quite often this default multilib is incompatible with the build options
that end up linking against it, leading to bizarre link time messages that
confuse ordinary users.

2) Move the default multilib to a subfolder
Having successfully eliminated the fallback multilib it is also true that
it would eliminate the 'default' multilib as well. I.e. the library used
when no relevant user options are supplied. Moving this library to a
subfolder has two benefits. a) it still exists! and b) the location of
this library becomes invariant irrespective of which options are
build-time configured as default.

3) Preserve/use invariant paths for multilib variants
A simplistic multilib specification leads to a nested set of folders,
where the top level is the left-most multilib directory and the bottom is
the right most. Introducing a new axis of multilib configuration changes
this path structure leading to the different library configurations to 
move around. This is not in itself a problem, as the compiler driver can
always locate the right path for any given build, but it does cause issues
when doing configuration management of binary toolchains. When there are
many different multilibs it is ideal to ship/install only the ones that
are important and if the paths keep changing over time this process is
complex and confusing. This issue is effectively solved by the
MULTI_OSDIRNAMES feature but using it for both sysroot and compiler
internal libraries is even better.

4) Support un-released multilib configurations
This one sounds weird but it is quite valuable. When an architecture has
70+ possible multilib variants but only 40 of them are currently known to
be needed then only build and release 40 variants. However, if it turns
out that another configuration becomes useful then it is often handy to
just build the missing configuration and install it into the pre-existing
release. So, the driver needs to know about all multilibs and their paths
but the build process should only build a subset.

So, the solution...

Firstly, be verbose about the MULTILIB_OPTIONS needed for a target. Add
in the default options as well as all the others that may, or could, ever
be supported by the current compiler features. For MIPS supporting
MIPS32r1 onwards it looks like this:

MULTILIB_OPTIONS = muclibc mips32/mips32r2/mips32r6/mips64/mips64r2/mips64r6
mips16/mmicromips mabi=32/mabi=n32/mabi=64 EB/EL msoft-float mnan=2008

This does create an enormous matrix of possible configurations so this
has to be trimmed to the valid set using MULTILIB_REQUIRED. Note that
the valid set should include any that you may wish to support even if
you don't want to build/release them. By having the default options in
then this leads to having two copies of the 'default' multilib; one with
the options implicitly set and one with them explicitly set.

Second, remove the multilib with the implicit default options. This
equates to the '.' multilib entry. To do this use MULTILIB_EXCLUSIONS to
remove the negated form of every MULTILIB_OPTION:

MULTILIB_EXCLUSIONS =
!muclibc/!mips32/!mips32r2/!mips32r6/!mips64/!mips64r2/!mips64r6/!mips16/!mm
icromips/!mabi=32/!mabi=n32/!mabi=64/!EB/!EL/!msoft-float/!mnan=2008

Third, set the MULTILIB_OSDIRNAMES to have an entry for every valid
combination of options and use the '!' modifier. Honestly, I'm not sure
how/why this works but this leads to both the internal library paths and
sysroot paths using the OSDIRNAME instead of the nested tree of
MULTILIB_DIRNAMES. Choose a path for each variant that you will never
change again; I used an encoded form of the configuration for MIPS:

MULTILIB_OSDIRNAMES =
mips32r6/mabi.32/EB/mnan.2008=!mips-r6-hard$(is_newlib)/lib

Fourth, deal with the fallout from the config-ml.in logic which handles
the initial 'configure' of a library differently to all of the multilib
configurations. The basic idea is that since the default multilib will now
report that it belongs in a subdirectory then, when configuring the top
level multilib, query the driver for the folder. Later when iterating
through the multilib specs skip the one that matches the default
configuration. Each configuration will be built exactly once and all of
them will be placed in a subfolder leaving the top level install folder
bare.

Fifth, restrict the set of multilibs that actually get built for any
given compiler. This is sort-of a new concept so I added a
--with-multi-buildlist configure option that points to a file that lists
all the OSDIRNAME paths that you DO want to build. The config-ml.in file
queries this list to trim the multilib list. There are existing features
to trim portions of a multilib list but they are designed to remove a whole
axis of the configuration and I needed much finer control.

Sixth, update the fixinc logic so that it too will use the multi-buildlist
restrictions when installing headers.

Finally, add default multi-buildlist files that automatically get chosen
for certain triples.

I'm aware of a few formatting quirks and other issues in this patch but
I wanted to share the patch both to get feedback and see if anyone else
finds it useful to finish it off and help do the required level of testing.

Comments/feedback welcome.

/
	* config-ml.in: Add support for --with-multi-buildlist.  Retarget
	the default multilib to a subfolder on install.
	* configure.ac: Add support for --with-multi-buildlist.
	* configure: Regenerate.

gcc/
	* Makefile.in (s-fixinc_list): Add support for
--with-multi-buildlist.
	* config.gcc: Update mips* multilib configuration.
	* config/mips/ml-img-elf: New file.
	* config/mips/ml-img-linux: Likewise.
	* config/mips/ml-mti-elf: Likewise.
	* config/mips/ml-mti-linux: Likewise. 
	* config/mips/mti-elf.h (MULTILIB_DEFAULTS): Undefine. 
	* config/mips/mti-linux.h (MULTILIB_DEFAULTS): Undefine.
	* config/mips/t-img-elf: Delete. 
	* config/mips/t-img-linux: Delete. 
	* config/mips/t-mips-multi: New file.
	* config/mips/t-mti-elf: Delete.
	* config/mips/t-mti-linux: Delete.
	* configure.ac (with_multi_buildlist): New AC_SUBST.

Thanks,
Matthew

---
 config-ml.in                 |  25 ++++-
 configure                    |  23 +++++
 configure.ac                 |  23 +++++
 gcc/Makefile.in              |  20 ++++
 gcc/config.gcc               |  10 +-
 gcc/config/mips/ml-img-elf   |  12 +++
 gcc/config/mips/ml-img-linux |   8 ++
 gcc/config/mips/ml-mti-elf   |  17 ++++
 gcc/config/mips/ml-mti-linux |  16 ++++
 gcc/config/mips/mti-elf.h    |   2 +
 gcc/config/mips/mti-linux.h  |   2 +
 gcc/config/mips/t-img-elf    |  33 -------
 gcc/config/mips/t-img-linux  |  38 --------
 gcc/config/mips/t-mips-multi | 214
+++++++++++++++++++++++++++++++++++++++++++
 gcc/config/mips/t-mti-elf    |  48 ----------
 gcc/config/mips/t-mti-linux  | 158 --------------------------------
 gcc/configure                |   8 +-
 gcc/configure.ac             |   3 +
 18 files changed, 376 insertions(+), 284 deletions(-)
 create mode 100644 gcc/config/mips/ml-img-elf
 create mode 100644 gcc/config/mips/ml-img-linux
 create mode 100644 gcc/config/mips/ml-mti-elf
 create mode 100644 gcc/config/mips/ml-mti-linux
 delete mode 100644 gcc/config/mips/t-img-elf
 delete mode 100644 gcc/config/mips/t-img-linux
 create mode 100644 gcc/config/mips/t-mips-multi
 delete mode 100644 gcc/config/mips/t-mti-elf
 delete mode 100644 gcc/config/mips/t-mti-linux

Comments

Eric Gallager June 13, 2018, 3:26 p.m. UTC | #1
On 6/13/18, Matthew Fortune <mfortune@gmail.com> wrote:
> Hi,
>
> This patch was developed as part of preparing ever more complex multilib
> combinations for the MIPS architecture and aims to solve several problems
> in this area. I've attempted to be quite verbose in the description, so
> that I can explain how I am using various terms as pretty much everyone
> has a different understanding (and I don't claim mine to be 'right'
> either).
>
> The changes aim to:
>
> 1) Eliminate the fallback multilib
> The fallback multilib (top level of 'lib') is often annoying because it is
> used for any combination of options that do not match a specific multilib.
> Quite often this default multilib is incompatible with the build options
> that end up linking against it, leading to bizarre link time messages that
> confuse ordinary users.
>
> 2) Move the default multilib to a subfolder
> Having successfully eliminated the fallback multilib it is also true that
> it would eliminate the 'default' multilib as well. I.e. the library used
> when no relevant user options are supplied. Moving this library to a
> subfolder has two benefits. a) it still exists! and b) the location of
> this library becomes invariant irrespective of which options are
> build-time configured as default.
>
> 3) Preserve/use invariant paths for multilib variants
> A simplistic multilib specification leads to a nested set of folders,
> where the top level is the left-most multilib directory and the bottom is
> the right most. Introducing a new axis of multilib configuration changes
> this path structure leading to the different library configurations to
> move around. This is not in itself a problem, as the compiler driver can
> always locate the right path for any given build, but it does cause issues
> when doing configuration management of binary toolchains. When there are
> many different multilibs it is ideal to ship/install only the ones that
> are important and if the paths keep changing over time this process is
> complex and confusing. This issue is effectively solved by the
> MULTI_OSDIRNAMES feature but using it for both sysroot and compiler
> internal libraries is even better.
>
> 4) Support un-released multilib configurations
> This one sounds weird but it is quite valuable. When an architecture has
> 70+ possible multilib variants but only 40 of them are currently known to
> be needed then only build and release 40 variants. However, if it turns
> out that another configuration becomes useful then it is often handy to
> just build the missing configuration and install it into the pre-existing
> release. So, the driver needs to know about all multilibs and their paths
> but the build process should only build a subset.
>
> So, the solution...
>
> Firstly, be verbose about the MULTILIB_OPTIONS needed for a target. Add
> in the default options as well as all the others that may, or could, ever
> be supported by the current compiler features. For MIPS supporting
> MIPS32r1 onwards it looks like this:
>
> MULTILIB_OPTIONS = muclibc
> mips32/mips32r2/mips32r6/mips64/mips64r2/mips64r6
> mips16/mmicromips mabi=32/mabi=n32/mabi=64 EB/EL msoft-float mnan=2008
>
> This does create an enormous matrix of possible configurations so this
> has to be trimmed to the valid set using MULTILIB_REQUIRED. Note that
> the valid set should include any that you may wish to support even if
> you don't want to build/release them. By having the default options in
> then this leads to having two copies of the 'default' multilib; one with
> the options implicitly set and one with them explicitly set.
>
> Second, remove the multilib with the implicit default options. This
> equates to the '.' multilib entry. To do this use MULTILIB_EXCLUSIONS to
> remove the negated form of every MULTILIB_OPTION:
>
> MULTILIB_EXCLUSIONS =
> !muclibc/!mips32/!mips32r2/!mips32r6/!mips64/!mips64r2/!mips64r6/!mips16/!mm
> icromips/!mabi=32/!mabi=n32/!mabi=64/!EB/!EL/!msoft-float/!mnan=2008
>
> Third, set the MULTILIB_OSDIRNAMES to have an entry for every valid
> combination of options and use the '!' modifier. Honestly, I'm not sure
> how/why this works but this leads to both the internal library paths and
> sysroot paths using the OSDIRNAME instead of the nested tree of
> MULTILIB_DIRNAMES. Choose a path for each variant that you will never
> change again; I used an encoded form of the configuration for MIPS:
>
> MULTILIB_OSDIRNAMES =
> mips32r6/mabi.32/EB/mnan.2008=!mips-r6-hard$(is_newlib)/lib
>
> Fourth, deal with the fallout from the config-ml.in logic which handles
> the initial 'configure' of a library differently to all of the multilib
> configurations. The basic idea is that since the default multilib will now
> report that it belongs in a subdirectory then, when configuring the top
> level multilib, query the driver for the folder. Later when iterating
> through the multilib specs skip the one that matches the default
> configuration. Each configuration will be built exactly once and all of
> them will be placed in a subfolder leaving the top level install folder
> bare.
>
> Fifth, restrict the set of multilibs that actually get built for any
> given compiler. This is sort-of a new concept so I added a
> --with-multi-buildlist configure option that points to a file that lists
> all the OSDIRNAME paths that you DO want to build. The config-ml.in file
> queries this list to trim the multilib list. There are existing features
> to trim portions of a multilib list but they are designed to remove a whole
> axis of the configuration and I needed much finer control.
>
> Sixth, update the fixinc logic so that it too will use the multi-buildlist
> restrictions when installing headers.
>
> Finally, add default multi-buildlist files that automatically get chosen
> for certain triples.
>
> I'm aware of a few formatting quirks and other issues in this patch but
> I wanted to share the patch both to get feedback and see if anyone else
> finds it useful to finish it off and help do the required level of testing.
>
> Comments/feedback welcome.
>
> /
> 	* config-ml.in: Add support for --with-multi-buildlist.  Retarget
> 	the default multilib to a subfolder on install.
> 	* configure.ac: Add support for --with-multi-buildlist.
> 	* configure: Regenerate.
>
> gcc/
> 	* Makefile.in (s-fixinc_list): Add support for
> --with-multi-buildlist.
> 	* config.gcc: Update mips* multilib configuration.
> 	* config/mips/ml-img-elf: New file.
> 	* config/mips/ml-img-linux: Likewise.
> 	* config/mips/ml-mti-elf: Likewise.
> 	* config/mips/ml-mti-linux: Likewise.
> 	* config/mips/mti-elf.h (MULTILIB_DEFAULTS): Undefine.
> 	* config/mips/mti-linux.h (MULTILIB_DEFAULTS): Undefine.
> 	* config/mips/t-img-elf: Delete.
> 	* config/mips/t-img-linux: Delete.
> 	* config/mips/t-mips-multi: New file.
> 	* config/mips/t-mti-elf: Delete.
> 	* config/mips/t-mti-linux: Delete.
> 	* configure.ac (with_multi_buildlist): New AC_SUBST.
>
> Thanks,
> Matthew
>
> ---
>  config-ml.in                 |  25 ++++-
>  configure                    |  23 +++++
>  configure.ac                 |  23 +++++
>  gcc/Makefile.in              |  20 ++++
>  gcc/config.gcc               |  10 +-
>  gcc/config/mips/ml-img-elf   |  12 +++
>  gcc/config/mips/ml-img-linux |   8 ++
>  gcc/config/mips/ml-mti-elf   |  17 ++++
>  gcc/config/mips/ml-mti-linux |  16 ++++
>  gcc/config/mips/mti-elf.h    |   2 +
>  gcc/config/mips/mti-linux.h  |   2 +
>  gcc/config/mips/t-img-elf    |  33 -------
>  gcc/config/mips/t-img-linux  |  38 --------
>  gcc/config/mips/t-mips-multi | 214
> +++++++++++++++++++++++++++++++++++++++++++
>  gcc/config/mips/t-mti-elf    |  48 ----------
>  gcc/config/mips/t-mti-linux  | 158 --------------------------------
>  gcc/configure                |   8 +-
>  gcc/configure.ac             |   3 +
>  18 files changed, 376 insertions(+), 284 deletions(-)
>  create mode 100644 gcc/config/mips/ml-img-elf
>  create mode 100644 gcc/config/mips/ml-img-linux
>  create mode 100644 gcc/config/mips/ml-mti-elf
>  create mode 100644 gcc/config/mips/ml-mti-linux
>  delete mode 100644 gcc/config/mips/t-img-elf
>  delete mode 100644 gcc/config/mips/t-img-linux
>  create mode 100644 gcc/config/mips/t-mips-multi
>  delete mode 100644 gcc/config/mips/t-mti-elf
>  delete mode 100644 gcc/config/mips/t-mti-linux
>
> diff --git a/config-ml.in b/config-ml.in
> index 47f1533..255dd1f 100644
> --- a/config-ml.in
> +++ b/config-ml.in
> @@ -382,6 +382,23 @@ mips*-*-*)
>  	    esac
>  	  done
>  	fi
> +	if [ x$with_multi_buildlist != x ]
> +	then
> +	  old_multidirs="${multidirs}"
> +	  if [ ! -f $with_multi_buildlist ]
> +	  then
> +	    echo "config-ml.in: Failed to find $with_multi_buildlist"
> +	    exit 1
> +	  fi
> +	  multidirs=""
> +	  for x in ${old_multidirs}; do
> +	    found=`grep "^${x}$" $with_multi_buildlist`
> +	    if [ -n "$found" ]
> +	    then
> +	      multidirs="${multidirs} ${x}"
> +	    fi
> +	  done
> +	fi
>  	;;
>  powerpc*-*-* | rs6000*-*-*)
>  	if [ x$enable_aix64 = xno ]
> @@ -582,7 +599,8 @@ else
>  fi
>
>  if [ -z "${with_multisubdir}" ]; then
> -  ml_subdir=
> +  ml_top_subdir=`${CC-gcc} --print-multi-directory 2>/dev/null`
> +  ml_subdir=/$ml_top_subdir
>    ml_builddotdot=
>    : # ml_srcdotdot= # already set
>  else
> @@ -661,6 +679,11 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}"
> ];
> then
>
>    for ml_dir in ${multidirs}; do
>
> +    if [ "${ml_dir}" == "${ml_top_subdir}" ]; then
> +      echo "Skipping configure in multilib subdir ${ml_dir}"
> +      continue
> +    fi
> +
>      if [ "${ml_verbose}" = --verbose ]; then
>        echo "Running configure in multilib subdir ${ml_dir}"
>        echo "pwd: `${PWDCMD-pwd}`"
> diff --git a/configure.ac b/configure.ac
> index 28155a0..ee61f75 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3053,6 +3053,29 @@ if test x${enable_multilib} = x ; then
>    target_configargs="--enable-multilib ${target_configargs}"
>  fi
>
> +# Select default multilib build variants
> +if test x${with_multi_buildlist} = x ; then
> +  case "$target" in
> +    mips*-img-linux*)
> multi_buildlist=${srcdir}/gcc/config/mips/ml-img-linux ;;
> +    mips*-mti-linux*)
> multi_buildlist=${srcdir}/gcc/config/mips/ml-mti-linux ;;
> +    mips*-img-elf*) multi_buildlist=${srcdir}/gcc/config/mips/ml-img-elf
> ;;
> +    mips*-mti-elf*) multi_buildlist=${srcdir}/gcc/config/mips/ml-mti-elf
> ;;
> +  esac
> +  # Verify the file exists before using it in case the gcc component is
> not
> +  # present in the tree.
> +  if test -f "${multi_buildlist}" ; then
> +    with_multi_buildlist=$multi_buildlist
> +  fi
> +fi
> +
> +# Pass through with_multi_buildlist to host and target.  'gcc' needs it
> for
> the
> +# fixed includes which are multilib'd and target libraries need it as they
> use
> +# config-ml.in.
> +if test x${with_multi_buildlist} != x ; then
> +  target_configargs="--with-multi-buildlist=${with_multi_buildlist}
> ${target_configargs}"
> +  host_configargs="--with-multi-buildlist=${with_multi_buildlist}
> ${host_configargs}"
> +fi
> +
>  # Pass --with-newlib if appropriate.  Note that target_configdirs has
>  # changed from the earlier setting of with_newlib.
>  if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep "
> newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index d8f3e88..8c0aedf 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -587,6 +587,9 @@ else
>    endif
>  endif
>
> +# Multilib control
> +with_multi_buildlist = @with_multi_buildlist@
> +
>  # ------------------------
>  # Installation directories
>  # ------------------------
> @@ -3022,10 +3025,27 @@ fixinc_list: s-fixinc_list; @true
>  s-fixinc_list : $(GCC_PASSES)
>  # Build up a list of multilib directories and corresponding sysroot
>  # suffixes, in form sysroot;multilib.
> +# Use a filtered multilib list if requested.
>  	if $(GCC_FOR_TARGET) -print-sysroot-headers-suffix > /dev/null 2>&1;
> then \
>  	  set -e; for ml in `$(GCC_FOR_TARGET) -print-multi-lib`; do \
>  	    multi_dir=`echo $${ml} | sed -e 's/;.*$$//'`; \
>  	    flags=`echo $${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
> +	    case "$(target)" in \
> +	    mips*-*-*) \
> +	      if [ x$(with_multi_buildlist) != x ]; then \
> +		if [ ! -f $(with_multi_buildlist) ]; then \
> +		  echo "fixinc_list: Failed to find
> $(with_multi_buildlist)"; \
> +		  exit 1; \
> +		fi; \
> +		set +e; \
> +		found=`grep "^$${multi_dir}$$" $(with_multi_buildlist)`; \
> +		set -e; \
> +		if [ -z "$$found" ]; then \
> +		  continue; \
> +		fi; \
> +	      fi; \
> +	      ;; \
> +	    esac; \
>  	    sfx=`$(GCC_FOR_TARGET) $${flags} -print-sysroot-headers-suffix`;
> \
>  	    if [ "$${multi_dir}" = "." ]; \
>  	      then multi_dir=""; \
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 8b2fd90..41bfd95 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -2119,7 +2119,7 @@ mips*-*-netbsd*)			# NetBSD/mips,
> either endian.
>  mips*-img-linux*)
>  	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h
> glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h
> mips/mti-linux.h"
>  	extra_options="${extra_options} linux-android.opt"
> -	tmake_file="${tmake_file} mips/t-img-linux"
> +	tmake_file="${tmake_file} mips/t-mips-multi"
>  	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=37
> MIPS_ABI_DEFAULT=ABI_32"
>  	with_arch_32="mips32r6"
>  	with_arch_64="mips64r6"
> @@ -2129,7 +2129,7 @@ mips*-img-linux*)
>  mips*-mti-linux*)
>  	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h
> glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h
> mips/mti-linux.h"
>  	extra_options="${extra_options} linux-android.opt"
> -	tmake_file="${tmake_file} mips/t-mti-linux"
> +	tmake_file="${tmake_file} mips/t-mips-multi"
>  	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33
> MIPS_ABI_DEFAULT=ABI_32"
>  	with_arch_32="mips32r2"
>  	with_arch_64="mips64r2"
> @@ -2185,17 +2185,19 @@ mips*-*-linux*)				# Linux
> MIPS, either endian.
>  	;;
>  mips*-mti-elf*)
>  	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h
> mips/n32-elf.h mips/sde.h mips/mti-elf.h"
> -	tmake_file="mips/t-mti-elf"
> +	tmake_file="mips/t-mips-multi"
>  	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33
> MIPS_ABI_DEFAULT=ABI_32"
>  	with_arch_32="mips32r2"
>  	with_arch_64="mips64r2"
> +	TM_MULTILIB_EXCEPTIONS_CONFIG="*muclibc*"
>  	;;
>  mips*-img-elf*)
>  	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h
> mips/n32-elf.h mips/sde.h mips/mti-elf.h"
> -	tmake_file="mips/t-img-elf"
> +	tmake_file="mips/t-mips-multi"
>  	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=37
> MIPS_ABI_DEFAULT=ABI_32"
>  	with_arch_32="mips32r6"
>  	with_arch_64="mips64r6"
> +	TM_MULTILIB_EXCEPTIONS_CONFIG="*muclibc*"
>  	;;
>  mips*-sde-elf*)
>  	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h
> mips/n32-elf.h mips/sde.h"
> diff --git a/gcc/config/mips/ml-img-elf b/gcc/config/mips/ml-img-elf
> new file mode 100644
> index 0000000..91204f82
> --- /dev/null
> +++ b/gcc/config/mips/ml-img-elf
> @@ -0,0 +1,12 @@
> +mips-r6-hard-newlib/lib
> +mips-r6-hard-newlib/lib32
> +mips-r6-hard-newlib/lib64
> +mips-r6-soft-newlib/lib
> +mips-r6-soft-newlib/lib32
> +mips-r6-soft-newlib/lib64
> +mipsel-r6-hard-newlib/lib
> +mipsel-r6-hard-newlib/lib32
> +mipsel-r6-hard-newlib/lib64
> +mipsel-r6-soft-newlib/lib
> +mipsel-r6-soft-newlib/lib32
> +mipsel-r6-soft-newlib/lib64
> diff --git a/gcc/config/mips/ml-img-linux b/gcc/config/mips/ml-img-linux
> new file mode 100644
> index 0000000..fa55ded
> --- /dev/null
> +++ b/gcc/config/mips/ml-img-linux
> @@ -0,0 +1,8 @@
> +mips-r6-hard/lib
> +mips-r6-soft/lib
> +mips-r6-hard/lib32
> +mips-r6-hard/lib64
> +mipsel-r6-hard/lib
> +mipsel-r6-soft/lib
> +mipsel-r6-hard/lib32
> +mipsel-r6-hard/lib64
> diff --git a/gcc/config/mips/ml-mti-elf b/gcc/config/mips/ml-mti-elf
> new file mode 100644
> index 0000000..7ac2deb
> --- /dev/null
> +++ b/gcc/config/mips/ml-mti-elf
> @@ -0,0 +1,17 @@
> +mips-r2-hard-newlib/lib
> +mips-r2-hard-newlib/lib32
> +mips-r2-hard-newlib/lib64
> +mips-r2-hard-nan2008-newlib/lib
> +mips-r2-soft-newlib/lib
> +mips-r2-soft-newlib/lib32
> +mips-r2-soft-newlib/lib64
> +mipsel-r2-hard-newlib/lib
> +mipsel-r2-hard-newlib/lib32
> +mipsel-r2-hard-newlib/lib64
> +mipsel-r2-soft-newlib/lib
> +mipsel-r2-soft-newlib/lib32
> +mipsel-r2-soft-newlib/lib64
> +mipsel-r2-mips16-soft-newlib/lib
> +mipsel-r2-hard-nan2008-newlib/lib
> +micromipsel-r2-hard-nan2008-newlib/lib
> +micromipsel-r2-soft-newlib/lib
> diff --git a/gcc/config/mips/ml-mti-linux b/gcc/config/mips/ml-mti-linux
> new file mode 100644
> index 0000000..1056700
> --- /dev/null
> +++ b/gcc/config/mips/ml-mti-linux
> @@ -0,0 +1,16 @@
> +mips-r2-hard/lib
> +mips-r2-soft/lib
> +mips-r2-hard/lib32
> +mips-r2-hard/lib64
> +mips-r2-hard-nan2008/lib
> +mipsel-r2-hard/lib
> +mipsel-r2-soft/lib
> +mipsel-r2-hard/lib32
> +mipsel-r2-hard/lib64
> +mipsel-r2-hard-nan2008/lib
> +micromipsel-r2-hard-nan2008/lib
> +micromipsel-r2-soft/lib
> +mips-r2-hard-uclibc/lib
> +mips-r2-hard-nan2008-uclibc/lib
> +mipsel-r2-hard-uclibc/lib
> +mipsel-r2-hard-nan2008-uclibc/lib
> diff --git a/gcc/config/mips/mti-elf.h b/gcc/config/mips/mti-elf.h
> index d4a11b1..206efdc 100644
> --- a/gcc/config/mips/mti-elf.h
> +++ b/gcc/config/mips/mti-elf.h
> @@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public
> License
>  along with GCC; see the file COPYING3.  If not see
>  <http://www.gnu.org/licenses/>.  */
>
> +#undef MULTILIB_DEFAULTS
> +
>  #undef DRIVER_SELF_SPECS
>  #define DRIVER_SELF_SPECS						\
>    /* Set the ISA for the default multilib.  */				\
> diff --git a/gcc/config/mips/mti-linux.h b/gcc/config/mips/mti-linux.h
> index 9792972..4fcd0c9 100644
> --- a/gcc/config/mips/mti-linux.h
> +++ b/gcc/config/mips/mti-linux.h
> @@ -23,6 +23,8 @@ along with GCC; see the file COPYING3.  If not see
>     mips64r3, and mips64r5 will all default to 'r2'.  See MULTILIB_MATCHES
>     definition in t-mti-linux.  */
>
> +#undef MULTILIB_DEFAULTS
> +
>  #define MIPS_SYSVERSION_SPEC \
>      "%{mips32|mips64:r1;mips32r6|mips64r6:r6;:r2}%{mips16:-mips16}"
>
> diff --git a/gcc/config/mips/t-img-elf b/gcc/config/mips/t-img-elf
> deleted file mode 100644
> index 09159cd..0000000
> --- a/gcc/config/mips/t-img-elf
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -# Copyright (C) 2014-2018 Free Software Foundation, Inc.
> -#
> -# This file is part of GCC.
> -#
> -# GCC is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License as published by
> -# the Free Software Foundation; either version 3, or (at your option)
> -# any later version.
> -#
> -# GCC is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with GCC; see the file COPYING3.  If not see
> -# <http://www.gnu.org/licenses/>.
> -
> -# The default build is mips32r6, hard-float big-endian.
> -# A multilib for mips32r6+LE
> -# A multilib for mips64r6
> -# A multilib for mips64r6+LE
> -
> -MULTILIB_OPTIONS = mips64r6 mabi=64 EL msoft-float/msingle-float
> -MULTILIB_DIRNAMES = mips64r6 64 el sof sgl
> -MULTILIB_MATCHES = EL=mel EB=meb
> -
> -# Don't build 64r6 with single-float
> -MULTILIB_EXCEPTIONS += mips64r6/*msingle-float*
> -
> -MULTILIB_EXCEPTIONS += mabi=64*
> -MULTILIB_EXCEPTIONS += msingle-float*
> -MULTILIB_EXCEPTIONS += *msingle-float
> diff --git a/gcc/config/mips/t-img-linux b/gcc/config/mips/t-img-linux
> deleted file mode 100644
> index ba2b2b8..0000000
> --- a/gcc/config/mips/t-img-linux
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -# Copyright (C) 2014-2018 Free Software Foundation, Inc.
> -#
> -# This file is part of GCC.
> -#
> -# GCC is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License as published by
> -# the Free Software Foundation; either version 3, or (at your option)
> -# any later version.
> -#
> -# GCC is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with GCC; see the file COPYING3.  If not see
> -# <http://www.gnu.org/licenses/>.
> -
> -# The default build is mips32r6, hard-float big-endian.  Add mips64r6,
> -# 64-bit ABI and little-endian variations.
> -
> -MULTILIB_OPTIONS = mips64r6 mabi=64 EL
> -MULTILIB_DIRNAMES = mips64r6 64 el
> -MULTILIB_MATCHES = EL=mel EB=meb
> -
> -MULTILIB_REQUIRED =
> -MULTILIB_OSDIRNAMES = .=mips-r6-hard/lib
> -MULTILIB_REQUIRED += mips64r6
> -MULTILIB_OSDIRNAMES += mips64r6=!mips-r6-hard/lib32
> -MULTILIB_REQUIRED += mips64r6/mabi=64
> -MULTILIB_OSDIRNAMES += mips64r6/mabi.64=!mips-r6-hard/lib64
> -
> -MULTILIB_REQUIRED += EL
> -MULTILIB_OSDIRNAMES += EL=!mipsel-r6-hard/lib
> -MULTILIB_REQUIRED += mips64r6/EL
> -MULTILIB_OSDIRNAMES += mips64r6/EL=!mipsel-r6-hard/lib32
> -MULTILIB_REQUIRED += mips64r6/mabi=64/EL
> -MULTILIB_OSDIRNAMES += mips64r6/mabi.64/EL=!mipsel-r6-hard/lib64
> diff --git a/gcc/config/mips/t-mips-multi b/gcc/config/mips/t-mips-multi
> new file mode 100644
> index 0000000..d1f834d
> --- /dev/null
> +++ b/gcc/config/mips/t-mips-multi
> @@ -0,0 +1,214 @@
> +# Copyright (C) 2015 Free Software Foundation, Inc.
> +#
> +# This file is part of GCC.
> +#
> +# GCC is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3, or (at your option)
> +# any later version.
> +#
> +# GCC is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with GCC; see the file COPYING3.  If not see
> +# <http://www.gnu.org/licenses/>.
> +
> +# There is no default build in this multilib setup. This unfortunately
> +# does not prevent config-ml.in from building a default but this can
> +# be removed via post install scripts.
> +#
> +# All possible MIPS multilibs are shown in this file. They are limited
> +# via a file that lists required multilibs for each vendor/OS
> +# combination which can be overridden at build time as well.
> +#
> +# The benefit to describing all multilibs is that the compiler driver
> +# can use any multilib if it is present and therefore additional
> +# library variants can be added to an installation after initial
> +# build. This could be achieved by building all libraries and removing
> +# the ones we don't want to ship but this would massively increase
> +# build times in situations where only a few are required immediately.
> +
> +MULTILIB_OPTIONS = muclibc
> mips32/mips32r2/mips32r6/mips64/mips64r2/mips64r6 mips16/mmicromips
> mabi=32/mabi=n32/mabi=64 EB/EL msoft-float mnan=2008
> +MULTILIB_DIRNAMES = uclibc mips32 mips32r2 mips32r6 mips64 mips64r2
> mips64r6 mips16 micromips 32 n32 64 eb el sof nan2008
> +MULTILIB_MATCHES = EL=mel EB=meb mips32r2=mips32r3 mips32r2=mips32r5
> mips64r2=mips64r3 mips64r2=mips64r5
> +
> +# Allow the exceptions list to be controlled by configure time options
> +MULTILIB_EXCEPTIONS = $(TM_MULTILIB_EXCEPTIONS_CONFIG)
> +
> +# Determine if this is a bare metal target with a newlib default library
> +is_newlib = $(if $(filter elf, $(lastword $(subst -,
> ,$(target)))),-newlib)
> +
> +MULTILIB_EXCLUSIONS =
> !muclibc/!mips32/!mips32r2/!mips32r6/!mips64/!mips64r2/!mips64r6/!mips16/!mm
> icromips/!mabi=32/!mabi=n32/!mabi=64/!EB/!EL/!msoft-float/!mnan=2008
> +
> +# MIPS32R6/MIPS64R6
> +MULTILIB_REQUIRED   = mips32r6/mabi=32/EB/mnan=2008
> +MULTILIB_OSDIRNAMES =
> mips32r6/mabi.32/EB/mnan.2008=!mips-r6-hard$(is_newlib)/lib
> +MULTILIB_REUSE      =
> mips32r6/mabi.32/EB/mnan.2008=mips64r6/mabi.32/EB/mnan.2008
> +MULTILIB_REQUIRED   += mips64r6/mabi=n32/EB/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r6/mabi.n32/EB/mnan.2008=!mips-r6-hard$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r6/mabi=64/EB/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r6/mabi.64/EB/mnan.2008=!mips-r6-hard$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32r6/mabi=32/EB/msoft-float/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips32r6/mabi.32/EB/msoft-float/mnan.2008=!mips-r6-soft$(is_newlib)/lib
> +MULTILIB_REUSE      +=
> mips32r6/mabi.32/EB/msoft-float/mnan.2008=mips64r6/mabi.32/EB/msoft-float/mn
> an.2008
> +MULTILIB_REQUIRED   += mips64r6/mabi=n32/EB/msoft-float/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r6/mabi.n32/EB/msoft-float/mnan.2008=!mips-r6-soft$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r6/mabi=64/EB/msoft-float/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r6/mabi.64/EB/msoft-float/mnan.2008=!mips-r6-soft$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32r6/mabi=32/EL/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips32r6/mabi.32/EL/mnan.2008=!mipsel-r6-hard$(is_newlib)/lib
> +MULTILIB_REUSE      +=
> mips32r6/mabi.32/EL/mnan.2008=mips64r6/mabi.32/EL/mnan.2008
> +MULTILIB_REQUIRED   += mips64r6/mabi=n32/EL/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r6/mabi.n32/EL/mnan.2008=!mipsel-r6-hard$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r6/mabi=64/EL/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r6/mabi.64/EL/mnan.2008=!mipsel-r6-hard$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32r6/mabi=32/EL/msoft-float/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips32r6/mabi.32/EL/msoft-float/mnan.2008=!mipsel-r6-soft$(is_newlib)/lib
> +MULTILIB_REUSE      +=
> mips32r6/mabi.32/EL/msoft-float/mnan.2008=mips64r6/mabi.32/EL/msoft-float/mn
> an.2008
> +MULTILIB_REQUIRED   += mips64r6/mabi=n32/EL/msoft-float/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r6/mabi.n32/EL/msoft-float/mnan.2008=!mipsel-r6-soft$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r6/mabi=64/EL/msoft-float/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r6/mabi.64/EL/msoft-float/mnan.2008=!mipsel-r6-soft$(is_newlib)/lib64
> +
> +# MIPS32R2/MIPS64R2
> +MULTILIB_REQUIRED   += mips32r2/mabi=32/EB
> +MULTILIB_OSDIRNAMES += mips32r2/mabi.32/EB=!mips-r2-hard$(is_newlib)/lib
> +MULTILIB_REUSE      += mips32r2/mabi.32/EB=mips64r2/mabi.32/EB
> +MULTILIB_REQUIRED   += mips64r2/mabi=n32/EB
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.n32/EB=!mips-r2-hard$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r2/mabi=64/EB
> +MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EB=!mips-r2-hard$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32r2/mabi=32/EB/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mabi.32/EB/mnan.2008=!mips-r2-hard-nan2008$(is_newlib)/lib
> +MULTILIB_REUSE      +=
> mips32r2/mabi.32/EB/mnan.2008=mips64r2/mabi.32/EB/mnan.2008
> +MULTILIB_REQUIRED   += mips64r2/mabi=n32/EB/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.n32/EB/mnan.2008=!mips-r2-hard-nan2008$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r2/mabi=64/EB/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/EB/mnan.2008=!mips-r2-hard-nan2008$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32r2/mabi=32/EB/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mabi.32/EB/msoft-float=!mips-r2-soft$(is_newlib)/lib
> +MULTILIB_REUSE      +=
> mips32r2/mabi.32/EB/msoft-float=mips64r2/mabi.32/EB/msoft-float
> +MULTILIB_REQUIRED   += mips64r2/mabi=n32/EB/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.n32/EB/msoft-float=!mips-r2-soft$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r2/mabi=64/EB/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/EB/msoft-float=!mips-r2-soft$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32r2/mabi=32/EL
> +MULTILIB_OSDIRNAMES += mips32r2/mabi.32/EL=!mipsel-r2-hard$(is_newlib)/lib
> +MULTILIB_REUSE      += mips32r2/mabi.32/EL=mips64r2/mabi.32/EL
> +MULTILIB_REQUIRED   += mips64r2/mabi=n32/EL
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.n32/EL=!mipsel-r2-hard$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r2/mabi=64/EL
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/EL=!mipsel-r2-hard$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32r2/mabi=32/EL/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mabi.32/EL/mnan.2008=!mipsel-r2-hard-nan2008$(is_newlib)/lib
> +MULTILIB_REUSE      +=
> mips32r2/mabi.32/EL/mnan.2008=mips64r2/mabi.32/EL/mnan.2008
> +MULTILIB_REQUIRED   += mips64r2/mabi=n32/EL/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.n32/EL/mnan.2008=!mipsel-r2-hard-nan2008$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/EL/mnan.2008=!mipsel-r2-hard-nan2008$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32r2/mabi=32/EL/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mabi.32/EL/msoft-float=!mipsel-r2-soft$(is_newlib)/lib
> +MULTILIB_REUSE      +=
> mips32r2/mabi.32/EL/msoft-float=mips64r2/mabi.32/EL/msoft-float
> +MULTILIB_REQUIRED   += mips64r2/mabi=n32/EL/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.n32/EL/msoft-float=!mipsel-r2-soft$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/EL/msoft-float=!mipsel-r2-soft$(is_newlib)/lib64
> +
> +# MIPS16 - We will not include any 64 bit mips16 combinations.
> +MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EB
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mips16/mabi.32/EB=!mips-r2-mips16-hard$(is_newlib)/lib
> +MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EB/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mips16/mabi.32/EB/mnan.2008=!mips-r2-mips16-hard-nan2008$(is_newlib
> )/lib
> +MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EB/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mips16/mabi.32/EB/msoft-float=!mips-r2-mips16-soft$(is_newlib)/lib
> +
> +MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EL
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mips16/mabi.32/EL=!mipsel-r2-mips16-hard$(is_newlib)/lib
> +MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EL/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mips16/mabi.32/EL/mnan.2008=!mipsel-r2-mips16-hard-nan2008$(is_newl
> ib)/lib
> +MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EL/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mips16/mabi.32/EL/msoft-float=!mipsel-r2-mips16-soft$(is_newlib)/li
> b
> +
> +# microMIPS32R3 - We will not include any 64 bit microMIPS combinations
> +MULTILIB_REQUIRED   += mips32r2/mmicromips/mabi=32/EB/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mmicromips/mabi.32/EB/mnan.2008=!micromips-r2-hard-nan2008$(is_newl
> ib)/lib
> +MULTILIB_REQUIRED   += mips32r2/mmicromips/mabi=32/EB/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mmicromips/mabi.32/EB/msoft-float=!micromips-r2-soft$(is_newlib)/li
> b
> +
> +MULTILIB_REQUIRED   += mips32r2/mmicromips/mabi=32/EL/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mmicromips/mabi.32/EL/mnan.2008=!micromipsel-r2-hard-nan2008$(is_ne
> wlib)/lib
> +MULTILIB_REQUIRED   += mips32r2/mmicromips/mabi=32/EL/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32r2/mmicromips/mabi.32/EL/msoft-float=!micromipsel-r2-soft$(is_newlib)/
> lib
> +
> +# Version 1 multilibs
> +
> +MULTILIB_REQUIRED   += mips32/mabi=32/EB
> +MULTILIB_OSDIRNAMES += mips32/mabi.32/EB=!mips-r1-hard$(is_newlib)/lib
> +MULTILIB_REUSE      += mips32/mabi.32/EB=mips64/mabi.32/EB
> +MULTILIB_REQUIRED   += mips64/mabi=n32/EB
> +MULTILIB_OSDIRNAMES += mips64/mabi.n32/EB=!mips-r1-hard$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64/mabi=64/EB
> +MULTILIB_OSDIRNAMES += mips64/mabi.64/EB=!mips-r1-hard$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32/mabi=32/EB/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32/mabi.32/EB/msoft-float=!mips-r1-soft$(is_newlib)/lib
> +MULTILIB_REUSE      +=
> mips32/mabi.32/EB/msoft-float=mips64/mabi.32/EB/msoft-float
> +MULTILIB_REQUIRED   += mips64/mabi=n32/EB/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips64/mabi.n32/EB/msoft-float=!mips-r1-soft$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64/mabi=64/EB/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips64/mabi.64/EB/msoft-float=!mips-r1-soft$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32/mabi=32/EL
> +MULTILIB_OSDIRNAMES += mips32/mabi.32/EL=!mipsel-r1-hard$(is_newlib)/lib
> +MULTILIB_REUSE      += mips32/mabi.32/EL=mips64/mabi.32/EL
> +MULTILIB_REQUIRED   += mips64/mabi=n32/EL
> +MULTILIB_OSDIRNAMES +=
> mips64/mabi.n32/EL=!mipsel-r1-hard$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64/mabi=64/EL
> +MULTILIB_OSDIRNAMES += mips64/mabi.64/EL=!mipsel-r1-hard$(is_newlib)/lib64
> +
> +MULTILIB_REQUIRED   += mips32/mabi=32/EL/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32/mabi.32/EL/msoft-float=!mipsel-r1-soft$(is_newlib)/lib
> +MULTILIB_REUSE      +=
> mips32/mabi.32/EL/msoft-float=mips64/mabi.32/EL/msoft-float
> +MULTILIB_REQUIRED   += mips64/mabi=n32/EL/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips64/mabi.n32/EL/msoft-float=!mipsel-r1-soft$(is_newlib)/lib32
> +MULTILIB_REQUIRED   += mips64/mabi=64/EL/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips64/mabi.64/EL/msoft-float=!mipsel-r1-soft$(is_newlib)/lib64
> +
> +# We will not include any 64 bit mips16 combinations.
> +MULTILIB_REQUIRED   += mips32/mips16/mabi=32/EB
> +MULTILIB_OSDIRNAMES +=
> mips32/mips16/mabi.32/EB=!mips-r1-mips16-hard$(is_newlib)/lib
> +MULTILIB_REQUIRED   += mips32/mips16/mabi=32/EB/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32/mips16/mabi.32/EB/msoft-float=!mips-r1-mips16-soft$(is_newlib)/lib
> +
> +MULTILIB_REQUIRED   += mips32/mips16/mabi=32/EL
> +MULTILIB_OSDIRNAMES +=
> mips32/mips16/mabi.32/EL=!mipsel-r1-mips16-hard$(is_newlib)/lib
> +MULTILIB_REQUIRED   += mips32/mips16/mabi=32/EL/msoft-float
> +MULTILIB_OSDIRNAMES +=
> mips32/mips16/mabi.32/EL/msoft-float=!mipsel-r1-mips16-soft$(is_newlib)/lib
> +
> +# Uclibc variants
> +ifeq ($(filter *muclibc*,$(MULTILIB_EXCEPTIONS)),)
> +MULTILIB_REQUIRED   += muclibc/mips32r2/mabi=32/EB
> +MULTILIB_OSDIRNAMES +=
> muclibc/mips32r2/mabi.32/EB=!mips-r2-hard-uclibc/lib
> +MULTILIB_REUSE      +=
> muclibc/mips32r2/mabi.32/EB=muclibc/mips64r2/mabi.32/EB
> +MULTILIB_REQUIRED   += muclibc/mips32r2/mabi=32/EB/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> muclibc/mips32r2/mabi.32/EB/mnan.2008=!mips-r2-hard-nan2008-uclibc/lib
> +MULTILIB_REUSE      +=
> muclibc/mips32r2/mabi.32/EB/mnan.2008=muclibc/mips64r2/mabi.32/EB/mnan.2008
> +
> +MULTILIB_REQUIRED   += muclibc/mips32r2/mabi=32/EL
> +MULTILIB_OSDIRNAMES +=
> muclibc/mips32r2/mabi.32/EL=!mipsel-r2-hard-uclibc/lib
> +MULTILIB_REUSE      +=
> muclibc/mips32r2/mabi.32/EL=muclibc/mips64r2/mabi.32/EL
> +MULTILIB_REQUIRED   += muclibc/mips32r2/mabi=32/EL/mnan=2008
> +MULTILIB_OSDIRNAMES +=
> muclibc/mips32r2/mabi.32/EL/mnan.2008=!mipsel-r2-hard-nan2008-uclibc/lib
> +MULTILIB_REUSE      +=
> muclibc/mips32r2/mabi.32/EL/mnan.2008=muclibc/mips64r2/mabi.32/EL/mnan.2008
> +endif
> diff --git a/gcc/config/mips/t-mti-elf b/gcc/config/mips/t-mti-elf
> deleted file mode 100644
> index 66717de..0000000
> --- a/gcc/config/mips/t-mti-elf
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -# Copyright (C) 2012-2018 Free Software Foundation, Inc.
> -#
> -# This file is part of GCC.
> -#
> -# GCC is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License as published by
> -# the Free Software Foundation; either version 3, or (at your option)
> -# any later version.
> -#
> -# GCC is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with GCC; see the file COPYING3.  If not see
> -# <http://www.gnu.org/licenses/>.
> -
> -# The default build is mips32r2, hard-float big-endian.  Add mips32,
> -# soft-float, and little-endian variations.
> -
> -MULTILIB_OPTIONS = mips32/mips64/mips64r2 mips16/mmicromips mabi=64 EL
> msoft-float mnan=2008
> -MULTILIB_DIRNAMES = mips32 mips64 mips64r2 mips16 micromips 64 el sof
> nan2008
> -MULTILIB_MATCHES = EL=mel EB=meb mips32r2=mips32r3 mips32r2=mips32r5
> mips64r2=mips64r3 mips64r2=mips64r5
> -
> -# The 64 bit ABI is not supported on the mips32 architecture.
> -MULTILIB_EXCEPTIONS += *mips32*/*mabi=64*
> -
> -# The 64 bit ABI is not supported on the mips32r2 architecture.
> -# Because mips32r2 is the default we can't use that flag to trigger
> -# the exception so we check for mabi=64 with no specific mips
> -# architecture flag instead.
> -MULTILIB_EXCEPTIONS += mabi=64*
> -
> -# We do not want to build mips16 versions of mips64* architectures.
> -MULTILIB_EXCEPTIONS += *mips64*/*mips16*
> -MULTILIB_EXCEPTIONS += *mips16/mabi=64*
> -
> -# We only want micromips for mips32r2 architecture.
> -MULTILIB_EXCEPTIONS += *mips32/mmicromips*
> -MULTILIB_EXCEPTIONS += *mips64*/mmicromips*
> -MULTILIB_EXCEPTIONS += *mmicromips/mabi=64*
> -
> -# We do not want nan2008 libraries for soft-float,
> -# mips32[r1], or mips64[r1].
> -MULTILIB_EXCEPTIONS += *msoft-float*/*mnan=2008*
> -MULTILIB_EXCEPTIONS += *mips32/*mnan=2008*
> -MULTILIB_EXCEPTIONS += *mips64/*mnan=2008*
> diff --git a/gcc/config/mips/t-mti-linux b/gcc/config/mips/t-mti-linux
> deleted file mode 100644
> index 2a69adb9..0000000
> --- a/gcc/config/mips/t-mti-linux
> +++ /dev/null
> @@ -1,158 +0,0 @@
> -# Copyright (C) 2012-2018 Free Software Foundation, Inc.
> -#
> -# This file is part of GCC.
> -#
> -# GCC is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License as published by
> -# the Free Software Foundation; either version 3, or (at your option)
> -# any later version.
> -#
> -# GCC is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with GCC; see the file COPYING3.  If not see
> -# <http://www.gnu.org/licenses/>.
> -
> -# The default build is mips32r2, hard-float big-endian.  Add mips32,
> -# soft-float, and little-endian variations.
> -
> -MULTILIB_OPTIONS = mips32/mips64/mips64r2 mips16/mmicromips mabi=64 EL
> msoft-float mnan=2008
> -MULTILIB_DIRNAMES = mips32 mips64 mips64r2 mips16 micromips 64 el sof
> nan2008
> -MULTILIB_MATCHES = EL=mel EB=meb mips32r2=mips32r3 mips32r2=mips32r5
> mips64r2=mips64r3 mips64r2=mips64r5
> -
> -MULTILIB_REQUIRED    =
> -MULTILIB_OSDIRNAMES  = .=mips-r2-hard/lib
> -MULTILIB_REQUIRED   += mips64r2
> -MULTILIB_OSDIRNAMES += mips64r2=!mips-r2-hard/lib32
> -MULTILIB_REQUIRED   += mips64r2/mabi=64
> -MULTILIB_OSDIRNAMES += mips64r2/mabi.64=!mips-r2-hard/lib64
> -
> -MULTILIB_REQUIRED   += mnan=2008
> -MULTILIB_OSDIRNAMES += mnan.2008=!mips-r2-hard-nan2008/lib
> -MULTILIB_REQUIRED   += mips64r2/mnan=2008
> -MULTILIB_OSDIRNAMES += mips64r2/mnan.2008=!mips-r2-hard-nan2008/lib32
> -MULTILIB_REQUIRED   += mips64r2/mabi=64/mnan=2008
> -MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/mnan.2008=!mips-r2-hard-nan2008/lib64
> -
> -MULTILIB_REQUIRED   += msoft-float
> -MULTILIB_OSDIRNAMES += msoft-float=!mips-r2-soft/lib
> -MULTILIB_REQUIRED   += mips64r2/msoft-float
> -MULTILIB_OSDIRNAMES += mips64r2/msoft-float=!mips-r2-soft/lib32
> -MULTILIB_REQUIRED   += mips64r2/mabi=64/msoft-float
> -MULTILIB_OSDIRNAMES += mips64r2/mabi.64/msoft-float=!mips-r2-soft/lib64
> -
> -#MULTILIB_REQUIRED   += msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES += msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib
> -#MULTILIB_REQUIRED   += mips64r2/msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES +=
> mips64r2/msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib32
> -#MULTILIB_REQUIRED   += mips64r2/mabi=64/msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib64
> -
> -MULTILIB_REQUIRED   += EL
> -MULTILIB_OSDIRNAMES += EL=!mipsel-r2-hard/lib
> -MULTILIB_REQUIRED   += mips64r2/EL
> -MULTILIB_OSDIRNAMES += mips64r2/EL=!mipsel-r2-hard/lib32
> -MULTILIB_REQUIRED   += mips64r2/mabi=64/EL
> -MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL=!mipsel-r2-hard/lib64
> -
> -MULTILIB_REQUIRED   += EL/mnan=2008
> -MULTILIB_OSDIRNAMES += EL/mnan.2008=!mipsel-r2-hard-nan2008/lib
> -MULTILIB_REQUIRED   += mips64r2/EL/mnan=2008
> -MULTILIB_OSDIRNAMES += mips64r2/EL/mnan.2008=!mipsel-r2-hard-nan2008/lib32
> -MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/mnan=2008
> -MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/EL/mnan.2008=!mipsel-r2-hard-nan2008/lib64
> -
> -MULTILIB_REQUIRED   += EL/msoft-float
> -MULTILIB_OSDIRNAMES += EL/msoft-float=!mipsel-r2-soft/lib
> -MULTILIB_REQUIRED   += mips64r2/EL/msoft-float
> -MULTILIB_OSDIRNAMES += mips64r2/EL/msoft-float=!mipsel-r2-soft/lib32
> -MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/msoft-float
> -MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/EL/msoft-float=!mipsel-r2-soft/lib64
> -
> -#MULTILIB_REQUIRED   += EL/msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES +=
> EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib
> -#MULTILIB_REQUIRED   += mips64r2/EL/msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES +=
> mips64r2/EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib32
> -#MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES +=
> mips64r2/mabi.64/EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib64
> -
> -# We will not include any 64 bit mips16 combinations.
> -MULTILIB_REQUIRED   += mips16
> -MULTILIB_OSDIRNAMES += mips16=!mips-r2-mips16-hard/lib
> -MULTILIB_REQUIRED   += mips16/mnan=2008
> -MULTILIB_OSDIRNAMES += mips16/mnan.2008=!mips-r2-mips16-hard-nan2008/lib
> -MULTILIB_REQUIRED   += mips16/msoft-float
> -MULTILIB_OSDIRNAMES += mips16/msoft-float=!mips-r2-mips16-soft/lib
> -#MULTILIB_REQUIRED   += mips16/msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES +=
> mips16/msoft-float/mnan.2008=!mips-r2-mips16-soft-nan2008/lib
> -
> -MULTILIB_REQUIRED   += mips16/EL
> -MULTILIB_OSDIRNAMES += mips16/EL=!mipsel-r2-mips16-hard/lib
> -MULTILIB_REQUIRED   += mips16/EL/mnan=2008
> -MULTILIB_OSDIRNAMES +=
> mips16/EL/mnan.2008=!mipsel-r2-mips16-hard-nan2008/lib
> -MULTILIB_REQUIRED   += mips16/EL/msoft-float
> -MULTILIB_OSDIRNAMES += mips16/EL/msoft-float=!mipsel-r2-mips16-soft/lib
> -#MULTILIB_REQUIRED   += mips16/EL/msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES +=
> mips16/EL/msoft-float/mnan.2008=!mipsel-r2-mips16-soft-nan2008/lib
> -
> -MULTILIB_REQUIRED   += mmicromips
> -MULTILIB_OSDIRNAMES += mmicromips=!micromips-r2-hard/lib
> -MULTILIB_REQUIRED   += mmicromips/mnan=2008
> -MULTILIB_OSDIRNAMES += mmicromips/mnan.2008=!micromips-r2-hard-nan2008/lib
> -MULTILIB_REQUIRED   += mmicromips/msoft-float
> -MULTILIB_OSDIRNAMES += mmicromips/msoft-float=!micromips-r2-soft/lib
> -#MULTILIB_REQUIRED   += mmicromips/msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES +=
> mmicromips/msoft-float/mnan.2008=!micromips-r2-soft-nan2008/lib
> -
> -MULTILIB_REQUIRED   += mmicromips/EL
> -MULTILIB_OSDIRNAMES += mmicromips/EL=!micromipsel-r2-hard/lib
> -MULTILIB_REQUIRED   += mmicromips/EL/mnan=2008
> -MULTILIB_OSDIRNAMES +=
> mmicromips/EL/mnan.2008=!micromipsel-r2-hard-nan2008/lib
> -MULTILIB_REQUIRED   += mmicromips/EL/msoft-float
> -MULTILIB_OSDIRNAMES += mmicromips/EL/msoft-float=!micromipsel-r2-soft/lib
> -#MULTILIB_REQUIRED   += mmicromips/EL/msoft-float/mnan=2008
> -#MULTILIB_OSDIRNAMES +=
> mmicromips/EL/msoft-float/mnan.2008=!micromipsel-r2-soft-nan2008/lib
> -
> -# Version 1 multilibs
> -
> -MULTILIB_REQUIRED   += mips32
> -MULTILIB_OSDIRNAMES += mips32=!mips-r1-hard/lib
> -MULTILIB_REQUIRED   += mips64
> -MULTILIB_OSDIRNAMES += mips64=!mips-r1-hard/lib32
> -MULTILIB_REQUIRED   += mips64/mabi=64
> -MULTILIB_OSDIRNAMES += mips64/mabi.64=!mips-r1-hard/lib64
> -
> -MULTILIB_REQUIRED   += mips32/msoft-float
> -MULTILIB_OSDIRNAMES += mips32/msoft-float=!mips-r1-soft/lib
> -MULTILIB_REQUIRED   += mips64/msoft-float
> -MULTILIB_OSDIRNAMES += mips64/msoft-float=!mips-r1-soft/lib32
> -MULTILIB_REQUIRED   += mips64/mabi=64/msoft-float
> -MULTILIB_OSDIRNAMES += mips64/mabi.64/msoft-float=!mips-r1-soft/lib64
> -
> -MULTILIB_REQUIRED   += mips32/EL
> -MULTILIB_OSDIRNAMES += mips32/EL=!mipsel-r1-hard/lib
> -MULTILIB_REQUIRED   += mips64/EL
> -MULTILIB_OSDIRNAMES += mips64/EL=!mipsel-r1-hard/lib32
> -MULTILIB_REQUIRED   += mips64/mabi=64/EL
> -MULTILIB_OSDIRNAMES += mips64/mabi.64/EL=!mipsel-r1-hard/lib64
> -
> -MULTILIB_REQUIRED   += mips32/EL/msoft-float
> -MULTILIB_OSDIRNAMES += mips32/EL/msoft-float=!mipsel-r1-soft/lib
> -MULTILIB_REQUIRED   += mips64/EL/msoft-float
> -MULTILIB_OSDIRNAMES += mips64/EL/msoft-float=!mipsel-r1-soft/lib32
> -MULTILIB_REQUIRED   += mips64/mabi=64/EL/msoft-float
> -MULTILIB_OSDIRNAMES += mips64/mabi.64/EL/msoft-float=!mipsel-r1-soft/lib64
> -
> -# We will not include any 64 bit mips16 combinations.
> -MULTILIB_REQUIRED   += mips32/mips16
> -MULTILIB_OSDIRNAMES += mips32/mips16=!mips-r1-mips16-hard/lib
> -MULTILIB_REQUIRED   += mips32/mips16/msoft-float
> -MULTILIB_OSDIRNAMES += mips32/mips16/msoft-float=!mips-r1-mips16-soft/lib
> -
> -MULTILIB_REQUIRED   += mips32/mips16/EL
> -MULTILIB_OSDIRNAMES += mips32/mips16/EL=!mipsel-r1-mips16-hard/lib
> -MULTILIB_REQUIRED   += mips32/mips16/EL/msoft-float
> -MULTILIB_OSDIRNAMES +=
> mips32/mips16/EL/msoft-float=!mipsel-r1-mips16-soft/lib
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index 010ecd2..01c5ae1 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -811,6 +811,9 @@ AC_MSG_RESULT($enable_multiarch$ma_msg_suffix)
>  AC_SUBST(with_cpu)
>  AC_SUBST(with_float)
>
> +# needed for restricting the fixedincludes multilibs that we install
> +AC_SUBST(with_multi_buildlist)
> +
>  # Enable __cxa_atexit for C++.
>  AC_ARG_ENABLE(__cxa_atexit,
>  [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],
> --
> 2.2.1
>
>
>

While you're changing stuff regarding multilib control, could you
please take a look at some of the bugs open regarding multilibs? For
example:
pr37704 re: libgcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37704
pr38743 re: --disable-multilib:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38743
pr46981 re: LD_LIBRARY_PATH: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46981
pr69561 re: MULTILIB_EXCLUSIONS:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69561
Just some things I thought might be nice. Thanks!
Eric
Jeff Law June 28, 2018, 3:23 a.m. UTC | #2
On 06/13/2018 07:56 AM, Matthew Fortune wrote:
> Hi,
> 
> This patch was developed as part of preparing ever more complex multilib
> combinations for the MIPS architecture and aims to solve several problems
> in this area. I've attempted to be quite verbose in the description, so
> that I can explain how I am using various terms as pretty much everyone
> has a different understanding (and I don't claim mine to be 'right'
> either).
> 
> The changes aim to:
> 
> 1) Eliminate the fallback multilib
> The fallback multilib (top level of 'lib') is often annoying because it is
> used for any combination of options that do not match a specific multilib.
> Quite often this default multilib is incompatible with the build options
> that end up linking against it, leading to bizarre link time messages that
> confuse ordinary users.
> 
> 2) Move the default multilib to a subfolder
> Having successfully eliminated the fallback multilib it is also true that
> it would eliminate the 'default' multilib as well. I.e. the library used
> when no relevant user options are supplied. Moving this library to a
> subfolder has two benefits. a) it still exists! and b) the location of
> this library becomes invariant irrespective of which options are
> build-time configured as default.
> 
> 3) Preserve/use invariant paths for multilib variants
> A simplistic multilib specification leads to a nested set of folders,
> where the top level is the left-most multilib directory and the bottom is
> the right most. Introducing a new axis of multilib configuration changes
> this path structure leading to the different library configurations to 
> move around. This is not in itself a problem, as the compiler driver can
> always locate the right path for any given build, but it does cause issues
> when doing configuration management of binary toolchains. When there are
> many different multilibs it is ideal to ship/install only the ones that
> are important and if the paths keep changing over time this process is
> complex and confusing. This issue is effectively solved by the
> MULTI_OSDIRNAMES feature but using it for both sysroot and compiler
> internal libraries is even better.
> 
> 4) Support un-released multilib configurations
> This one sounds weird but it is quite valuable. When an architecture has
> 70+ possible multilib variants but only 40 of them are currently known to
> be needed then only build and release 40 variants. However, if it turns
> out that another configuration becomes useful then it is often handy to
> just build the missing configuration and install it into the pre-existing
> release. So, the driver needs to know about all multilibs and their paths
> but the build process should only build a subset.
> 
> So, the solution...
> 
> Firstly, be verbose about the MULTILIB_OPTIONS needed for a target. Add
> in the default options as well as all the others that may, or could, ever
> be supported by the current compiler features. For MIPS supporting
> MIPS32r1 onwards it looks like this:
> 
> MULTILIB_OPTIONS = muclibc mips32/mips32r2/mips32r6/mips64/mips64r2/mips64r6
> mips16/mmicromips mabi=32/mabi=n32/mabi=64 EB/EL msoft-float mnan=2008
> 
> This does create an enormous matrix of possible configurations so this
> has to be trimmed to the valid set using MULTILIB_REQUIRED. Note that
> the valid set should include any that you may wish to support even if
> you don't want to build/release them. By having the default options in
> then this leads to having two copies of the 'default' multilib; one with
> the options implicitly set and one with them explicitly set.
> 
> Second, remove the multilib with the implicit default options. This
> equates to the '.' multilib entry. To do this use MULTILIB_EXCLUSIONS to
> remove the negated form of every MULTILIB_OPTION:
> 
> MULTILIB_EXCLUSIONS =
> !muclibc/!mips32/!mips32r2/!mips32r6/!mips64/!mips64r2/!mips64r6/!mips16/!mm
> icromips/!mabi=32/!mabi=n32/!mabi=64/!EB/!EL/!msoft-float/!mnan=2008
> 
> Third, set the MULTILIB_OSDIRNAMES to have an entry for every valid
> combination of options and use the '!' modifier. Honestly, I'm not sure
> how/why this works but this leads to both the internal library paths and
> sysroot paths using the OSDIRNAME instead of the nested tree of
> MULTILIB_DIRNAMES. Choose a path for each variant that you will never
> change again; I used an encoded form of the configuration for MIPS:
> 
> MULTILIB_OSDIRNAMES =
> mips32r6/mabi.32/EB/mnan.2008=!mips-r6-hard$(is_newlib)/lib
> 
> Fourth, deal with the fallout from the config-ml.in logic which handles
> the initial 'configure' of a library differently to all of the multilib
> configurations. The basic idea is that since the default multilib will now
> report that it belongs in a subdirectory then, when configuring the top
> level multilib, query the driver for the folder. Later when iterating
> through the multilib specs skip the one that matches the default
> configuration. Each configuration will be built exactly once and all of
> them will be placed in a subfolder leaving the top level install folder
> bare.
> 
> Fifth, restrict the set of multilibs that actually get built for any
> given compiler. This is sort-of a new concept so I added a
> --with-multi-buildlist configure option that points to a file that lists
> all the OSDIRNAME paths that you DO want to build. The config-ml.in file
> queries this list to trim the multilib list. There are existing features
> to trim portions of a multilib list but they are designed to remove a whole
> axis of the configuration and I needed much finer control.
> 
> Sixth, update the fixinc logic so that it too will use the multi-buildlist
> restrictions when installing headers.
> 
> Finally, add default multi-buildlist files that automatically get chosen
> for certain triples.
> 
> I'm aware of a few formatting quirks and other issues in this patch but
> I wanted to share the patch both to get feedback and see if anyone else
> finds it useful to finish it off and help do the required level of testing.
> 
> Comments/feedback welcome.
The core concepts all seem solid to me.  It'd probably be helpful to
give some guidance how to convert existing ports.

This could help with some of the other legacy ports.  For example the
H8, which by default builds a 16bit compiler which, for a variety of
reasons, is incapable of building the C++ runtime.  These days I don't
think we'd want to build any of the 16bit variants at all, but having a
way to drop them in if someone did want them is probably helpful.
Getting the multilib names stable has a lot of value too.

Jeff
diff mbox series

Patch

diff --git a/config-ml.in b/config-ml.in
index 47f1533..255dd1f 100644
--- a/config-ml.in
+++ b/config-ml.in
@@ -382,6 +382,23 @@  mips*-*-*)
 	    esac
 	  done
 	fi
+	if [ x$with_multi_buildlist != x ]
+	then
+	  old_multidirs="${multidirs}"
+	  if [ ! -f $with_multi_buildlist ]
+	  then
+	    echo "config-ml.in: Failed to find $with_multi_buildlist"
+	    exit 1
+	  fi
+	  multidirs=""
+	  for x in ${old_multidirs}; do
+	    found=`grep "^${x}$" $with_multi_buildlist`
+	    if [ -n "$found" ]
+	    then
+	      multidirs="${multidirs} ${x}"
+	    fi
+	  done
+	fi
 	;;
 powerpc*-*-* | rs6000*-*-*)
 	if [ x$enable_aix64 = xno ]
@@ -582,7 +599,8 @@  else
 fi
 
 if [ -z "${with_multisubdir}" ]; then
-  ml_subdir=
+  ml_top_subdir=`${CC-gcc} --print-multi-directory 2>/dev/null`
+  ml_subdir=/$ml_top_subdir
   ml_builddotdot=
   : # ml_srcdotdot= # already set
 else
@@ -661,6 +679,11 @@  if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ];
then
 
   for ml_dir in ${multidirs}; do
 
+    if [ "${ml_dir}" == "${ml_top_subdir}" ]; then
+      echo "Skipping configure in multilib subdir ${ml_dir}"
+      continue
+    fi
+
     if [ "${ml_verbose}" = --verbose ]; then
       echo "Running configure in multilib subdir ${ml_dir}"
       echo "pwd: `${PWDCMD-pwd}`"
diff --git a/configure.ac b/configure.ac
index 28155a0..ee61f75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3053,6 +3053,29 @@  if test x${enable_multilib} = x ; then
   target_configargs="--enable-multilib ${target_configargs}"
 fi
 
+# Select default multilib build variants
+if test x${with_multi_buildlist} = x ; then
+  case "$target" in
+    mips*-img-linux*)
multi_buildlist=${srcdir}/gcc/config/mips/ml-img-linux ;;
+    mips*-mti-linux*)
multi_buildlist=${srcdir}/gcc/config/mips/ml-mti-linux ;;
+    mips*-img-elf*) multi_buildlist=${srcdir}/gcc/config/mips/ml-img-elf ;;
+    mips*-mti-elf*) multi_buildlist=${srcdir}/gcc/config/mips/ml-mti-elf ;;
+  esac
+  # Verify the file exists before using it in case the gcc component is not
+  # present in the tree.
+  if test -f "${multi_buildlist}" ; then
+    with_multi_buildlist=$multi_buildlist
+  fi
+fi
+
+# Pass through with_multi_buildlist to host and target.  'gcc' needs it for
the
+# fixed includes which are multilib'd and target libraries need it as they
use
+# config-ml.in.
+if test x${with_multi_buildlist} != x ; then
+  target_configargs="--with-multi-buildlist=${with_multi_buildlist}
${target_configargs}"
+  host_configargs="--with-multi-buildlist=${with_multi_buildlist}
${host_configargs}"
+fi
+
 # Pass --with-newlib if appropriate.  Note that target_configdirs has
 # changed from the earlier setting of with_newlib.
 if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep "
newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index d8f3e88..8c0aedf 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -587,6 +587,9 @@  else
   endif
 endif
 
+# Multilib control
+with_multi_buildlist = @with_multi_buildlist@
+
 # ------------------------
 # Installation directories
 # ------------------------
@@ -3022,10 +3025,27 @@  fixinc_list: s-fixinc_list; @true
 s-fixinc_list : $(GCC_PASSES)
 # Build up a list of multilib directories and corresponding sysroot
 # suffixes, in form sysroot;multilib.
+# Use a filtered multilib list if requested.
 	if $(GCC_FOR_TARGET) -print-sysroot-headers-suffix > /dev/null 2>&1;
then \
 	  set -e; for ml in `$(GCC_FOR_TARGET) -print-multi-lib`; do \
 	    multi_dir=`echo $${ml} | sed -e 's/;.*$$//'`; \
 	    flags=`echo $${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
+	    case "$(target)" in \
+	    mips*-*-*) \
+	      if [ x$(with_multi_buildlist) != x ]; then \
+		if [ ! -f $(with_multi_buildlist) ]; then \
+		  echo "fixinc_list: Failed to find
$(with_multi_buildlist)"; \
+		  exit 1; \
+		fi; \
+		set +e; \
+		found=`grep "^$${multi_dir}$$" $(with_multi_buildlist)`; \
+		set -e; \
+		if [ -z "$$found" ]; then \
+		  continue; \
+		fi; \
+	      fi; \
+	      ;; \
+	    esac; \
 	    sfx=`$(GCC_FOR_TARGET) $${flags} -print-sysroot-headers-suffix`;
\
 	    if [ "$${multi_dir}" = "." ]; \
 	      then multi_dir=""; \
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 8b2fd90..41bfd95 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2119,7 +2119,7 @@  mips*-*-netbsd*)			# NetBSD/mips,
either endian.
 mips*-img-linux*)
 	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h
glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h
mips/mti-linux.h"
 	extra_options="${extra_options} linux-android.opt"
-	tmake_file="${tmake_file} mips/t-img-linux"
+	tmake_file="${tmake_file} mips/t-mips-multi"
 	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=37
MIPS_ABI_DEFAULT=ABI_32"
 	with_arch_32="mips32r6"
 	with_arch_64="mips64r6"
@@ -2129,7 +2129,7 @@  mips*-img-linux*)
 mips*-mti-linux*)
 	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h
glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h
mips/mti-linux.h"
 	extra_options="${extra_options} linux-android.opt"
-	tmake_file="${tmake_file} mips/t-mti-linux"
+	tmake_file="${tmake_file} mips/t-mips-multi"
 	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33
MIPS_ABI_DEFAULT=ABI_32"
 	with_arch_32="mips32r2"
 	with_arch_64="mips64r2"
@@ -2185,17 +2185,19 @@  mips*-*-linux*)				# Linux
MIPS, either endian.
 	;;
 mips*-mti-elf*)
 	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h
mips/n32-elf.h mips/sde.h mips/mti-elf.h"
-	tmake_file="mips/t-mti-elf"
+	tmake_file="mips/t-mips-multi"
 	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33
MIPS_ABI_DEFAULT=ABI_32"
 	with_arch_32="mips32r2"
 	with_arch_64="mips64r2"
+	TM_MULTILIB_EXCEPTIONS_CONFIG="*muclibc*"
 	;;
 mips*-img-elf*)
 	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h
mips/n32-elf.h mips/sde.h mips/mti-elf.h"
-	tmake_file="mips/t-img-elf"
+	tmake_file="mips/t-mips-multi"
 	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=37
MIPS_ABI_DEFAULT=ABI_32"
 	with_arch_32="mips32r6"
 	with_arch_64="mips64r6"
+	TM_MULTILIB_EXCEPTIONS_CONFIG="*muclibc*"
 	;;
 mips*-sde-elf*)
 	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h
mips/n32-elf.h mips/sde.h"
diff --git a/gcc/config/mips/ml-img-elf b/gcc/config/mips/ml-img-elf
new file mode 100644
index 0000000..91204f82
--- /dev/null
+++ b/gcc/config/mips/ml-img-elf
@@ -0,0 +1,12 @@ 
+mips-r6-hard-newlib/lib
+mips-r6-hard-newlib/lib32
+mips-r6-hard-newlib/lib64
+mips-r6-soft-newlib/lib
+mips-r6-soft-newlib/lib32
+mips-r6-soft-newlib/lib64
+mipsel-r6-hard-newlib/lib
+mipsel-r6-hard-newlib/lib32
+mipsel-r6-hard-newlib/lib64
+mipsel-r6-soft-newlib/lib
+mipsel-r6-soft-newlib/lib32
+mipsel-r6-soft-newlib/lib64
diff --git a/gcc/config/mips/ml-img-linux b/gcc/config/mips/ml-img-linux
new file mode 100644
index 0000000..fa55ded
--- /dev/null
+++ b/gcc/config/mips/ml-img-linux
@@ -0,0 +1,8 @@ 
+mips-r6-hard/lib
+mips-r6-soft/lib
+mips-r6-hard/lib32
+mips-r6-hard/lib64
+mipsel-r6-hard/lib
+mipsel-r6-soft/lib
+mipsel-r6-hard/lib32
+mipsel-r6-hard/lib64
diff --git a/gcc/config/mips/ml-mti-elf b/gcc/config/mips/ml-mti-elf
new file mode 100644
index 0000000..7ac2deb
--- /dev/null
+++ b/gcc/config/mips/ml-mti-elf
@@ -0,0 +1,17 @@ 
+mips-r2-hard-newlib/lib
+mips-r2-hard-newlib/lib32
+mips-r2-hard-newlib/lib64
+mips-r2-hard-nan2008-newlib/lib
+mips-r2-soft-newlib/lib
+mips-r2-soft-newlib/lib32
+mips-r2-soft-newlib/lib64
+mipsel-r2-hard-newlib/lib
+mipsel-r2-hard-newlib/lib32
+mipsel-r2-hard-newlib/lib64
+mipsel-r2-soft-newlib/lib
+mipsel-r2-soft-newlib/lib32
+mipsel-r2-soft-newlib/lib64
+mipsel-r2-mips16-soft-newlib/lib
+mipsel-r2-hard-nan2008-newlib/lib
+micromipsel-r2-hard-nan2008-newlib/lib
+micromipsel-r2-soft-newlib/lib
diff --git a/gcc/config/mips/ml-mti-linux b/gcc/config/mips/ml-mti-linux
new file mode 100644
index 0000000..1056700
--- /dev/null
+++ b/gcc/config/mips/ml-mti-linux
@@ -0,0 +1,16 @@ 
+mips-r2-hard/lib
+mips-r2-soft/lib
+mips-r2-hard/lib32
+mips-r2-hard/lib64
+mips-r2-hard-nan2008/lib
+mipsel-r2-hard/lib
+mipsel-r2-soft/lib
+mipsel-r2-hard/lib32
+mipsel-r2-hard/lib64
+mipsel-r2-hard-nan2008/lib
+micromipsel-r2-hard-nan2008/lib
+micromipsel-r2-soft/lib
+mips-r2-hard-uclibc/lib
+mips-r2-hard-nan2008-uclibc/lib
+mipsel-r2-hard-uclibc/lib
+mipsel-r2-hard-nan2008-uclibc/lib
diff --git a/gcc/config/mips/mti-elf.h b/gcc/config/mips/mti-elf.h
index d4a11b1..206efdc 100644
--- a/gcc/config/mips/mti-elf.h
+++ b/gcc/config/mips/mti-elf.h
@@ -17,6 +17,8 @@  You should have received a copy of the GNU General Public
License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#undef MULTILIB_DEFAULTS
+
 #undef DRIVER_SELF_SPECS
 #define DRIVER_SELF_SPECS						\
   /* Set the ISA for the default multilib.  */				\
diff --git a/gcc/config/mips/mti-linux.h b/gcc/config/mips/mti-linux.h
index 9792972..4fcd0c9 100644
--- a/gcc/config/mips/mti-linux.h
+++ b/gcc/config/mips/mti-linux.h
@@ -23,6 +23,8 @@  along with GCC; see the file COPYING3.  If not see
    mips64r3, and mips64r5 will all default to 'r2'.  See MULTILIB_MATCHES
    definition in t-mti-linux.  */
 
+#undef MULTILIB_DEFAULTS
+
 #define MIPS_SYSVERSION_SPEC \
     "%{mips32|mips64:r1;mips32r6|mips64r6:r6;:r2}%{mips16:-mips16}"
 
diff --git a/gcc/config/mips/t-img-elf b/gcc/config/mips/t-img-elf
deleted file mode 100644
index 09159cd..0000000
--- a/gcc/config/mips/t-img-elf
+++ /dev/null
@@ -1,33 +0,0 @@ 
-# Copyright (C) 2014-2018 Free Software Foundation, Inc.
-#
-# This file is part of GCC.
-#
-# GCC is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GCC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# The default build is mips32r6, hard-float big-endian.
-# A multilib for mips32r6+LE
-# A multilib for mips64r6
-# A multilib for mips64r6+LE
-
-MULTILIB_OPTIONS = mips64r6 mabi=64 EL msoft-float/msingle-float
-MULTILIB_DIRNAMES = mips64r6 64 el sof sgl
-MULTILIB_MATCHES = EL=mel EB=meb
-
-# Don't build 64r6 with single-float
-MULTILIB_EXCEPTIONS += mips64r6/*msingle-float*
-
-MULTILIB_EXCEPTIONS += mabi=64*
-MULTILIB_EXCEPTIONS += msingle-float*
-MULTILIB_EXCEPTIONS += *msingle-float
diff --git a/gcc/config/mips/t-img-linux b/gcc/config/mips/t-img-linux
deleted file mode 100644
index ba2b2b8..0000000
--- a/gcc/config/mips/t-img-linux
+++ /dev/null
@@ -1,38 +0,0 @@ 
-# Copyright (C) 2014-2018 Free Software Foundation, Inc.
-#
-# This file is part of GCC.
-#
-# GCC is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GCC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# The default build is mips32r6, hard-float big-endian.  Add mips64r6,
-# 64-bit ABI and little-endian variations.
-
-MULTILIB_OPTIONS = mips64r6 mabi=64 EL
-MULTILIB_DIRNAMES = mips64r6 64 el
-MULTILIB_MATCHES = EL=mel EB=meb
-
-MULTILIB_REQUIRED =
-MULTILIB_OSDIRNAMES = .=mips-r6-hard/lib
-MULTILIB_REQUIRED += mips64r6
-MULTILIB_OSDIRNAMES += mips64r6=!mips-r6-hard/lib32
-MULTILIB_REQUIRED += mips64r6/mabi=64
-MULTILIB_OSDIRNAMES += mips64r6/mabi.64=!mips-r6-hard/lib64
-
-MULTILIB_REQUIRED += EL
-MULTILIB_OSDIRNAMES += EL=!mipsel-r6-hard/lib
-MULTILIB_REQUIRED += mips64r6/EL
-MULTILIB_OSDIRNAMES += mips64r6/EL=!mipsel-r6-hard/lib32
-MULTILIB_REQUIRED += mips64r6/mabi=64/EL
-MULTILIB_OSDIRNAMES += mips64r6/mabi.64/EL=!mipsel-r6-hard/lib64
diff --git a/gcc/config/mips/t-mips-multi b/gcc/config/mips/t-mips-multi
new file mode 100644
index 0000000..d1f834d
--- /dev/null
+++ b/gcc/config/mips/t-mips-multi
@@ -0,0 +1,214 @@ 
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# There is no default build in this multilib setup. This unfortunately
+# does not prevent config-ml.in from building a default but this can
+# be removed via post install scripts.
+#
+# All possible MIPS multilibs are shown in this file. They are limited
+# via a file that lists required multilibs for each vendor/OS
+# combination which can be overridden at build time as well.
+#
+# The benefit to describing all multilibs is that the compiler driver
+# can use any multilib if it is present and therefore additional
+# library variants can be added to an installation after initial
+# build. This could be achieved by building all libraries and removing
+# the ones we don't want to ship but this would massively increase
+# build times in situations where only a few are required immediately.
+
+MULTILIB_OPTIONS = muclibc
mips32/mips32r2/mips32r6/mips64/mips64r2/mips64r6 mips16/mmicromips
mabi=32/mabi=n32/mabi=64 EB/EL msoft-float mnan=2008
+MULTILIB_DIRNAMES = uclibc mips32 mips32r2 mips32r6 mips64 mips64r2
mips64r6 mips16 micromips 32 n32 64 eb el sof nan2008
+MULTILIB_MATCHES = EL=mel EB=meb mips32r2=mips32r3 mips32r2=mips32r5
mips64r2=mips64r3 mips64r2=mips64r5
+
+# Allow the exceptions list to be controlled by configure time options
+MULTILIB_EXCEPTIONS = $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+
+# Determine if this is a bare metal target with a newlib default library
+is_newlib = $(if $(filter elf, $(lastword $(subst -, ,$(target)))),-newlib)
+
+MULTILIB_EXCLUSIONS =
!muclibc/!mips32/!mips32r2/!mips32r6/!mips64/!mips64r2/!mips64r6/!mips16/!mm
icromips/!mabi=32/!mabi=n32/!mabi=64/!EB/!EL/!msoft-float/!mnan=2008
+
+# MIPS32R6/MIPS64R6
+MULTILIB_REQUIRED   = mips32r6/mabi=32/EB/mnan=2008
+MULTILIB_OSDIRNAMES =
mips32r6/mabi.32/EB/mnan.2008=!mips-r6-hard$(is_newlib)/lib
+MULTILIB_REUSE      =
mips32r6/mabi.32/EB/mnan.2008=mips64r6/mabi.32/EB/mnan.2008
+MULTILIB_REQUIRED   += mips64r6/mabi=n32/EB/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r6/mabi.n32/EB/mnan.2008=!mips-r6-hard$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r6/mabi=64/EB/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r6/mabi.64/EB/mnan.2008=!mips-r6-hard$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32r6/mabi=32/EB/msoft-float/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips32r6/mabi.32/EB/msoft-float/mnan.2008=!mips-r6-soft$(is_newlib)/lib
+MULTILIB_REUSE      +=
mips32r6/mabi.32/EB/msoft-float/mnan.2008=mips64r6/mabi.32/EB/msoft-float/mn
an.2008
+MULTILIB_REQUIRED   += mips64r6/mabi=n32/EB/msoft-float/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r6/mabi.n32/EB/msoft-float/mnan.2008=!mips-r6-soft$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r6/mabi=64/EB/msoft-float/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r6/mabi.64/EB/msoft-float/mnan.2008=!mips-r6-soft$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32r6/mabi=32/EL/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips32r6/mabi.32/EL/mnan.2008=!mipsel-r6-hard$(is_newlib)/lib
+MULTILIB_REUSE      +=
mips32r6/mabi.32/EL/mnan.2008=mips64r6/mabi.32/EL/mnan.2008
+MULTILIB_REQUIRED   += mips64r6/mabi=n32/EL/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r6/mabi.n32/EL/mnan.2008=!mipsel-r6-hard$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r6/mabi=64/EL/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r6/mabi.64/EL/mnan.2008=!mipsel-r6-hard$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32r6/mabi=32/EL/msoft-float/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips32r6/mabi.32/EL/msoft-float/mnan.2008=!mipsel-r6-soft$(is_newlib)/lib
+MULTILIB_REUSE      +=
mips32r6/mabi.32/EL/msoft-float/mnan.2008=mips64r6/mabi.32/EL/msoft-float/mn
an.2008
+MULTILIB_REQUIRED   += mips64r6/mabi=n32/EL/msoft-float/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r6/mabi.n32/EL/msoft-float/mnan.2008=!mipsel-r6-soft$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r6/mabi=64/EL/msoft-float/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r6/mabi.64/EL/msoft-float/mnan.2008=!mipsel-r6-soft$(is_newlib)/lib64
+
+# MIPS32R2/MIPS64R2
+MULTILIB_REQUIRED   += mips32r2/mabi=32/EB
+MULTILIB_OSDIRNAMES += mips32r2/mabi.32/EB=!mips-r2-hard$(is_newlib)/lib
+MULTILIB_REUSE      += mips32r2/mabi.32/EB=mips64r2/mabi.32/EB
+MULTILIB_REQUIRED   += mips64r2/mabi=n32/EB
+MULTILIB_OSDIRNAMES += mips64r2/mabi.n32/EB=!mips-r2-hard$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r2/mabi=64/EB
+MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EB=!mips-r2-hard$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32r2/mabi=32/EB/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips32r2/mabi.32/EB/mnan.2008=!mips-r2-hard-nan2008$(is_newlib)/lib
+MULTILIB_REUSE      +=
mips32r2/mabi.32/EB/mnan.2008=mips64r2/mabi.32/EB/mnan.2008
+MULTILIB_REQUIRED   += mips64r2/mabi=n32/EB/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.n32/EB/mnan.2008=!mips-r2-hard-nan2008$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r2/mabi=64/EB/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/EB/mnan.2008=!mips-r2-hard-nan2008$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32r2/mabi=32/EB/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32r2/mabi.32/EB/msoft-float=!mips-r2-soft$(is_newlib)/lib
+MULTILIB_REUSE      +=
mips32r2/mabi.32/EB/msoft-float=mips64r2/mabi.32/EB/msoft-float
+MULTILIB_REQUIRED   += mips64r2/mabi=n32/EB/msoft-float
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.n32/EB/msoft-float=!mips-r2-soft$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r2/mabi=64/EB/msoft-float
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/EB/msoft-float=!mips-r2-soft$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32r2/mabi=32/EL
+MULTILIB_OSDIRNAMES += mips32r2/mabi.32/EL=!mipsel-r2-hard$(is_newlib)/lib
+MULTILIB_REUSE      += mips32r2/mabi.32/EL=mips64r2/mabi.32/EL
+MULTILIB_REQUIRED   += mips64r2/mabi=n32/EL
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.n32/EL=!mipsel-r2-hard$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r2/mabi=64/EL
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/EL=!mipsel-r2-hard$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32r2/mabi=32/EL/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips32r2/mabi.32/EL/mnan.2008=!mipsel-r2-hard-nan2008$(is_newlib)/lib
+MULTILIB_REUSE      +=
mips32r2/mabi.32/EL/mnan.2008=mips64r2/mabi.32/EL/mnan.2008
+MULTILIB_REQUIRED   += mips64r2/mabi=n32/EL/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.n32/EL/mnan.2008=!mipsel-r2-hard-nan2008$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/EL/mnan.2008=!mipsel-r2-hard-nan2008$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32r2/mabi=32/EL/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32r2/mabi.32/EL/msoft-float=!mipsel-r2-soft$(is_newlib)/lib
+MULTILIB_REUSE      +=
mips32r2/mabi.32/EL/msoft-float=mips64r2/mabi.32/EL/msoft-float
+MULTILIB_REQUIRED   += mips64r2/mabi=n32/EL/msoft-float
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.n32/EL/msoft-float=!mipsel-r2-soft$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/msoft-float
+MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/EL/msoft-float=!mipsel-r2-soft$(is_newlib)/lib64
+
+# MIPS16 - We will not include any 64 bit mips16 combinations.
+MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EB
+MULTILIB_OSDIRNAMES +=
mips32r2/mips16/mabi.32/EB=!mips-r2-mips16-hard$(is_newlib)/lib
+MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EB/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips32r2/mips16/mabi.32/EB/mnan.2008=!mips-r2-mips16-hard-nan2008$(is_newlib
)/lib
+MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EB/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32r2/mips16/mabi.32/EB/msoft-float=!mips-r2-mips16-soft$(is_newlib)/lib
+
+MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EL
+MULTILIB_OSDIRNAMES +=
mips32r2/mips16/mabi.32/EL=!mipsel-r2-mips16-hard$(is_newlib)/lib
+MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EL/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips32r2/mips16/mabi.32/EL/mnan.2008=!mipsel-r2-mips16-hard-nan2008$(is_newl
ib)/lib
+MULTILIB_REQUIRED   += mips32r2/mips16/mabi=32/EL/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32r2/mips16/mabi.32/EL/msoft-float=!mipsel-r2-mips16-soft$(is_newlib)/li
b
+
+# microMIPS32R3 - We will not include any 64 bit microMIPS combinations
+MULTILIB_REQUIRED   += mips32r2/mmicromips/mabi=32/EB/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips32r2/mmicromips/mabi.32/EB/mnan.2008=!micromips-r2-hard-nan2008$(is_newl
ib)/lib
+MULTILIB_REQUIRED   += mips32r2/mmicromips/mabi=32/EB/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32r2/mmicromips/mabi.32/EB/msoft-float=!micromips-r2-soft$(is_newlib)/li
b
+
+MULTILIB_REQUIRED   += mips32r2/mmicromips/mabi=32/EL/mnan=2008
+MULTILIB_OSDIRNAMES +=
mips32r2/mmicromips/mabi.32/EL/mnan.2008=!micromipsel-r2-hard-nan2008$(is_ne
wlib)/lib
+MULTILIB_REQUIRED   += mips32r2/mmicromips/mabi=32/EL/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32r2/mmicromips/mabi.32/EL/msoft-float=!micromipsel-r2-soft$(is_newlib)/
lib
+
+# Version 1 multilibs
+
+MULTILIB_REQUIRED   += mips32/mabi=32/EB
+MULTILIB_OSDIRNAMES += mips32/mabi.32/EB=!mips-r1-hard$(is_newlib)/lib
+MULTILIB_REUSE      += mips32/mabi.32/EB=mips64/mabi.32/EB
+MULTILIB_REQUIRED   += mips64/mabi=n32/EB
+MULTILIB_OSDIRNAMES += mips64/mabi.n32/EB=!mips-r1-hard$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64/mabi=64/EB
+MULTILIB_OSDIRNAMES += mips64/mabi.64/EB=!mips-r1-hard$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32/mabi=32/EB/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32/mabi.32/EB/msoft-float=!mips-r1-soft$(is_newlib)/lib
+MULTILIB_REUSE      +=
mips32/mabi.32/EB/msoft-float=mips64/mabi.32/EB/msoft-float
+MULTILIB_REQUIRED   += mips64/mabi=n32/EB/msoft-float
+MULTILIB_OSDIRNAMES +=
mips64/mabi.n32/EB/msoft-float=!mips-r1-soft$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64/mabi=64/EB/msoft-float
+MULTILIB_OSDIRNAMES +=
mips64/mabi.64/EB/msoft-float=!mips-r1-soft$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32/mabi=32/EL
+MULTILIB_OSDIRNAMES += mips32/mabi.32/EL=!mipsel-r1-hard$(is_newlib)/lib
+MULTILIB_REUSE      += mips32/mabi.32/EL=mips64/mabi.32/EL
+MULTILIB_REQUIRED   += mips64/mabi=n32/EL
+MULTILIB_OSDIRNAMES += mips64/mabi.n32/EL=!mipsel-r1-hard$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64/mabi=64/EL
+MULTILIB_OSDIRNAMES += mips64/mabi.64/EL=!mipsel-r1-hard$(is_newlib)/lib64
+
+MULTILIB_REQUIRED   += mips32/mabi=32/EL/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32/mabi.32/EL/msoft-float=!mipsel-r1-soft$(is_newlib)/lib
+MULTILIB_REUSE      +=
mips32/mabi.32/EL/msoft-float=mips64/mabi.32/EL/msoft-float
+MULTILIB_REQUIRED   += mips64/mabi=n32/EL/msoft-float
+MULTILIB_OSDIRNAMES +=
mips64/mabi.n32/EL/msoft-float=!mipsel-r1-soft$(is_newlib)/lib32
+MULTILIB_REQUIRED   += mips64/mabi=64/EL/msoft-float
+MULTILIB_OSDIRNAMES +=
mips64/mabi.64/EL/msoft-float=!mipsel-r1-soft$(is_newlib)/lib64
+
+# We will not include any 64 bit mips16 combinations.
+MULTILIB_REQUIRED   += mips32/mips16/mabi=32/EB
+MULTILIB_OSDIRNAMES +=
mips32/mips16/mabi.32/EB=!mips-r1-mips16-hard$(is_newlib)/lib
+MULTILIB_REQUIRED   += mips32/mips16/mabi=32/EB/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32/mips16/mabi.32/EB/msoft-float=!mips-r1-mips16-soft$(is_newlib)/lib
+
+MULTILIB_REQUIRED   += mips32/mips16/mabi=32/EL
+MULTILIB_OSDIRNAMES +=
mips32/mips16/mabi.32/EL=!mipsel-r1-mips16-hard$(is_newlib)/lib
+MULTILIB_REQUIRED   += mips32/mips16/mabi=32/EL/msoft-float
+MULTILIB_OSDIRNAMES +=
mips32/mips16/mabi.32/EL/msoft-float=!mipsel-r1-mips16-soft$(is_newlib)/lib
+
+# Uclibc variants
+ifeq ($(filter *muclibc*,$(MULTILIB_EXCEPTIONS)),)
+MULTILIB_REQUIRED   += muclibc/mips32r2/mabi=32/EB
+MULTILIB_OSDIRNAMES += muclibc/mips32r2/mabi.32/EB=!mips-r2-hard-uclibc/lib
+MULTILIB_REUSE      +=
muclibc/mips32r2/mabi.32/EB=muclibc/mips64r2/mabi.32/EB
+MULTILIB_REQUIRED   += muclibc/mips32r2/mabi=32/EB/mnan=2008
+MULTILIB_OSDIRNAMES +=
muclibc/mips32r2/mabi.32/EB/mnan.2008=!mips-r2-hard-nan2008-uclibc/lib
+MULTILIB_REUSE      +=
muclibc/mips32r2/mabi.32/EB/mnan.2008=muclibc/mips64r2/mabi.32/EB/mnan.2008
+
+MULTILIB_REQUIRED   += muclibc/mips32r2/mabi=32/EL
+MULTILIB_OSDIRNAMES +=
muclibc/mips32r2/mabi.32/EL=!mipsel-r2-hard-uclibc/lib
+MULTILIB_REUSE      +=
muclibc/mips32r2/mabi.32/EL=muclibc/mips64r2/mabi.32/EL
+MULTILIB_REQUIRED   += muclibc/mips32r2/mabi=32/EL/mnan=2008
+MULTILIB_OSDIRNAMES +=
muclibc/mips32r2/mabi.32/EL/mnan.2008=!mipsel-r2-hard-nan2008-uclibc/lib
+MULTILIB_REUSE      +=
muclibc/mips32r2/mabi.32/EL/mnan.2008=muclibc/mips64r2/mabi.32/EL/mnan.2008
+endif
diff --git a/gcc/config/mips/t-mti-elf b/gcc/config/mips/t-mti-elf
deleted file mode 100644
index 66717de..0000000
--- a/gcc/config/mips/t-mti-elf
+++ /dev/null
@@ -1,48 +0,0 @@ 
-# Copyright (C) 2012-2018 Free Software Foundation, Inc.
-#
-# This file is part of GCC.
-#
-# GCC is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GCC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# The default build is mips32r2, hard-float big-endian.  Add mips32,
-# soft-float, and little-endian variations.
-
-MULTILIB_OPTIONS = mips32/mips64/mips64r2 mips16/mmicromips mabi=64 EL
msoft-float mnan=2008
-MULTILIB_DIRNAMES = mips32 mips64 mips64r2 mips16 micromips 64 el sof
nan2008
-MULTILIB_MATCHES = EL=mel EB=meb mips32r2=mips32r3 mips32r2=mips32r5
mips64r2=mips64r3 mips64r2=mips64r5
-
-# The 64 bit ABI is not supported on the mips32 architecture.
-MULTILIB_EXCEPTIONS += *mips32*/*mabi=64*
-
-# The 64 bit ABI is not supported on the mips32r2 architecture.
-# Because mips32r2 is the default we can't use that flag to trigger
-# the exception so we check for mabi=64 with no specific mips
-# architecture flag instead.
-MULTILIB_EXCEPTIONS += mabi=64*
-
-# We do not want to build mips16 versions of mips64* architectures.
-MULTILIB_EXCEPTIONS += *mips64*/*mips16*
-MULTILIB_EXCEPTIONS += *mips16/mabi=64*
-
-# We only want micromips for mips32r2 architecture.
-MULTILIB_EXCEPTIONS += *mips32/mmicromips*
-MULTILIB_EXCEPTIONS += *mips64*/mmicromips*
-MULTILIB_EXCEPTIONS += *mmicromips/mabi=64*
-
-# We do not want nan2008 libraries for soft-float,
-# mips32[r1], or mips64[r1].
-MULTILIB_EXCEPTIONS += *msoft-float*/*mnan=2008*
-MULTILIB_EXCEPTIONS += *mips32/*mnan=2008*
-MULTILIB_EXCEPTIONS += *mips64/*mnan=2008*
diff --git a/gcc/config/mips/t-mti-linux b/gcc/config/mips/t-mti-linux
deleted file mode 100644
index 2a69adb9..0000000
--- a/gcc/config/mips/t-mti-linux
+++ /dev/null
@@ -1,158 +0,0 @@ 
-# Copyright (C) 2012-2018 Free Software Foundation, Inc.
-#
-# This file is part of GCC.
-#
-# GCC is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GCC is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING3.  If not see
-# <http://www.gnu.org/licenses/>.
-
-# The default build is mips32r2, hard-float big-endian.  Add mips32,
-# soft-float, and little-endian variations.
-
-MULTILIB_OPTIONS = mips32/mips64/mips64r2 mips16/mmicromips mabi=64 EL
msoft-float mnan=2008
-MULTILIB_DIRNAMES = mips32 mips64 mips64r2 mips16 micromips 64 el sof
nan2008
-MULTILIB_MATCHES = EL=mel EB=meb mips32r2=mips32r3 mips32r2=mips32r5
mips64r2=mips64r3 mips64r2=mips64r5
-
-MULTILIB_REQUIRED    =
-MULTILIB_OSDIRNAMES  = .=mips-r2-hard/lib
-MULTILIB_REQUIRED   += mips64r2
-MULTILIB_OSDIRNAMES += mips64r2=!mips-r2-hard/lib32
-MULTILIB_REQUIRED   += mips64r2/mabi=64
-MULTILIB_OSDIRNAMES += mips64r2/mabi.64=!mips-r2-hard/lib64
-
-MULTILIB_REQUIRED   += mnan=2008
-MULTILIB_OSDIRNAMES += mnan.2008=!mips-r2-hard-nan2008/lib
-MULTILIB_REQUIRED   += mips64r2/mnan=2008
-MULTILIB_OSDIRNAMES += mips64r2/mnan.2008=!mips-r2-hard-nan2008/lib32
-MULTILIB_REQUIRED   += mips64r2/mabi=64/mnan=2008
-MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/mnan.2008=!mips-r2-hard-nan2008/lib64
-
-MULTILIB_REQUIRED   += msoft-float
-MULTILIB_OSDIRNAMES += msoft-float=!mips-r2-soft/lib
-MULTILIB_REQUIRED   += mips64r2/msoft-float
-MULTILIB_OSDIRNAMES += mips64r2/msoft-float=!mips-r2-soft/lib32
-MULTILIB_REQUIRED   += mips64r2/mabi=64/msoft-float
-MULTILIB_OSDIRNAMES += mips64r2/mabi.64/msoft-float=!mips-r2-soft/lib64
-
-#MULTILIB_REQUIRED   += msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES += msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib
-#MULTILIB_REQUIRED   += mips64r2/msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES +=
mips64r2/msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib32
-#MULTILIB_REQUIRED   += mips64r2/mabi=64/msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/msoft-float/mnan.2008=!mips-r2-soft-nan2008/lib64
-
-MULTILIB_REQUIRED   += EL
-MULTILIB_OSDIRNAMES += EL=!mipsel-r2-hard/lib
-MULTILIB_REQUIRED   += mips64r2/EL
-MULTILIB_OSDIRNAMES += mips64r2/EL=!mipsel-r2-hard/lib32
-MULTILIB_REQUIRED   += mips64r2/mabi=64/EL
-MULTILIB_OSDIRNAMES += mips64r2/mabi.64/EL=!mipsel-r2-hard/lib64
-
-MULTILIB_REQUIRED   += EL/mnan=2008
-MULTILIB_OSDIRNAMES += EL/mnan.2008=!mipsel-r2-hard-nan2008/lib
-MULTILIB_REQUIRED   += mips64r2/EL/mnan=2008
-MULTILIB_OSDIRNAMES += mips64r2/EL/mnan.2008=!mipsel-r2-hard-nan2008/lib32
-MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/mnan=2008
-MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/EL/mnan.2008=!mipsel-r2-hard-nan2008/lib64
-
-MULTILIB_REQUIRED   += EL/msoft-float
-MULTILIB_OSDIRNAMES += EL/msoft-float=!mipsel-r2-soft/lib
-MULTILIB_REQUIRED   += mips64r2/EL/msoft-float
-MULTILIB_OSDIRNAMES += mips64r2/EL/msoft-float=!mipsel-r2-soft/lib32
-MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/msoft-float
-MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/EL/msoft-float=!mipsel-r2-soft/lib64
-
-#MULTILIB_REQUIRED   += EL/msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES +=
EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib
-#MULTILIB_REQUIRED   += mips64r2/EL/msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES +=
mips64r2/EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib32
-#MULTILIB_REQUIRED   += mips64r2/mabi=64/EL/msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES +=
mips64r2/mabi.64/EL/msoft-float/mnan.2008=!mipsel-r2-soft-nan2008/lib64
-
-# We will not include any 64 bit mips16 combinations.
-MULTILIB_REQUIRED   += mips16
-MULTILIB_OSDIRNAMES += mips16=!mips-r2-mips16-hard/lib
-MULTILIB_REQUIRED   += mips16/mnan=2008
-MULTILIB_OSDIRNAMES += mips16/mnan.2008=!mips-r2-mips16-hard-nan2008/lib
-MULTILIB_REQUIRED   += mips16/msoft-float
-MULTILIB_OSDIRNAMES += mips16/msoft-float=!mips-r2-mips16-soft/lib
-#MULTILIB_REQUIRED   += mips16/msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES +=
mips16/msoft-float/mnan.2008=!mips-r2-mips16-soft-nan2008/lib
-
-MULTILIB_REQUIRED   += mips16/EL
-MULTILIB_OSDIRNAMES += mips16/EL=!mipsel-r2-mips16-hard/lib
-MULTILIB_REQUIRED   += mips16/EL/mnan=2008
-MULTILIB_OSDIRNAMES +=
mips16/EL/mnan.2008=!mipsel-r2-mips16-hard-nan2008/lib
-MULTILIB_REQUIRED   += mips16/EL/msoft-float
-MULTILIB_OSDIRNAMES += mips16/EL/msoft-float=!mipsel-r2-mips16-soft/lib
-#MULTILIB_REQUIRED   += mips16/EL/msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES +=
mips16/EL/msoft-float/mnan.2008=!mipsel-r2-mips16-soft-nan2008/lib
-
-MULTILIB_REQUIRED   += mmicromips
-MULTILIB_OSDIRNAMES += mmicromips=!micromips-r2-hard/lib
-MULTILIB_REQUIRED   += mmicromips/mnan=2008
-MULTILIB_OSDIRNAMES += mmicromips/mnan.2008=!micromips-r2-hard-nan2008/lib
-MULTILIB_REQUIRED   += mmicromips/msoft-float
-MULTILIB_OSDIRNAMES += mmicromips/msoft-float=!micromips-r2-soft/lib
-#MULTILIB_REQUIRED   += mmicromips/msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES +=
mmicromips/msoft-float/mnan.2008=!micromips-r2-soft-nan2008/lib
-
-MULTILIB_REQUIRED   += mmicromips/EL
-MULTILIB_OSDIRNAMES += mmicromips/EL=!micromipsel-r2-hard/lib
-MULTILIB_REQUIRED   += mmicromips/EL/mnan=2008
-MULTILIB_OSDIRNAMES +=
mmicromips/EL/mnan.2008=!micromipsel-r2-hard-nan2008/lib
-MULTILIB_REQUIRED   += mmicromips/EL/msoft-float
-MULTILIB_OSDIRNAMES += mmicromips/EL/msoft-float=!micromipsel-r2-soft/lib
-#MULTILIB_REQUIRED   += mmicromips/EL/msoft-float/mnan=2008
-#MULTILIB_OSDIRNAMES +=
mmicromips/EL/msoft-float/mnan.2008=!micromipsel-r2-soft-nan2008/lib
-
-# Version 1 multilibs
-
-MULTILIB_REQUIRED   += mips32
-MULTILIB_OSDIRNAMES += mips32=!mips-r1-hard/lib
-MULTILIB_REQUIRED   += mips64
-MULTILIB_OSDIRNAMES += mips64=!mips-r1-hard/lib32
-MULTILIB_REQUIRED   += mips64/mabi=64
-MULTILIB_OSDIRNAMES += mips64/mabi.64=!mips-r1-hard/lib64
-
-MULTILIB_REQUIRED   += mips32/msoft-float
-MULTILIB_OSDIRNAMES += mips32/msoft-float=!mips-r1-soft/lib
-MULTILIB_REQUIRED   += mips64/msoft-float
-MULTILIB_OSDIRNAMES += mips64/msoft-float=!mips-r1-soft/lib32
-MULTILIB_REQUIRED   += mips64/mabi=64/msoft-float
-MULTILIB_OSDIRNAMES += mips64/mabi.64/msoft-float=!mips-r1-soft/lib64
-
-MULTILIB_REQUIRED   += mips32/EL
-MULTILIB_OSDIRNAMES += mips32/EL=!mipsel-r1-hard/lib
-MULTILIB_REQUIRED   += mips64/EL
-MULTILIB_OSDIRNAMES += mips64/EL=!mipsel-r1-hard/lib32
-MULTILIB_REQUIRED   += mips64/mabi=64/EL
-MULTILIB_OSDIRNAMES += mips64/mabi.64/EL=!mipsel-r1-hard/lib64
-
-MULTILIB_REQUIRED   += mips32/EL/msoft-float
-MULTILIB_OSDIRNAMES += mips32/EL/msoft-float=!mipsel-r1-soft/lib
-MULTILIB_REQUIRED   += mips64/EL/msoft-float
-MULTILIB_OSDIRNAMES += mips64/EL/msoft-float=!mipsel-r1-soft/lib32
-MULTILIB_REQUIRED   += mips64/mabi=64/EL/msoft-float
-MULTILIB_OSDIRNAMES += mips64/mabi.64/EL/msoft-float=!mipsel-r1-soft/lib64
-
-# We will not include any 64 bit mips16 combinations.
-MULTILIB_REQUIRED   += mips32/mips16
-MULTILIB_OSDIRNAMES += mips32/mips16=!mips-r1-mips16-hard/lib
-MULTILIB_REQUIRED   += mips32/mips16/msoft-float
-MULTILIB_OSDIRNAMES += mips32/mips16/msoft-float=!mips-r1-mips16-soft/lib
-
-MULTILIB_REQUIRED   += mips32/mips16/EL
-MULTILIB_OSDIRNAMES += mips32/mips16/EL=!mipsel-r1-mips16-hard/lib
-MULTILIB_REQUIRED   += mips32/mips16/EL/msoft-float
-MULTILIB_OSDIRNAMES +=
mips32/mips16/EL/msoft-float=!mipsel-r1-mips16-soft/lib
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 010ecd2..01c5ae1 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -811,6 +811,9 @@  AC_MSG_RESULT($enable_multiarch$ma_msg_suffix)
 AC_SUBST(with_cpu)
 AC_SUBST(with_float)
 
+# needed for restricting the fixedincludes multilibs that we install
+AC_SUBST(with_multi_buildlist)
+
 # Enable __cxa_atexit for C++.
 AC_ARG_ENABLE(__cxa_atexit,
 [AS_HELP_STRING([--enable-__cxa_atexit], [enable __cxa_atexit for C++])],