summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.inc12
-rw-r--r--Makefile.libcompat18
-rw-r--r--gnu/lib/libgcc/Makefile3
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.mips1
-rw-r--r--sys/mips/conf/MALTA642
5 files changed, 22 insertions, 4 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 5631d2c61f0e7..dfa8e1e57b038 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -606,7 +606,7 @@ XCFLAGS+= ${BFLAGS}
.endif
.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \
- ${TARGET_ARCH} == "powerpc64")
+ ${TARGET_ARCH} == "powerpc64") || ${TARGET_ARCH:Mmips64*} != ""
LIBCOMPAT= 32
.include "Makefile.libcompat"
.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH} == "armv6"
diff --git a/Makefile.libcompat b/Makefile.libcompat
index b1aa86249aace..ea2a2e69d94c1 100644
--- a/Makefile.libcompat
+++ b/Makefile.libcompat
@@ -4,8 +4,7 @@
__<${_this:T}>__:
# Makefile for the compatibility libraries.
-# - 32-bit compat libraries on PowerPC and AMD64.
-# could also be for mips, but that doesn't work today.
+# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
# -------------------------------------------------------------------
# 32 bit world
@@ -34,6 +33,21 @@ LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
LIB32WMAKEFLAGS= \
LD="${XLD} -m elf32ppc_fbsd" \
OBJCOPY="${XOBJCOPY}"
+
+.elif ${TARGET_ARCH:Mmips64*} != ""
+.if empty(TARGET_CPUTYPE)
+LIB32CPUFLAGS= -march=mips3
+.else
+LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
+.endif
+LIB32CPUFLAGS+= -mabi=32
+LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips
+.if ${TARGET_ARCH:Mmips64el*} != ""
+LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd"
+.else
+LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd"
+.endif
+LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}"
.endif
diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile
index 0d53c12c843c4..157495368c7e9 100644
--- a/gnu/lib/libgcc/Makefile
+++ b/gnu/lib/libgcc/Makefile
@@ -133,7 +133,8 @@ LIBADD+= compiler_rt
.if ${TARGET_CPUARCH} == mips
LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
# ABIs other than o32 need this
-.if ${TARGET_ARCH:Mmips64*} != "" || ${TARGET_ARCH:Mmipsn32*} != ""
+.if (${TARGET_ARCH:Mmips64*} != "" || ${TARGET_ARCH:Mmipsn32*} != "") && \
+ !defined(COMPAT_32BIT)
LIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c
LIB2FUNCS_EXTRA+= floatdisf.c floatundidf.c
LIB2FUNCS_EXTRA+= fixsfdi.c floatundisf.c
diff --git a/gnu/usr.bin/binutils/ld/Makefile.mips b/gnu/usr.bin/binutils/ld/Makefile.mips
index afc651cfca9d8..7ed3a56059f22 100644
--- a/gnu/usr.bin/binutils/ld/Makefile.mips
+++ b/gnu/usr.bin/binutils/ld/Makefile.mips
@@ -8,6 +8,7 @@ _EMULATION_ENDIAN=b
.if ${TARGET_ARCH:Mmips64*} != ""
NATIVE_EMULATION=elf64${_EMULATION_ENDIAN}tsmip_fbsd
+LIBSEARCHPATH.elf32${_EMULATION_ENDIAN}tsmip_fbsd=\"=/usr/lib32\"
.elif ${TARGET_ARCH:Mmipsn32*} != ""
NATIVE_EMULATION=elf32${_EMULATION_ENDIAN}tsmipn32_fbsd
.else
diff --git a/sys/mips/conf/MALTA64 b/sys/mips/conf/MALTA64
index c1f7d7ed1d4c4..73857547b15d3 100644
--- a/sys/mips/conf/MALTA64
+++ b/sys/mips/conf/MALTA64
@@ -11,3 +11,5 @@ machine mips mips64
makeoptions ARCH_FLAGS="-march=mips64 -mabi=64"
makeoptions KERNLOADADDR=0xffffffff80100000
+
+options COMPAT_FREEBSD32 # Compatible with o32 binaries