From owner-freebsd-current@FreeBSD.ORG Sat Sep 17 09:02:44 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08A2A106566B for ; Sat, 17 Sep 2011 09:02:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 9D0B38FC1E for ; Sat, 17 Sep 2011 09:02:43 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p8H92dY0007681 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 17 Sep 2011 12:02:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id p8H92dxk071814; Sat, 17 Sep 2011 12:02:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id p8H92dKK071813; Sat, 17 Sep 2011 12:02:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 17 Sep 2011 12:02:39 +0300 From: Kostik Belousov To: Jason Harmening Message-ID: <20110917090239.GM1511@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MsEL38XAg4rx1uDx" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-current@freebsd.org Subject: Re: Crashes in world built w/ clang: FP registers? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2011 09:02:44 -0000 --MsEL38XAg4rx1uDx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 16, 2011 at 10:34:40PM -0500, Jason Harmening wrote: > Hi everyone, >=20 > Using clang as the default compiler, the kernel and drivers will work > fine, but a lot of programs in the base system and ports will crash w/ > SIGBUS. In fact, so much of the stuff in the chroot'ed world will > crash (everything from csh to gcc) that it's basically unusable. I > finally got around to building w/ debug symbols, and ran gdb on a > coredump generated while I was trying to use tab completion in csh: >=20 > (gdb) bt > #0 tw_collect (command=3Ddwarf2_read_address: Corrupted DWARF expression= .) > at /usr/src/bin/csh/../../contrib/tcsh/tw.parse.c:1308 > #1 0x000000000042777b in t_search (word=3DUnhandled dwarf expression opc= ode 0x0) > at /usr/src/bin/csh/../../contrib/tcsh/tw.parse.c:1725 > #2 0x0000000000426829 in tenematch (inputline=3DVariable "inputline" is > not avail able.) > at /usr/src/bin/csh/../../contrib/tcsh/tw.parse.c:301 > #3 0x000000000043545d in Inputl () > at /usr/src/bin/csh/../../contrib/tcsh/ed.inputl.c:415 > #4 0x0000000000417a90 in readc (wanteof=3DVariable "wanteof" is not avai= lable.) > at /usr/src/bin/csh/../../contrib/tcsh/sh.lex.c:1653 > #5 0x0000000000416f37 in lex (hp=3DVariable "hp" is not available.) > at /usr/src/bin/csh/../../contrib/tcsh/sh.lex.c:162 > #6 0x0000000000405afb in process (catch=3DUnhandled dwarf expression opc= ode 0x0) > at /usr/src/bin/csh/../../contrib/tcsh/sh.c:1922 > #7 0x0000000000404b51 in main (argc=3DVariable "argc" is not available.) > at /usr/src/bin/csh/../../contrib/tcsh/sh.c:1289 >=20 > gdb) disas > Dump of assembler code for function tw_collect: > 0x00000000004288b0 : push %rbp > 0x00000000004288b1 : mov %rsp,%rbp > 0x00000000004288b4 : push %r15 > 0x00000000004288b6 : push %r14 > 0x00000000004288b8 : push %r13 > 0x00000000004288ba : push %r12 > 0x00000000004288bc : push %rbx > 0x00000000004288bd : sub $0x2e8,%rsp > 0x00000000004288c4 : mov %r9,-0x308(%rbp) > 0x00000000004288cb : mov %r8,-0x300(%rbp) > 0x00000000004288d2 : mov %rcx,-0x2f8(%rbp) > 0x00000000004288d9 : mov %rdx,-0x2f0(%rbp) > 0x00000000004288e0 : mov %esi,-0x2e8(%rbp) > 0x00000000004288e6 : mov %edi,-0x2e4(%rbp) > 0x00000000004288ec : movl $0x0,-0x1d4(%rbp) > 0x00000000004288f6 : movaps 0x23115b(%rip),%xmm0 > # 0x6 59a58 > This is actually 0x659a58 movaps tried to load %xmm0 from the unaligned address, which is forbidden and causes #GP. I have no idea why clang generates unaligned loads. > 0x00000000004288fd : lea -0x2(%rdi),%eax > 0x0000000000428900 : mov %eax,-0x2e0(%rbp) > 0x0000000000428906 : test %edi,%edi > 0x0000000000428908 : movaps %xmm0,-0x210(%rbp) > 0x000000000042890f : sete %al > ---Type to continue, or q to quit---q > Quit > (gdb) info line tw.parse.c:1308 > Line 1308 of "/usr/src/bin/csh/../../contrib/tcsh/tw.parse.c" > starts at address 0x4288f6 > and ends at 0x4288fd . >=20 >=20 > Looks like it's crashing as soon as it tries to use the XMM registers. > I'm not sure if all of the crashes I'm getting are like this one, but > I was surprised to see FP registers in code like this. >=20 > I'm using march=3Dcorei7 and -O2 for both world and kernel, but using > march=3Dnocona or just leaving out CPUTYPE has no effect (actual CPU is > Nehalem Xeon 5520) > Here's the relevant part of make.conf for completeness: >=20 > .if !defined(CC) || ${CC} =3D=3D "cc" > CC=3Dclang > .endif > .if !defined(CXX) || ${CXX} =3D=3D "c++" > CXX=3Dclang++ > .endif > .if !defined(CPP) || ${CPP} =3D=3D "cpp" > CPP=3Dclang -E > .endif > NO_WERROR=3D > WERROR=3D > NO_FSCHG=3D > CPUTYPE?=3Dcorei7 > CFLAGS=3D -O2 -pipe > COPTFLAGS=3D -O2 -pipe >=20 > Any thoughts? Is there some simple fix for this I'm missing? >=20 > Thanks, > Jason > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" --MsEL38XAg4rx1uDx Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk50Yi4ACgkQC3+MBN1Mb4jnNgCgpBiXskn8RH3UCkqhhbfRpXWF jCUAoOXBsEHWyvWngYOWwabuRw4JCq3O =3kSW -----END PGP SIGNATURE----- --MsEL38XAg4rx1uDx--