-MULTILIB_OPTIONS = mabi=32/mabi=n32/mabi=64
-MULTILIB_DIRNAMES = o32 32 64
-MULTILIB_OSDIRNAMES = ../lib ../lib32 ../lib64
+# Copyright (C) 2003-2020 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/>.
-EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
-
-LIB2FUNCS_EXTRA = $(srcdir)/config/mips/_tilib.c
-
-TPBIT = tp-bit.c
-
-tp-bit.c: $(srcdir)/config/fp-bit.c
- echo '#ifdef __MIPSEL__' > tp-bit.c
- echo '# define FLOAT_BIT_ORDER_MISMATCH' >> tp-bit.c
- echo '#endif' >> tp-bit.c
- echo '#if __LDBL_MANT_DIG__ == 113' >> tp-bit.c
- echo '#define QUIET_NAN_NEGATED' >> dp-bit.c
- echo '# define TFLOAT' >> tp-bit.c
- cat $(srcdir)/config/fp-bit.c >> tp-bit.c
- echo '#endif' >> tp-bit.c
-
-# This arranges for us to extract the built-in specs of the compiler
-# into specs.install. It's this file that we're going to install as
-# specs. Howver, at toolchain build time, we must use specs that
-# enforce the defaults that the compiler expects, namely, the o32 ABI,
-# instead of n32, that we want to use as the default post install.
-SPECS = specs.install
-specs: specs.install
- # Changing the build-time default ABI from n32 to o32
- # The post-install default ABI will remain n32
- @if test "x`grep '!mabi=\*:-mabi=n32' specs.install`" = \
- "x%{!mabi=*:-mabi=n32}"; then \
- sed 's,\(!mabi=\*:-mabi\)=n32,\1=32,' < specs.install > $@ ; \
- else \
- echo failed, gcc/config/mips/t-linux64 needs updating >&2; \
- false; \
- fi
-
-# This arranges for anyone who uses gcc -print-multi-lib post
-# installation to get lists of options for each multilib to get
-# options that actually work.
-MULTILIB_EXTRA_OPTS = mabi-fake-default
-CRTSTUFF_T_CFLAGS = -mabi-fake-default
+MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
+MULTILIB_DIRNAMES = n32 32 64
+MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
+MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
+MULTILIB_OSDIRNAMES = \
+ ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
+ ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
+ ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))