Index: Makefile.inc1 =================================================================== --- Makefile.inc1 +++ Makefile.inc1 @@ -606,7 +606,7 @@ .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" Index: Makefile.libcompat =================================================================== --- Makefile.libcompat +++ Makefile.libcompat @@ -4,16 +4,15 @@ __<${_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 .if ${TARGET_ARCH} == "amd64" .if empty(TARGET_CPUTYPE) -LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 +LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 -m32 .else -LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} +LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} -m32 .endif LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ MACHINE_CPU="i686 mmx sse sse2" @@ -24,18 +23,32 @@ .elif ${TARGET_ARCH} == "powerpc64" .if empty(TARGET_CPUTYPE) -LIB32CPUFLAGS= -mcpu=powerpc +LIB32CPUFLAGS= -mcpu=powerpc -m32 .else -LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} +LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} -m32 .endif 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 -mabi=32 +.else +LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} -mabi=32 +.endif +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 -LIB32CFLAGS= -m32 -DCOMPAT_32BIT +LIB32CFLAGS= -DCOMPAT_32BIT LIB32DTRACE= ${DTRACE} -32 LIB32WMAKEFLAGS+= -DCOMPAT_32BIT Index: gnu/lib/libgcc/Makefile =================================================================== --- gnu/lib/libgcc/Makefile +++ gnu/lib/libgcc/Makefile @@ -133,7 +133,8 @@ .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 Index: gnu/usr.bin/binutils/ld/Makefile.mips =================================================================== --- gnu/usr.bin/binutils/ld/Makefile.mips +++ gnu/usr.bin/binutils/ld/Makefile.mips @@ -8,6 +8,7 @@ .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 Index: sys/mips/conf/MALTA64 =================================================================== --- sys/mips/conf/MALTA64 +++ sys/mips/conf/MALTA64 @@ -11,3 +11,5 @@ makeoptions ARCH_FLAGS="-march=mips64 -mabi=64" makeoptions KERNLOADADDR=0xffffffff80100000 + +options COMPAT_FREEBSD32 # Compatible with o32 binaries