aboutsummaryrefslogtreecommitdiffstats
path: root/xen
diff options
context:
space:
mode:
authorTim Deegan <Tim.Deegan@citrix.com>2011-03-07 11:21:11 +0000
committerTim Deegan <Tim.Deegan@citrix.com>2011-03-07 11:21:11 +0000
commit436323c065f0ace4f469f5854f43423702a5082a (patch)
treea93c7f16cc6371a524eedcd7c642848f0d244f66 /xen
parentcde9655eddba4d6636249863e41b2bb5103ba2ee (diff)
downloadxen-436323c065f0ace4f469f5854f43423702a5082a.tar.gz
xen-436323c065f0ace4f469f5854f43423702a5082a.tar.bz2
xen-436323c065f0ace4f469f5854f43423702a5082a.zip
xen: add "clang=y" option to build Xen with clang/llvm instead of gcc.
Tested with svn snapshot of clang and llvm from 17 February 2011. Only x86_64 hypervisor builds (make dist-xen clang=y) are supported and I haven't even begun to look at cross-compiling. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen')
-rw-r--r--xen/Makefile2
-rw-r--r--xen/Rules.mk3
-rw-r--r--xen/arch/x86/Rules.mk5
3 files changed, 9 insertions, 1 deletions
diff --git a/xen/Makefile b/xen/Makefile
index 8b04f8b107..64f73cb64c 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -88,7 +88,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner
-e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
-e 's/@@domain@@/$(XEN_DOMAIN)/g' \
-e 's/@@hostname@@/$(shell hostname)/g' \
- -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) -v 2>&1 | tail -1)!g' \
+ -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) -v 2>&1 | grep version | tail -1)!g' \
-e 's/@@version@@/$(XEN_VERSION)/g' \
-e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
-e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
diff --git a/xen/Rules.mk b/xen/Rules.mk
index d3348144c0..59d0dc7c31 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -62,6 +62,9 @@ endif
AFLAGS-y += -D__ASSEMBLY__
+# Clang's built-in assembler can't handle .code16/.code32/.code64 yet
+AFLAGS-$(clang) += -no-integrated-as
+
ALL_OBJS := $(ALL_OBJS-y)
# Get gcc to generate the dependencies for us.
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index ec3abdd2be..f951398b60 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -12,9 +12,12 @@ xenoprof := y
supervisor_mode_kernel ?= n
# Solaris grabs stdarg.h and friends from the system include directory.
+# Clang likewise.
ifneq ($(XEN_OS),SunOS)
+ifneq ($(clang),y)
CFLAGS += -nostdinc
endif
+endif
CFLAGS += -fno-builtin -fno-common -Wredundant-decls
CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
@@ -49,5 +52,7 @@ x86_32 := n
x86_64 := y
endif
+ifneq ($(clang),y)
# Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
$(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4")
+endif