From owner-freebsd-current@FreeBSD.ORG Sun Oct 19 22:29:33 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 76D1CC93 for ; Sun, 19 Oct 2014 22:29:33 +0000 (UTC) Received: from mx1.shrew.net (mx1.shrew.net [38.97.5.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CCB2F7B for ; Sun, 19 Oct 2014 22:29:32 +0000 (UTC) Received: from mail.shrew.net (mail.shrew.prv [10.24.10.20]) by mx1.shrew.net (8.14.7/8.14.7) with ESMTP id s9JMSL6m018428 for ; Sun, 19 Oct 2014 17:28:21 -0500 (CDT) (envelope-from mgrooms@shrew.net) Received: from [10.22.200.30] (cpe-72-177-96-36.austin.res.rr.com [72.177.96.36]) by mail.shrew.net (Postfix) with ESMTPSA id 86D8B18B0A3 for ; Sun, 19 Oct 2014 17:28:16 -0500 (CDT) Message-ID: <54443B43.1030507@shrew.net> Date: Sun, 19 Oct 2014 17:29:23 -0500 From: Matthew Grooms User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: freebsd-current@freebsd.org Subject: Re: Compiling Xen on FreeBSD using clang ... References: <5443E7FC.8020605@shrew.net> <937EF112-2DD5-4B4A-A405-D8F5DA0F9AF3@FreeBSD.org> In-Reply-To: <937EF112-2DD5-4B4A-A405-D8F5DA0F9AF3@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mx1.shrew.net [10.24.10.10]); Sun, 19 Oct 2014 17:28:21 -0500 (CDT) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 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: Sun, 19 Oct 2014 22:29:33 -0000 On 10/19/2014 2:27 PM, Dimitry Andric wrote: > On 19 Oct 2014, at 18:34, Matthew Grooms wrote: >> As most of you are probably aware, Roger at Citrix R&D has been doing some incredible work to bring PVH domU/dom0 support to FreeBSD. There has also been an effort by other Xen developers to get the software to compile using clang. While most of these attempts appear to be on Linux platforms targeting arm processors, the FreeBSD version of binutils is quite a bit older. Clang still can't parse all of the assembly that Xen requires, so unfortunately the -no-integrated-as option has to be used in several cases. > > What kind of assembly is that? And are you using clang 3.4.1 from base? > There wasn't much of Xen proper that had issues compiling the assembly. Most of the headache came when compiling seabios which is wrapped up in the Xen source code. One problem was the .code16 sections as mentioned by Marcin Cieslak later in this email thread. Maybe related to this? http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-January/069375.html I tried passing the "-m16" flag to clang 3.4.1, but it complained about not being a recognized option ( or I wasn't using it properly ). Maybe support for this was first included in the 3.4.2 or the 3.5 release. > >> Which brings me to my question, is there a way to ask clang to use the ports version of binutils when -no-integrated-as is passed to clang? The version of 'as' in base fails to compile such as ... >> >> /tmp/misc-bf1339.s: Assembler messages: >> /tmp/misc-bf1339.s:375: Error: unknown pseudo-op: `.cfi_sections' > > Yes, binutils in base is forever stuck at version 2.17.50, which is > ancient by by now. > > >> If /usr/local/bin/as is symlinked to /usr/bin/as, the compile completes but I assume there is a better way to tell clang where the external as binary is when -no-integrated-as is invoked. I've googled a bunch but came up empty handed so far. I thought it would be worth asking here in case someone has already run across this problem and had more insight. > > Yes, just pass -B/usr/local/bin on the command line. Note that this > will make it search for *all* external tools in /usr/local/bin, e.g. > ld will also be run from there. For example: > Thanks for the feedback. I'll try this out. My goal was to get a set of patches that could be used to pull Xen into the ports tree. With that in mind I was trying to rely on the system compiler as much as possible. If an LLVM 3.5 import is imminent, then it may solve all of the issues, at least for CURRENT ( the only dom0 relevant branch ). > $ clang -v -no-integrated-as -B/usr/local/bin hello-world.c -o hello-world > FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 > Target: i386-unknown-freebsd11.0 > Thread model: posix > Selected GCC installation: > "/usr/bin/clang" -cc1 -triple i386-unknown-freebsd11.0 -S -disable-free -main-file-name hello-world.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu i486 -v -resource-dir /usr/bin/../lib/clang/3.4.1 -fno-dwarf-directory-asm -fdebug-compilation-dir /share/dim/src/misc -ferror-limit 19 -fmessage-length 297 -mstackrealign -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /home/dim/tmp/hello-world-410124.s -x c hello-world.c > clang -cc1 version 3.4.1 based upon LLVM 3.4.1 default target i386-unknown-freebsd11.0 > ignoring nonexistent directory "/usr/bin/../lib/clang/3.4.1/include" > #include "..." search starts here: > #include <...> search starts here: > /usr/include/clang/3.4.1 > /usr/include > End of search list. > "/usr/local/bin/as" --32 -o /home/dim/tmp/hello-world-288694.o /home/dim/tmp/hello-world-410124.s > "/usr/local/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -m elf_i386_fbsd -o hello-world /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /home/dim/tmp/hello-world-288694.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o > > -Dimitry > Thanks again, -Matthew