Date: Fri, 31 Dec 2010 19:08:38 +0000 From: Alexander Best <arundel@freebsd.org> To: Roman Divacky <rdivacky@freebsd.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: issue with clang and CPUTYPE native Message-ID: <20101231190838.GA85678@freebsd.org> In-Reply-To: <20101231180054.GA77781@freebsd.org> References: <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> <20101231151554.GA29782@freebsd.org> <20101231180054.GA77781@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri Dec 31 10, Alexander Best wrote: > On Fri Dec 31 10, Roman Divacky wrote: > > 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. > > i'm sorry. you're of course right. looking at the manual page of a newer gcc > release reveals that core2 is in fact the correct cpu. > > what i did now was to clean out my src.conf and make.conf and run buildworld > with gcc and with clang. > > you can see the results in the attached file in addition to the contents of my > src.conf and make.conf > > right now i'm trying to repeat the tests with cpu set to core2 and nocona. > > cheers. > alex > > > > > 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 i've just tried building world with CUPTYPE ?= nocona and got the same result: gcc succeeds; clang fails. the error message however is not the one i was refering to earlier. the reason i get a different error message seems to be the fact that i got rid of most of the WITHOUT_* optins in src.conf. so there are at least two issues with clang, where it fails in cases gcc succeeds. i'm doing another final buildworld with CPUTYPE ?= core2, but i suspect the result will be the same. cheers. alex > > -- > a13x > grep -v "^#" /etc/make.conf /etc/src.conf: > > /etc/make.conf:KERNCONF = ARUNDEL > /etc/make.conf:MODULES_OVERRIDE = \ > /etc/make.conf:netgraph/netgraph \ > /etc/make.conf:netgraph/socket netgraph/bluetooth/bluetooth netgraph/bluetooth/hci \ > /etc/make.conf:netgraph/bluetooth/l2cap netgraph/bluetooth/socket netgraph/bluetooth/ubt \ > /etc/make.conf:linux tmpfs sound/sound sound/driver/hda usb/uhid \ > /etc/make.conf:procfs pseudofs linprocfs linsysfs lindev usb/quirk geom > /etc/make.conf: > /etc/make.conf: > /etc/make.conf:CPUTYPE ?= native > /etc/make.conf: > /etc/make.conf:SENDMAIL_MC = /etc/mail/freebsd.mc > /etc/make.conf:SENDMAIL_SUBMIT_MC = /etc/mail/freebsd.submit.mc > /etc/make.conf: > /etc/make.conf:OVERRIDE_LINUX_BASE_PORT = f10 > /etc/make.conf:OVERRIDE_LINUX_NONBASE_PORTS = f10 > /etc/make.conf:DA4 = yes > /etc/make.conf:WITH_BSDEL = yes > /etc/make.conf:WITH_256_COLOR = yes > /etc/make.conf: > /etc/make.conf:PERL_VERSION=5.12.2 > /etc/src.conf: > /etc/src.conf:DEBUG_FLAGS = -g > /etc/src.conf: > /etc/src.conf:WITHOUT_PROFILE=true > /etc/src.conf:WITHOUT_CDDL=true > /etc/src.conf:WITHOUT_ATM=true > > make buildworld: > > ==> SUCCEEDS! > > grep -v "^#" /etc/make.conf /etc/src.conf: > > /etc/make.conf:KERNCONF = ARUNDEL > /etc/make.conf:MODULES_OVERRIDE = \ > /etc/make.conf:netgraph/netgraph \ > /etc/make.conf:netgraph/socket netgraph/bluetooth/bluetooth netgraph/bluetooth/hci \ > /etc/make.conf:netgraph/bluetooth/l2cap netgraph/bluetooth/socket netgraph/bluetooth/ubt \ > /etc/make.conf:linux tmpfs sound/sound sound/driver/hda usb/uhid \ > /etc/make.conf:procfs pseudofs linprocfs linsysfs lindev usb/quirk geom > /etc/make.conf: > /etc/make.conf: > /etc/make.conf:CPUTYPE ?= native > /etc/make.conf: > /etc/make.conf:SENDMAIL_MC = /etc/mail/freebsd.mc > /etc/make.conf:SENDMAIL_SUBMIT_MC = /etc/mail/freebsd.submit.mc > /etc/make.conf: > /etc/make.conf:OVERRIDE_LINUX_BASE_PORT = f10 > /etc/make.conf:OVERRIDE_LINUX_NONBASE_PORTS = f10 > /etc/make.conf:DA4 = yes > /etc/make.conf:WITH_BSDEL = yes > /etc/make.conf:WITH_256_COLOR = yes > /etc/make.conf: > /etc/make.conf:PERL_VERSION=5.12.2 > /etc/src.conf:.if !defined(CC) || ${CC} == "cc" > /etc/src.conf:CC=clang > /etc/src.conf:.endif > /etc/src.conf:.if !defined(CXX) || ${CXX} == "c++" > /etc/src.conf:CXX=clang++ > /etc/src.conf:.endif > /etc/src.conf:NO_WERROR= > /etc/src.conf:WERROR= > /etc/src.conf: > /etc/src.conf:DEBUG_FLAGS = -g > /etc/src.conf: > /etc/src.conf:WITHOUT_PROFILE=true > /etc/src.conf:WITHOUT_CDDL=true > /etc/src.conf:WITHOUT_ATM=true > > make buildworld: > > ==> FAILS! > > clang -O2 -pipe -march=native -fpic -fvisibility=hidden -DVISIBILITY_HIDDEN -g -std=gnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -c /usr/subversion-src/lib/libcompiler_rt/../../contrib/compiler-rt/lib/mulvti3.c > detected CPU = core2 > Assertion failed: (getMinSignedBits() <= 64 && "Too many bits for int64_t"), function getSExtValue, file /usr/subversion-src/lib/clang/libclangcodegen/../../../contrib/llvm/include/llvm/ADT/APInt.h, line 1149. > Stack dump: > 0. Program arguments: /usr/obj/usr/subversion-src/tmp/usr/bin/clang -cc1 -triple x86_64-undermydesk-freebsd9.0 -S -disable-free -main-file-name mulvti3.c -pic-level 1 -mdisable-fp-elim -mconstructor-aliases -munwind-tables -target-cpu core2 -g -resource-dir /usr/obj/usr/subversion-src/tmp/usr/lib/clang/2.8 -D VISIBILITY_HIDDEN -O2 -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -std=gnu99 -ferror-limit 19 -fmessage-length 275 -fvisibility hidden -stack-protector 1 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-G6mPQL.s -x c /usr/subversion-src/lib/libcompiler_rt/../../contrib/compiler-rt/lib/mulvti3.c > 1. <eof> parser at end of file > 2. Code generation > clang: error: clang frontend command failed due to signal 6 (use -v to see invocation) > *** Error code 250 > > Stop in /usr/subversion-src/lib/libcompiler_rt. > *** Error code 1 > > Stop in /usr/subversion-src. > *** Error code 1 > > Stop in /usr/subversion-src. > *** Error code 1 > > Stop in /usr/subversion-src. > *** Error code 1 > > Stop in /usr/subversion-src. -- a13x
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101231190838.GA85678>