diff --git a/gcc/config.gcc b/gcc/config.gcc
index 743421768ea..d29e891f0f3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2884,8 +2884,8 @@ mips64r5900-*-elf* | mips64r5900el-*-elf*)
 	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS3 MIPS_ABI_DEFAULT=ABI_N32"
 	;;
 mips64-*-elf* | mips64el-*-elf*)
-	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
-	tmake_file="mips/t-elf"
+	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/n64.h mips/elf.h"
+	tmake_file="mips/t-n64"
 	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS3 MIPS_ABI_DEFAULT=ABI_O64"
 	;;
 mips64vr-*-elf* | mips64vrel-*-elf*)
diff --git a/gcc/config/mips/n64.h b/gcc/config/mips/n64.h
new file mode 100644
index 00000000000..92fab2d41cd
--- /dev/null
+++ b/gcc/config/mips/n64.h
@@ -0,0 +1,13 @@
+#undef DRIVER_SELF_SPECS
+#define DRIVER_SELF_SPECS \
+	/* Enable the mulmul fix for the VR4300 */ \
+	"%{march=vr4300:%{!mno-fix4300:%{!mfix4300:-mfix4300}}}", \
+														\
+	/* Make -mabi=eabi imply 32-bit longs */			\
+	"%{mabi=eabi:%{!mlong*:-mlong32}}"                              \
+									\
+	/* Infer the default float setting from -march.  */		\
+	MIPS_ARCH_FLOAT_SPEC,						\
+									\
+	/* Configuration-independent MIPS rules.  */			\
+	BASE_DRIVER_SELF_SPECS
diff --git a/gcc/config/mips/t-n64 b/gcc/config/mips/t-n64
new file mode 100644
index 00000000000..a3f7df4c808
--- /dev/null
+++ b/gcc/config/mips/t-n64
@@ -0,0 +1,14 @@
+MULTILIB_OPTIONS = \
+    mabi=32/mabi=o64/mabi=n32/mabi=eabi \
+    mgp32
+
+MULTILIB_DIRNAMES = \
+    o32 o64 n32 eabi \
+    gp32
+
+MULTILIB_REQUIRED = \
+    mabi=32 \
+    mabi=o64 \
+    mabi=n32 \
+    mabi=eabi \
+    mabi=eabi/mgp32
