Playing with HEAD/sparc64 and clang

John-Mark Gurney jmg at
Mon Sep 29 04:18:17 UTC 2014

Jean-Sbastien Pdron wrote this message on Sat, Sep 13, 2014 at 18:02 +0200:
> With the help of Roman Divacky, I started to play with clang on sparc64.
> The build of the kernel and world completes (though, I use a patch to
> pcpu.h provided by Roman). However, the loader fail to load the kernel,
> and I'm not sure the world binaries are correct.
> == Compilation ==
> First, I cross-build kernel and world on an amd64 computer. The source
> tree is at r271475. Here are the variables I set in the environment:
>     export MAKEOBJDIRPREFIX=$(pwd)
>     export TARGET=sparc64
>     export TARGET_ARCH=sparc64
>     export WITH_CLANG=y
>     export WITH_CLANG_IS_CC=y
>     export WITH_LIBCPLUSPLUS=y
> Compared to mail sent by Dimitry Andric in last February [1], I added
> WITH_CLANG_BOOTSTRAP. Otherwise, clang isn't build early enough and the
> host compiler is used (producing amd64 binaries).
> == Kernel ==
> When I boot the kernel built with clang, I get:
>     jumping to kernel entry at 0xc00a8000
>     Data Access Exception
> Then, I'm left at the OpenBoot prompt.

If you could figure out what the address is here, that'd be good..  I'm
not sure what the best way to debug this is...  But adding printfs
early in boot and seeing where it stops would help...  Then we could
look at the assmebly to figure out if it's a compiler issue or not...

It may be easier to debug the userland below first as the bugs fixed
there will probably equally apply to the kernel...

> == World ==
> I install world in an alternate directory.
> When I run bin/sh from that directory, it works.
> When I set LD_LIBRARY_PATH to point to $directory/lib and run bin/sh, it
> works.
> When I run "chroot $directory /bin/sh", I get:
>     Illegal instruction
> The computer is a Sun Ultra60 with dual UltraSPARC II 450 MHz. Its dmesg
> is here:
> I'm ready to provide any information required and test patches :)

If you run the /bin/sh in gdb, and figure out what the illegal instruction
and post a disassembly of it, I can take a look at it...

  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."

More information about the freebsd-sparc64 mailing list