From owner-freebsd-current@FreeBSD.ORG Sun Oct 19 19:27:36 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 9CCEC172 for ; Sun, 19 Oct 2014 19:27:36 +0000 (UTC) Received: from tensor.andric.com (unknown [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CC04C8A for ; Sun, 19 Oct 2014 19:27:36 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::fcab:695e:40a6:527e] (unknown [IPv6:2001:7b8:3a7:0:fcab:695e:40a6:527e]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 79955B80A; Sun, 19 Oct 2014 21:27:31 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Subject: Re: Compiling Xen on FreeBSD using clang ... From: Dimitry Andric In-Reply-To: <5443E7FC.8020605@shrew.net> Date: Sun, 19 Oct 2014 21:27:31 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <937EF112-2DD5-4B4A-A405-D8F5DA0F9AF3@FreeBSD.org> References: <5443E7FC.8020605@shrew.net> To: Matthew Grooms X-Mailer: Apple Mail (2.1990.1) Cc: freebsd-current@freebsd.org 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 19:27:36 -0000 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? > 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 ... >=20 > /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: $ 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=3Dgnustep = -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=3Dboth --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