From owner-freebsd-toolchain@FreeBSD.ORG Fri Dec 31 15:15:58 2010 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8168B106566C; Fri, 31 Dec 2010 15:15:58 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (lev.vlakno.cz [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 0E42B8FC12; Fri, 31 Dec 2010 15:15:57 +0000 (UTC) Received: from lev.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 9E7249CB065; Fri, 31 Dec 2010 16:15:55 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by lev.vlakno.cz (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dAqiF10K1ILj; Fri, 31 Dec 2010 16:15:55 +0100 (CET) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id E8BBC9CB252; Fri, 31 Dec 2010 16:15:54 +0100 (CET) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.4/8.14.4/Submit) id oBVFFsjJ030354; Fri, 31 Dec 2010 16:15:54 +0100 (CET) (envelope-from rdivacky) Date: Fri, 31 Dec 2010 16:15:54 +0100 From: Roman Divacky To: Alexander Best Message-ID: <20101231151554.GA29782@freebsd.org> References: <20101227213559.GA53178@freebsd.org> <20101228142203.GA69674@freebsd.org> <20101230002033.GA23583@freebsd.org> <20101230081445.GA99446@freebsd.org> <20101230184048.GA34628@freebsd.org> <20101230184442.GA79735@freebsd.org> <20101230184616.GA35433@freebsd.org> <20101230201848.GA92145@freebsd.org> <20101231012002.GA73736@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101231012002.GA73736@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: freebsd-toolchain@freebsd.org Subject: Re: issue with clang and CPUTYPE native X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2010 15:15:58 -0000 On Fri, Dec 31, 2010 at 01:20:02AM +0000, Alexander Best wrote: > On Thu Dec 30 10, Roman Divacky wrote: > > On Thu, Dec 30, 2010 at 06:46:16PM +0000, Alexander Best wrote: > > > On Thu Dec 30 10, Roman Divacky wrote: > > > > On Thu, Dec 30, 2010 at 06:40:48PM +0000, Alexander Best wrote: > > > > > On Thu Dec 30 10, Roman Divacky wrote: > > > > > > On Thu, Dec 30, 2010 at 12:20:33AM +0000, Alexander Best wrote: > > > > > > > On Tue Dec 28 10, Roman Divacky wrote: > > > > > > > > -march=native in clang works by detecting CPU name > > > > > > > > and passing it (if found) to llvm. if the CPU is not > > > > > > > > detected nothing is passed. > > > > > > > > > > > > > > > > nocona is supported > > > > > > > > > > > > > > > > ie. leaving the CPUNAME empty or specifying it to "nocona" should > > > > > > > > be equivalent to setting it to "native". > > > > > > > > > > > > > > > > > > > > > > > > can you apply this patch: > > > > > > > > > > > > > > > > Index: Driver/Tools.cpp > > > > > > > > =================================================================== > > > > > > > > --- Driver/Tools.cpp (revision 122591) > > > > > > > > +++ Driver/Tools.cpp (working copy) > > > > > > > > @@ -684,6 +684,7 @@ > > > > > > > > // FIXME: We should also incorporate the detected target features for use > > > > > > > > // with -native. > > > > > > > > std::string CPU = llvm::sys::getHostCPUName(); > > > > > > > > + llvm::outs() << "detected CPU = " << CPU << "\n"; > > > > > > > > if (!CPU.empty()) > > > > > > > > CPUName = Args.MakeArgString(CPU); > > > > > > > > } else > > > > > > > > > > > > > > thanks a lot for the patch. i've applied it, but am not sure how to only > > > > > > > compile clang. 'make' in usr.bin/clang fails. do i have to run target > > > > > > > buildworld or is there a way to only build clang? > > > > > > > > > > > > I would guess that cd lib/clang && make && cd ../../usr.bin/clang && make > > > > > > should work, if not - full buildworld is necessary I guess > > > > > > > > > > thanks. that worked. this is what clang detects as my cpu: > > > > > > > > > > -march=native > > > > > > > > hm? are you sure it wrote -march=native? it should have written > > > > > > oh sorry. i copy&pasted the wrong line. :( > > > > > > detected CPU = core2 > > > > yes, you have core2, maybe thats why using CPU=nocona is causing you problems? > > CPU=nocona *isn't* causing problems. CPU=native is causing the problems. > > core2 is wrong imo. have a look at share/mk/bsd.cpu.mk for amd64. it sets core2 > to nocona. so clang should detect nocona for CPU=native and *not* core2. no, your cpu is core2 so clang is correct to detect is as such. it's imho irrelevant that we (freebsd mk framework) reset core2 to nocona. the reason for that is imho that gcc 4.2.1 does not support core2 so we "downgrade" that to nocona. > however i'll try to run buildworld again with the patched clang to completely > pinpoint the problem. yes please, it's going to be interesting to see what is the exact problem