Date: Sat, 17 Sep 2011 12:02:39 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Jason Harmening <jason.harmening@gmail.com> Cc: freebsd-current@freebsd.org Subject: Re: Crashes in world built w/ clang: FP registers? Message-ID: <20110917090239.GM1511@deviant.kiev.zoral.com.ua> In-Reply-To: <CAM=8qan5K6025J5oBT25s4fz9YgT15mp5SpNsEdzR0Fw%2BHVwig@mail.gmail.com> References: <CAM=8qan5K6025J5oBT25s4fz9YgT15mp5SpNsEdzR0Fw%2BHVwig@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <tw_collect+0>: push %rbp > 0x00000000004288b1 <tw_collect+1>: mov %rsp,%rbp > 0x00000000004288b4 <tw_collect+4>: push %r15 > 0x00000000004288b6 <tw_collect+6>: push %r14 > 0x00000000004288b8 <tw_collect+8>: push %r13 > 0x00000000004288ba <tw_collect+10>: push %r12 > 0x00000000004288bc <tw_collect+12>: push %rbx > 0x00000000004288bd <tw_collect+13>: sub $0x2e8,%rsp > 0x00000000004288c4 <tw_collect+20>: mov %r9,-0x308(%rbp) > 0x00000000004288cb <tw_collect+27>: mov %r8,-0x300(%rbp) > 0x00000000004288d2 <tw_collect+34>: mov %rcx,-0x2f8(%rbp) > 0x00000000004288d9 <tw_collect+41>: mov %rdx,-0x2f0(%rbp) > 0x00000000004288e0 <tw_collect+48>: mov %esi,-0x2e8(%rbp) > 0x00000000004288e6 <tw_collect+54>: mov %edi,-0x2e4(%rbp) > 0x00000000004288ec <tw_collect+60>: movl $0x0,-0x1d4(%rbp) > 0x00000000004288f6 <tw_collect+70>: movaps 0x23115b(%rip),%xmm0 > # 0x6 59a58 > <reslab+48> This is actually 0x659a58 <reslab+48> 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 <tw_collect+77>: lea -0x2(%rdi),%eax > 0x0000000000428900 <tw_collect+80>: mov %eax,-0x2e0(%rbp) > 0x0000000000428906 <tw_collect+86>: test %edi,%edi > 0x0000000000428908 <tw_collect+88>: movaps %xmm0,-0x210(%rbp) > 0x000000000042890f <tw_collect+95>: sete %al > ---Type <return> to continue, or q <return> 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 <tw_collect+70> > and ends at 0x4288fd <tw_collect+77>. >=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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110917090239.GM1511>