Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Oct 2014 21:27:31 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Matthew Grooms <mgrooms@shrew.net>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Compiling Xen on FreeBSD using clang ...
Message-ID:  <937EF112-2DD5-4B4A-A405-D8F5DA0F9AF3@FreeBSD.org>
In-Reply-To: <5443E7FC.8020605@shrew.net>
References:  <5443E7FC.8020605@shrew.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 19 Oct 2014, at 18:34, Matthew Grooms <mgrooms@shrew.net> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?937EF112-2DD5-4B4A-A405-D8F5DA0F9AF3>