Skip to contentSkip to conversation

xen/x86: hypervisor build fixes for FreeBSD.

PATCH In review Tim Deegan 4 participants 5 messages Aug 15, 2013 – Aug 26, 2013

lore
Share & tools
lore

Tim Deegan

author
#0 lore raw

PATCH 1/1 xen/x86: hypervisor build fixes for FreeBSD.

These allow an x86_64 hypervisor to build on FreeBSD 9.1/amd64.
- like OpenBSD, needs a different arch passed to ld.
- like OpenBSD, sdtarg.h and stdbool.h are in /usr/include

---
 config/x86_64.mk          |    4 ++++
 xen/include/xen/stdarg.h  |    2 +-
 xen/include/xen/stdbool.h |    2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
config/x86_64.mk +4 -0
index 70c0d8d..d925b23 100644
@@ -20,5 +20,9 @@ EFI_DIR ?= /usr/lib64/efi
 ifeq ($(XEN_OS),OpenBSD)
 LDFLAGS_DIRECT += -melf_x86_64_obsd
 else
+ifeq ($(XEN_OS),FreeBSD)
+LDFLAGS_DIRECT += -melf_x86_64_fbsd
+else
 LDFLAGS_DIRECT += -melf_x86_64
 endif
+endif
xen/include/xen/stdarg.h +1 -1
index ade7a65..d1b2540 100644
@@ -1,7 +1,7 @@
 #ifndef __XEN_STDARG_H__
 #define __XEN_STDARG_H__
 
-#if defined(__OpenBSD__) || defined (__NetBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
    typedef __builtin_va_list va_list;
 #  ifdef __GNUC__
 #    define __GNUC_PREREQ__(x, y)                                       \
xen/include/xen/stdbool.h +1 -1
index 2eecd52..f0faedf 100644
@@ -1,7 +1,7 @@
 #ifndef __XEN_STDBOOL_H__
 #define __XEN_STDBOOL_H__
 
-#if defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
 #  define bool _Bool
 #  define true 1
 #  define false 0
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Tim Deegan

These allow an x86_64 hypervisor to build on FreeBSD 9.1/amd64.
- like OpenBSD, needs a different arch passed to ld.
- like OpenBSD, sdtarg.h and stdbool.h are in /usr/include

What a mess (assuming that's still GNU ld and gcc).

But anyway, this looks okay to me (but giving a Reviewed-by would be sort of odd, considering that I know nothing about all these BSDs).

Jan

Acked-by on v1 1/1
#2 lore raw
In reply to Tim Deegan
Quoted 5 lines · Tim Deegan

These allow an x86_64 hypervisor to build on FreeBSD 9.1/amd64.
- like OpenBSD, needs a different arch passed to ld.
- like OpenBSD, sdtarg.h and stdbool.h are in /usr/include

Quoted 46 lines
---
 config/x86_64.mk          |    4 ++++
 xen/include/xen/stdarg.h  |    2 +-
 xen/include/xen/stdbool.h |    2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
config/x86_64.mk +4 -0
index 70c0d8d..d925b23 100644
@@ -20,5 +20,9 @@ EFI_DIR ?= /usr/lib64/efi
 ifeq ($(XEN_OS),OpenBSD)
 LDFLAGS_DIRECT += -melf_x86_64_obsd
 else
+ifeq ($(XEN_OS),FreeBSD)
+LDFLAGS_DIRECT += -melf_x86_64_fbsd
+else
 LDFLAGS_DIRECT += -melf_x86_64
 endif
+endif
xen/include/xen/stdarg.h +1 -1
index ade7a65..d1b2540 100644
@@ -1,7 +1,7 @@
 #ifndef __XEN_STDARG_H__
 #define __XEN_STDARG_H__
 
-#if defined(__OpenBSD__) || defined (__NetBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
    typedef __builtin_va_list va_list;
 #  ifdef __GNUC__
 #    define __GNUC_PREREQ__(x, y)                                       \
xen/include/xen/stdbool.h +1 -1
index 2eecd52..f0faedf 100644
@@ -1,7 +1,7 @@
 #ifndef __XEN_STDBOOL_H__
 #define __XEN_STDBOOL_H__
 
-#if defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
 #  define bool _Bool
 #  define true 1
 #  define false 0
#3 lore raw
In reply to Tim Deegan
Quoted 3 lines · Tim Deegan

These allow an x86_64 hypervisor to build on FreeBSD 9.1/amd64.
- like OpenBSD, needs a different arch passed to ld.
- like OpenBSD, sdtarg.h and stdbool.h are in /usr/include

Just for curiosity, have you tried this with -current FreeBSD (10)? I'm specifically asking this because -current has switched to clang.

author
#4 lore raw
Quoted 7 lines · Roger Pau Monn?
Quoted 3 lines · Tim Deegan

These allow an x86_64 hypervisor to build on FreeBSD 9.1/amd64.
- like OpenBSD, needs a different arch passed to ld.
- like OpenBSD, sdtarg.h and stdbool.h are in /usr/include

Just for curiosity, have you tried this with -current FreeBSD (10)? I'm specifically asking this because -current has switched to clang.

No - although I do use FreeBSD for some things I didn't have a v10 image to try. I might give it a go if I get a moment. :)

Clang will build the hypervisor (if you use 'make xen clang=y') but IIRC it might not build the tools without some more work. The tools build uses autoconf now so on the one hand it should be possible for ./configure to DTRT, but on the other hand I really don't want to get involved in any autotools wrangling. :)

Cheers,

Tim.