Date: Sun, 19 Apr 2015 10:33:33 -0700 From: Adrian Chadd <adrian@freebsd.org> To: "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org> Subject: compiling freebsd/mips on gcc-4.9.2 Message-ID: <CAJ-Vmomi6xpz7Bw_G%2B=LovZYRmAUZ8GWcGGbjs8tZAu5Wb3ObQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi, I've started evaluating the external toolchain support in -HEAD so I can evaluate getting it working on at least gcc-4.9.2. (I'm hoping that I can also use this with an external clang toolchain, but that's for later.) The TL;DR is this: * with the following patch, but minus the -Wa pieces, I get a booting kernel on mips32 platforms. I haven't yet tested the mips64 platforms. * however the assembler (binutils-2.25) complains thus: '{standard input}: Warning: .gnu_attribute 4,3 requires `softfloat'' * .. so if I add -Wa as in the patch it stops complaining, right until it compiles the fp emulation code, at which point it complains about undefined instructions. Which is totally correct - they're not defined with soft-float enabled. I'm going to work with bapt/kan over the next few days to get the port update and the mips32/mips64 ports into FreeBSD so others can start using this to build/debug kernel builds. I haven't yet started on userland builds; that'll come next. Thanks! -adrian adrian@lucy-11i386:~/work/freebsd/head-embedded/src % svn diff sys/conf/ Index: sys/conf/files.mips =================================================================== --- sys/conf/files.mips (revision 281125) +++ sys/conf/files.mips (working copy) @@ -61,6 +61,9 @@ libkern/memmove.c standard libkern/cmpdi2.c optional mips | mipsel libkern/ucmpdi2.c optional mips | mipsel +# required for gcc-4.9? +libkern/ashldi3.c standard +libkern/ashrdi3.c standard # cfe support dev/cfe/cfe_api.c optional cfe Index: sys/conf/kern.mk =================================================================== --- sys/conf/kern.mk (revision 281125) +++ sys/conf/kern.mk (working copy) @@ -150,7 +150,7 @@ # For MIPS we also tell gcc to use floating point emulation # .if ${MACHINE_CPUARCH} == "mips" -CFLAGS+= -msoft-float +CFLAGS+= -msoft-float -Wa,-msoft-float INLINE_LIMIT?= 8000 .endif Index: sys/conf/kmod.mk =================================================================== --- sys/conf/kmod.mk (revision 281125) +++ sys/conf/kmod.mk (working copy) @@ -134,8 +134,17 @@ .if ${MACHINE_CPUARCH} == mips CFLAGS+= -G0 -fno-pic -mno-abicalls -mlong-calls +CFLAGS+= -msoft-float -Wa,-msoft-float .endif +.if ${MACHINE_ARCH} == mips || ${MACHINE_ARCH} == mipsel +CFLAGS+= -march=mips32 +.endif + +.if ${MACHINE_ARCH} == mips64 || ${MACHINE_ARCH} == mips64el +CFLAGS+= -march=mips64 +.endif + .if defined(DEBUG) || defined(DEBUG_FLAGS) CTFFLAGS+= -g .endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmomi6xpz7Bw_G%2B=LovZYRmAUZ8GWcGGbjs8tZAu5Wb3ObQ>