issue with clang and CPUTYPE native

Roman Divacky rdivacky at freebsd.org
Thu Dec 30 20:18:51 UTC 2010


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?


More information about the freebsd-toolchain mailing list