From owner-freebsd-mips@FreeBSD.ORG Sun Apr 19 17:33:34 2015 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 64A4C8DE for ; Sun, 19 Apr 2015 17:33:34 +0000 (UTC) Received: from mail-ie0-x232.google.com (mail-ie0-x232.google.com [IPv6:2607:f8b0:4001:c03::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 320366D2 for ; Sun, 19 Apr 2015 17:33:34 +0000 (UTC) Received: by iecrt8 with SMTP id rt8so89560049iec.0 for ; Sun, 19 Apr 2015 10:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=VSEjDdWJtjrZOg9Ohffn5qbvb2ABopJU7XeiDRh0KpY=; b=Vv8/y4AWn6PNsBcgg/8lA13zbfW1X5KFONYIAnhepy+E2xju1K+cB8dZ8rQKC3zjIN utSoVyFX8IKsu0BOjAJgu6d+nt14Eld5nSjlfEonWxrmvBmGxRLGvEWKPs4ScuTH0mz5 YEZa660P/jV4IPXNDKb5vbzzBsQSGtvTtLe+RsoA/OConi73PEFq/vUM+8kg+CknUopG q92yXs0Raz187bV3on6MZGY4a0CbFlf4CmvZoHLL52suW7KUMJgQ/mLOd8vpI2a9N7ey VH39UBMCFC7RRzeQ6fXkvyw5GLaUdEsGAT+4eYFpQ9g4WVw55WdK7oLARBRXfxGSt3xm jDug== MIME-Version: 1.0 X-Received: by 10.50.97.105 with SMTP id dz9mr15886316igb.49.1429464813449; Sun, 19 Apr 2015 10:33:33 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.17.194 with HTTP; Sun, 19 Apr 2015 10:33:33 -0700 (PDT) Date: Sun, 19 Apr 2015 10:33:33 -0700 X-Google-Sender-Auth: Xh6OVAj_FhJULk2dgbL1dwMUaCs Message-ID: Subject: compiling freebsd/mips on gcc-4.9.2 From: Adrian Chadd To: "freebsd-mips@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2015 17:33:34 -0000 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