From owner-freebsd-sparc64@FreeBSD.ORG Mon Sep 29 04:18:17 2014 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E6C79966; Mon, 29 Sep 2014 04:18:16 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BB7DE619; Mon, 29 Sep 2014 04:18:16 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s8T4IFEf016474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 28 Sep 2014 21:18:16 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s8T4IFEb016473; Sun, 28 Sep 2014 21:18:15 -0700 (PDT) (envelope-from jmg) Date: Sun, 28 Sep 2014 21:18:15 -0700 From: John-Mark Gurney To: =?iso-8859-1?Q?Jean-S=E9bastien_P=E9dron?= Subject: Re: Playing with HEAD/sparc64 and clang Message-ID: <20140929041815.GI43300@funkthat.com> Mail-Followup-To: =?iso-8859-1?Q?Jean-S=E9bastien_P=E9dron?= , freebsd-sparc64@freebsd.org References: <54146A9E.4070800@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54146A9E.4070800@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sun, 28 Sep 2014 21:18:16 -0700 (PDT) Cc: freebsd-sparc64@freebsd.org X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Sep 2014 04:18:17 -0000 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."