Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Sep 2014 21:18:15 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        =?iso-8859-1?Q?Jean-S=E9bastien_P=E9dron?= <dumbbell@freebsd.org>
Cc:        freebsd-sparc64@freebsd.org
Subject:   Re: Playing with HEAD/sparc64 and clang
Message-ID:  <20140929041815.GI43300@funkthat.com>
In-Reply-To: <54146A9E.4070800@FreeBSD.org>
References:  <54146A9E.4070800@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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_BOOTSTRAP=y
>     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:
> https://people.freebsd.org/~dumbbell/sparc64/freebsd-ultra60-dmesg.txt
> 
> 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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140929041815.GI43300>