From owner-freebsd-current@FreeBSD.ORG Sat Sep 17 03:34:41 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 4433B106564A for ; Sat, 17 Sep 2011 03:34:41 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 160C58FC13 for ; Sat, 17 Sep 2011 03:34:40 +0000 (UTC) Received: by iadk27 with SMTP id k27so4795701iad.13 for ; Fri, 16 Sep 2011 20:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=AaGh8ZFsLdJlxbSi8UY/9bEZUhpI3amQopIIZkqe770=; b=vLZHSLD+OgxQEWWvT1Jx33sk8mOAnRCGVZ8n5KUFmhfc8163luC1xu7y8ImvtBPybK uzKM70BrwMf0Hc5Mua0+1wBx4c9eK5iE2bzRBBA5HnQ8zOQpzrYGgE6rUR40tcEXBEb2 Smnyk/kZPUNzkm1PARqz6In5brTxl5WUH4qyc= MIME-Version: 1.0 Received: by 10.42.130.72 with SMTP id u8mr264699ics.37.1316230480321; Fri, 16 Sep 2011 20:34:40 -0700 (PDT) Received: by 10.43.45.137 with HTTP; Fri, 16 Sep 2011 20:34:40 -0700 (PDT) Date: Fri, 16 Sep 2011 22:34:40 -0500 Message-ID: From: Jason Harmening To: freebsd-current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Mailman-Approved-At: Sat, 17 Sep 2011 03:54:45 +0000 Subject: 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 03:34:41 -0000 Hi everyone, 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: (gdb) bt #0 tw_collect (command=dwarf2_read_address: Corrupted DWARF expression.) at /usr/src/bin/csh/../../contrib/tcsh/tw.parse.c:1308 #1 0x000000000042777b in t_search (word=Unhandled dwarf expression opcode 0x0) at /usr/src/bin/csh/../../contrib/tcsh/tw.parse.c:1725 #2 0x0000000000426829 in tenematch (inputline=Variable "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=Variable "wanteof" is not available.) at /usr/src/bin/csh/../../contrib/tcsh/sh.lex.c:1653 #5 0x0000000000416f37 in lex (hp=Variable "hp" is not available.) at /usr/src/bin/csh/../../contrib/tcsh/sh.lex.c:162 #6 0x0000000000405afb in process (catch=Unhandled dwarf expression opcode 0x0) at /usr/src/bin/csh/../../contrib/tcsh/sh.c:1922 #7 0x0000000000404b51 in main (argc=Variable "argc" is not available.) at /usr/src/bin/csh/../../contrib/tcsh/sh.c:1289 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 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 . 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. I'm using march=corei7 and -O2 for both world and kernel, but using march=nocona or just leaving out CPUTYPE has no effect (actual CPU is Nehalem Xeon 5520) Here's the relevant part of make.conf for completeness: .if !defined(CC) || ${CC} == "cc" CC=clang .endif .if !defined(CXX) || ${CXX} == "c++" CXX=clang++ .endif .if !defined(CPP) || ${CPP} == "cpp" CPP=clang -E .endif NO_WERROR= WERROR= NO_FSCHG= CPUTYPE?=corei7 CFLAGS= -O2 -pipe COPTFLAGS= -O2 -pipe Any thoughts? Is there some simple fix for this I'm missing? Thanks, Jason