Playing with HEAD/sparc64 and clang

Jean-Sébastien Pédron <[email protected]>
Newsgroups gmane.os.freebsd.devel.sparc
Message-ID <[email protected]>
Hi!

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.

== 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 :)

[1]
https://lists.freebsd.org/pipermail/freebsd-sparc64/2014-February/009233.html

-- 
Jean-Sébastien Pédron
signature.asc (application/pgp-signature, 949 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQJ8BAEBCgBmBQJUFGqnXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NzA4N0ZEMUFFQUUwRTEyREJDNkE2RjAz
OUU5OTc2MUE1RkQ5NENDAAoJEDnpl2Gl/ZTMnikQAMiPv83O2F/j4q3qTTMj6PD7
paXHaPYayYCaVJp/FqiDHLI5xszryv+MzTR0WkvE2dTEcmPjGd9lMYme/mbrPmgb
BnMh9EIqrZSgwhXNkc3sHFkYmzcErbOCxc9xeGZmmeyIchBD53WVD56ln8NKRH/F
udO9Vd1Z+lWg3lMw54jk+hJXOIH41RwLbBqO4m+hmVedCZFwDVuoTbUuSrbL0JKy
aYBdziQ9uxc/tMrxIdKt+XUoZSv07f4sOUW4m5ikcRxI15abF7rW/+6SHgTn1S9h
JJK+hR/oMmP03tVfyzbaTYNiErPoGBkuSVhmdzQxQxxoKvXVGV7u/3e0sO3duiLh
pMoWamoVjyk55fBxJJ70HQol6L88JiNXeckoKh4gU7XiHZAHGuabezq9+Pa8cxgr
RgsOYWWNSOuPVJKba2cn2bytEzil8mfnM+vvlC5RKlGam9T/4ctCWSmulBZ7zqLk
kxDUOY5wyBHgw1fgzLhTK/iCGpxEaciC8VcJQc0DPXgz71C1ggavY1cLqTvNBUSk
aXYlZ9VQWWmJ7ygVwFqGyqrl5dqAk63sWhr1HsXFsirE8UctzbK13kp5YuHWbkgH
El5U5fVbZfAKHhJEXP+r9gEoz3YoiEZFl19GeK6M8UJ19nOMQmto315WqZKbI7ST
ofhBppPDW+QzUUYLFgqS
=c7Jx
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.