From owner-freebsd-mips@freebsd.org Wed Aug 23 20:52:46 2017 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0A5CDEEC56 for ; Wed, 23 Aug 2017 20:52:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB36781808; Wed, 23 Aug 2017 20:52:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 6BEBC10AF0F; Wed, 23 Aug 2017 16:52:45 -0400 (EDT) From: John Baldwin To: FreeBSD mips Cc: dim@freebsd.org Subject: Booted clang-built FreeBSD/mips64 in qemu today Date: Wed, 23 Aug 2017 13:25:54 -0700 Message-ID: <2649255.q7UPx3PEXm@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 23 Aug 2017 16:52:45 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 20:52:47 -0000 FYI, using patches in my 'mips_xbuild' branch on github (https://github.com/freebsd/freebsd/compare/master...bsdjhb:mips_xbuild) I was able to build a mips64 kernel + world with the in-tree clang in HEAD and boot it under qemu. A few limitations are: 1) I had to use external ld.bfd because the in-tree ld.bfd doesn't support multiple GOT sections and isn't able to link rescue 2) lldb doesn't compile on MIPS currently because it has some templates that use 'class A0, class A1, etc.' and the #define's for registers A0 and A1 in wreak havoc on those 3) I had to build with TARGET_CPUTYPE=mips4. One of my patches changes the default -march= for FreeBSD/mips on clang to use mips3 (which should match what in-tree GCC does), but I got a compiler crash that I haven't sat down to debug/reproduce. I'm currently building o32 kernel + world to test those. The installed system still includes the old GPlv2 ld.bfd and can compile binaries using /usr/bin/cc (clang) so long as -integrated-as is specified. (I don't yet have a patch for clang to default to -integrated-as for FreeBSD/mips64 but we should do that eventually.) At some point I will also test N32. The last time I tried to run N32 (probably around 6 months or so ago) under qemu compiled with either in-tree or external GCC it got stuck in an infinite loop inside of init until init exhausted its stack and crashed, so that needs to be debugged first before trying clang for N32. -- John Baldwin