WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xen: add "clang=y" option to build Xen wi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xen: add "clang=y" option to build Xen with clang/llvm instead of gcc.
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Thu, 10 Mar 2011 22:20:11 +0000
Delivery-date: Thu, 10 Mar 2011 14:23:10 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxx>
# Date 1299496871 0
# Node ID d8ea33e7af7ee76ee3bea5411430ab876258ce78
# Parent  2bc9bd01b5fac6e42e3a6d56a7944f69b76972c1
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@xxxxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 2bc9bd01b5fa -r d8ea33e7af7e Config.mk
--- a/Config.mk Mon Mar 07 11:21:11 2011 +0000
+++ b/Config.mk Mon Mar 07 11:21:11 2011 +0000
@@ -148,6 +148,13 @@
 # result of any casted expression causes a warning.
 CFLAGS += -Wno-unused-value
 
+ifeq ($(clang),y)
+# Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
+CFLAGS += -Wno-parentheses
+# And is over-zealous with the printf format lint
+CFLAGS += -Wno-format
+endif
+
 $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
 $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
 
diff -r 2bc9bd01b5fa -r d8ea33e7af7e config/StdGNU.mk
--- a/config/StdGNU.mk  Mon Mar 07 11:21:11 2011 +0000
+++ b/config/StdGNU.mk  Mon Mar 07 11:21:11 2011 +0000
@@ -1,6 +1,11 @@
 AS         = $(CROSS_COMPILE)as
+ifeq ($(clang),y)
+LD         = $(CROSS_COMPILE)gold
+CC         = $(CROSS_COMPILE)clang
+else
 LD         = $(CROSS_COMPILE)ld
 CC         = $(CROSS_COMPILE)gcc
+endif
 CPP        = $(CC) -E
 AR         = $(CROSS_COMPILE)ar
 RANLIB     = $(CROSS_COMPILE)ranlib
@@ -69,5 +74,8 @@
 CFLAGS += -O2 -fomit-frame-pointer
 else
 # Less than -O1 produces bad code and large stack frames
-CFLAGS += -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls
+CFLAGS += -O1 -fno-omit-frame-pointer
+ifneq ($(clang),y)
+CFLAGS += -fno-optimize-sibling-calls
 endif
+endif
diff -r 2bc9bd01b5fa -r d8ea33e7af7e xen/Makefile
--- a/xen/Makefile      Mon Mar 07 11:21:11 2011 +0000
+++ b/xen/Makefile      Mon Mar 07 11:21:11 2011 +0000
@@ -88,7 +88,7 @@
            -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 -r 2bc9bd01b5fa -r d8ea33e7af7e xen/Rules.mk
--- a/xen/Rules.mk      Mon Mar 07 11:21:11 2011 +0000
+++ b/xen/Rules.mk      Mon Mar 07 11:21:11 2011 +0000
@@ -62,6 +62,9 @@
 
 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 -r 2bc9bd01b5fa -r d8ea33e7af7e xen/arch/x86/Rules.mk
--- a/xen/arch/x86/Rules.mk     Mon Mar 07 11:21:11 2011 +0000
+++ b/xen/arch/x86/Rules.mk     Mon Mar 07 11:21:11 2011 +0000
@@ -12,9 +12,12 @@
 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_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

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xen: add "clang=y" option to build Xen with clang/llvm instead of gcc., Xen patchbot-unstable <=