Compiling Xen on FreeBSD using clang ...

Marcin Cieslak saper at
Sun Oct 19 20:03:30 UTC 2014

On Sun, 19 Oct 2014, Matthew Grooms wrote:

> All,
> 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.
> 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'

I have recently managed to compile Xen (4.5 unstable from git master) using
few patches in the source code (I posted them to xen-devel@, most of them
are almost the same as some earlier work by Julien Grall).

I have used clang version 3.5.0 (trunk) from ports just for the .code16
support, other than that clang 3.4.1 was fine.

Xen kernel compiled this way even boots successfully and starts Debian dom0.

This command was used to compile with 3.4.1 (without hvmloader):
env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib gmake clang=y CC=clang-devel HOSTCC=clang-devel CONFIG_SEABIOS=y CONFIG_HVMLOADER=n SEABIOS_PATH=$HOME/qemu/bios.bin-1.7.5 CONFIG_QEMU=n "$@"


More information about the freebsd-current mailing list