On Jun 21, 2011, at 3:31 PM, Damjan Marion wrote: > > On Jun 21, 2011, at 7:06 PM, Warner Losh wrote: >> >> On Jun 21, 2011, at 3:12 AM, Damjan Marion wrote: >>> >>> On Jun 17, 2011, at 9:16 PM, Warner Losh wrote: >>>> >>>> How it normally works is that we build a compiler that invokes the right >>>> as, ld, etc for the architecture in question. Clang is clearly broken >>>> here in assuming that as can cope with anything other than native >>>> assembler :) We normally either build gcc that knows where to find these >>>> files. In the buildworld case, this is communicate with weird paths and >>>> shell variables. With the whole 'xdev' series of targets (which are >>>> instructive to look at), we build into a specific location >>>> /usr/freebsd-xdev-arm/bin, etc). >>>> >>>> It works by accident for i386 on amd64, I think. as treats the more or >>>> less as the same. >>> >>> I submitted a patch[1] to clang mailer which invokes xxx-yyy-zzz-as/ld >>> based on -ccc-host-triple. Patch is copy of netbsd code which is already in >>> clang. >>> >>> For me it works well, even when I use clang on Darwin host, it calls proper >>> as/ld. >>> >>> # /opt/llvm/bin/clang -ccc-host-triple arm-unknown-freebsd -mfloat-abi=soft >>> test.c -o test -v -c >>> clang version 3.0 (http://llvm.org/git/clang.git >>> 98138cdfdee05c0afbab2b209ce8cfe4a52474e1) >>> Target: arm-unknown-freebsd >>> Thread model: posix >>> [snip] >>> End of search list. >>> "/opt/llvm/bin/arm-unknown-freebsd-as" -o test >>> /var/folders/kb/kbDaYaFqFQaCg3mXbTLH5U+16gE/-Tmp-/cc-RMHOwf.s >>> >>> >>> Is this what we need to support cross-compiling freebsd with clang? >> >> As we do it today? No. Today we build the binaries as 'as' which are part >> of the buildworld. These binaries aren't called arm-unknown-freebsd-as, but >> instead 'as'. >> >> Do we want to switch? Maybe. > > Seems that clang will first try to run as/ld which is in the same directory > like clang. That is exactly what we have in /usr/obj/.../bin so seems that > buildworld should work out of the box. > > Problem with ARM is that clang is not build as part of cross-tools, so clang > from /usr/bin is called instead which also means that as/ld from /usr/bin are > used. > > --- share/mk/bsd.own.mk (revision 223366) > +++ share/mk/bsd.own.mk (working copy) > @@ -415,7 +415,7 @@ > __T=${MACHINE_ARCH} > .endif > # Clang is only for x86 and 32-bit powerpc right now, by default. > -.if ${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc" > +.if ${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc" || ${__T} > == "arm" > __DEFAULT_YES_OPTIONS+=CLANG > .else
Well, you'd need to add to the comment too :) I'm not sure it is time to make this the default. Adding -DWITH_CLANG to the cross build would also accomplish the same thing. The reason we don't yet build arm is that it hasn't been very well tested... > Unfortunately this doesn't mean that cross-compiling works fine now for ARM. > It fails on building lib/libcompiler_rt. > Here is output if anybody have idea how to fix it: > http://pastebin.com/Ly2jARjd Not sure how to fix that. Warner_______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to "[email protected]"
