Booted clang-built FreeBSD/mips64 in qemu today

John Baldwin jhb at freebsd.org
Wed Aug 23 20:52:47 UTC 2017


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 <machine/regnum.h> 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


More information about the freebsd-mips mailing list