diff --git a/Config.mk b/Config.mk index 6324237..0cd3553 100644 --- a/Config.mk +++ b/Config.mk @@ -36,10 +36,13 @@ CONFIG_$(XEN_OS) := y SHELL ?= /bin/sh # Tools to run on system hosting the build -HOSTCC = gcc +HOSTCC = cc HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer HOSTCFLAGS += -fno-strict-aliasing +# Clang specific +HOSTCFLAGS += -Wno-ignored-attributes + DISTDIR ?= $(XEN_ROOT)/dist DESTDIR ?= / @@ -54,7 +57,6 @@ else gcc := n endif - include $(XEN_ROOT)/config/$(XEN_OS).mk include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk @@ -193,6 +195,7 @@ CFLAGS += -Wall -Wstrict-prototypes # and is over-zealous with the printf format lint # and is a bit too fierce about unused return values CFLAGS-$(clang) += -Wno-parentheses -Wno-format -Wno-unused-value +CFLAGS-$(clang) += -Wno-ignored-attributes -Qunused-arguments $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement) $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement) diff --git a/tools/Rules.mk b/tools/Rules.mk index 87a56dc..ab47f54 100644 --- a/tools/Rules.mk +++ b/tools/Rules.mk @@ -17,6 +17,10 @@ XEN_LIBXENSTAT = $(XEN_ROOT)/tools/xenstat/libxenstat/src XEN_BLKTAP2 = $(XEN_ROOT)/tools/blktap2 XEN_LIBVCHAN = $(XEN_ROOT)/tools/libvchan +CFLAGS-$(clang) += -Wno-ignored-attributes -Wno-header-guard +CFLAGS-$(clang) += -no-integrated-as +CFLAGS-$(clang) += -DYAJL_MAJOR=2 + CFLAGS_xeninclude = -I$(XEN_INCLUDE) XENSTORE_XENSTORED ?= y @@ -70,6 +74,10 @@ CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) LDLIBS_libxenlight = $(XEN_XENLIGHT)/libxenlight$(libextension) $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl) SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT) +CFLAGS_libxenlight += -I/usr/local/include +CFLAGS_libxenlight += -Wno-format-nonliteral +LDFLAGS_libxenlight += -L/usr/local/lib + CFLAGS += -D__XEN_TOOLS__ # Get gcc to generate the dependencies for us. diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index df08c8a..a68f15a 100644 --- a/tools/libxl/Makefile +++ b/tools/libxl/Makefile @@ -12,7 +12,7 @@ XLUMAJOR = 4.3 XLUMINOR = 0 CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \ - -Wno-declaration-after-statement -Wformat-nonliteral + -Wno-declaration-after-statement CFLAGS += -I. -fPIC ifeq ($(CONFIG_Linux),y) @@ -25,6 +25,7 @@ ifeq ($(CONFIG_REMUS_NETBUF),y) LIBXL_LIBS += $(LIBNL3_LIBS) endif +CFLAGS_LIBXL = $(CFLAGS_libxenlight) CFLAGS_LIBXL += $(CFLAGS_libxenctrl) CFLAGS_LIBXL += $(CFLAGS_libxenguest) CFLAGS_LIBXL += $(CFLAGS_libxenstore) @@ -37,7 +38,7 @@ CFLAGS_LIBXL += -Wshadow LIBXL_LIBS-$(CONFIG_ARM) += -lfdt CFLAGS += $(PTHREAD_CFLAGS) -LDFLAGS += $(PTHREAD_LDFLAGS) +LDFLAGS += $(PTHREAD_LDFLAGS) $(LDFLAGS_libxenlight) LIBXL_LIBS += $(PTHREAD_LIBS) LIBXL_LIBS += $(LIBXL_LIBS-y) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 7ed601e..ba66a66 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1773,7 +1773,7 @@ libxl__json_map_node *libxl__json_map_node_get(const libxl__json_object *o, _hidden const libxl__json_object *libxl__json_map_get(const char *key, const libxl__json_object *o, libxl__json_node_type expected_type); -_hidden yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc_opt, +_hidden yajl_gen_status libxl__json_object_to_yajl_gen(libxl__gc *gc_opt, yajl_gen hand, libxl__json_object *param); _hidden void libxl__json_object_free(libxl__gc *gc_opt, diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c index ceb014a..6f64be9 100644 --- a/tools/libxl/libxl_json.c +++ b/tools/libxl/libxl_json.c @@ -610,12 +610,12 @@ const libxl__json_object *libxl__json_map_get(const char *key, return NULL; } -yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc, +yajl_gen_status libxl__json_object_to_yajl_gen(libxl__gc *gc, yajl_gen hand, libxl__json_object *obj) { int idx = 0; - yajl_status rc; + yajl_gen_status rc; switch (obj->type) { case JSON_NULL: diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 988ee28..61eda4c 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3360,7 +3360,7 @@ static void list_domains(int verbose, int context, int claim, int numa, printf("\n"); for (i = 0; i < nb_domain; i++) { char *domname; - unsigned shutdown_reason; + int shutdown_reason; domname = libxl_domid_to_name(ctx, info[i].domid); shutdown_reason = info[i].shutdown ? info[i].shutdown_reason : 0; printf("%-40s %5d %5lu %5d %c%c%c%c%c%c %8.1f", @@ -4908,7 +4908,7 @@ static void output_xeninfo(void) return; } - if ((sched = libxl_get_scheduler(ctx)) < 0) { + if ((int)(sched = libxl_get_scheduler(ctx)) < 0) { fprintf(stderr, "get_scheduler sysctl failed.\n"); return; } @@ -6913,7 +6913,7 @@ int main_cpupoolcreate(int argc, char **argv) goto out_cfg; } } else { - if ((sched = libxl_get_scheduler(ctx)) < 0) { + if ((int)(sched = libxl_get_scheduler(ctx)) < 0) { fprintf(stderr, "get_scheduler sysctl failed.\n"); goto out_cfg; } diff --git a/xen/Rules.mk b/xen/Rules.mk index a97405c..85b1eb3 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -74,8 +74,12 @@ endif AFLAGS-y += -D__ASSEMBLY__ -include $(BASEDIR)/include/xen/config.h +# Clang complains without these +CFLAGS-$(clang) += -Wno-unused-function -Wno-initializer-overrides + # Clang's built-in assembler can't handle .code16/.code32/.code64 yet AFLAGS-$(clang) += -no-integrated-as +CFLAGS-$(clang) += -no-integrated-as -v ALL_OBJS := $(ALL_OBJS-y) diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h index b95fd79..f884493 100644 --- a/xen/include/asm-x86/current.h +++ b/xen/include/asm-x86/current.h @@ -27,6 +27,8 @@ static inline struct cpu_info *get_cpu_info(void) { register unsigned long sp asm("rsp"); + asm("" : "=r" (sp)); + return (struct cpu_info *)((sp & ~(STACK_SIZE-1)) + STACK_SIZE) - 1; }