On Sun, 19 Oct 2014, Matthew Grooms wrote:
Thanks for that. I hope the Xen devs can get the yajl and signed int patches committed. Those were the only C level code changes I ran into and would clean up the build significantly for clang users. Tho only other knit was the ...register unsigned long sp asm("rsp"); ... assembly but maybe that compiles with 3.5 as well?
I am still getting this: /home/saper/sw/xen/xen/include/asm/current.h:30:33: error: variable 'sp' is uninitialized when used here [-Werror,-Wuninitialized] return (struct cpu_info *)((sp & ~(STACK_SIZE-1)) + STACK_... ^~ /home/saper/sw/xen/xen/include/asm/current.h:28:30: note: initialize the variable 'sp' to silence this warning register unsigned long sp asm("rsp"); ^ = 0 1 error generated.
Do you have a link to your patch set? I sifted through the ones posted by Julien and I probably saw most of yours as well. My goal was to get as much as possible to compile with the existing system compiler so I didn't try 3.5.0. Maybe that's a better bet.
It would be also really good to integrate with qemu from ports and not compile our own version again. My patches are attached, hopefully the mailing list will accept them. //Marcin
From a2253431f4df4dc09e8817467996ec6c6fc47614 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Wed, 24 Sep 2014 12:00:54 +0000 Subject: [PATCH 10/10] No QEMU for now --- tools/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index b6476c9..833b8fa 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -24,8 +24,8 @@ SUBDIRS-$(CONFIG_Linux) += libvchan # do not recurse in to a dir we are about to delete ifneq "$(MAKECMDGOALS)" "distclean" -SUBDIRS-$(CONFIG_QEMU_TRAD) += qemu-xen-traditional-dir -SUBDIRS-$(CONFIG_QEMU_XEN) += qemu-xen-dir +# SUBDIRS-$(CONFIG_QEMU_TRAD) += qemu-xen-traditional-dir +# SUBDIRS-$(CONFIG_QEMU_XEN) += qemu-xen-dir endif SUBDIRS-y += xenpmd -- 2.0.2
From e37a8a1070b77c44f66507d5f49e332787325609 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Wed, 24 Sep 2014 12:49:17 +0000 Subject: [PATCH 09/10] Add -Wno-initializer-overrides for clang Signed-off-by: Marcin Cieslak <sa...@saper.info> --- Config.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/Config.mk b/Config.mk index 015b90b..aa0ca73 100644 --- a/Config.mk +++ b/Config.mk @@ -194,6 +194,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-initializer-overrides $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement) $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement) -- 2.0.2
From c84cc99dcf9365b713031f0135c56b477df5824b Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Wed, 24 Sep 2014 12:06:25 +0000 Subject: [PATCH 08/10] variable 'rc' is used uninitialized whenever 'if' condition is false Signed-off-by: Marcin Cieslak <sa...@saper.info> --- tools/libxl/libxl_dom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index ce0c4ac..d98838a 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -2020,7 +2020,7 @@ int libxl_userdata_unlink(libxl_ctx *ctx, uint32_t domid, const char *userdata_userid) { GC_INIT(ctx); - int rc; + int rc = 0; libxl__domain_userdata_lock *lock; const char *filename; -- 2.0.2
From c468fd7e6228f2820ef8f4ede7432313354730f0 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Sat, 13 Sep 2014 18:35:52 +0000 Subject: [PATCH 07/10] clang: sizeof(type) must not have __attribute__(aligned) Signed-off-by: Marcin Cieslak <sa...@saper.info> --- tools/include/xen-foreign/mkheader.py | 41 ++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py index 0504cb8..80a8404 100644 --- a/tools/include/xen-foreign/mkheader.py +++ b/tools/include/xen-foreign/mkheader.py @@ -16,13 +16,23 @@ inttypes = {}; header = {}; footer = {}; +def convertint(arch, t, aligned=False): + nt = inttypes[arch][t] + attr = "" + if type(nt) is type(()): + (attr, nt) = nt + if not aligned: + attr = "" + print >>sys.stderr, "%s(%d) -> %s %s" % (t, aligned, attr, nt) + return "%s %s" % (nt, attr) # Order is important due to re.sub done twice + #arm inttypes["arm32"] = { "unsigned long" : "__danger_unsigned_long_on_arm32", "long" : "__danger_long_on_arm32", - "xen_pfn_t" : "__align8__ uint64_t", - "xen_ulong_t" : "__align8__ uint64_t", - "uint64_t" : "__align8__ uint64_t", + "xen_pfn_t" : ("__align8__", "uint64_t"), + "xen_ulong_t" : ("__align8__", "uint64_t"), + "uint64_t" : ("__align8__", "uint64_t"), }; header["arm32"] = """ #define __arm___ARM32 1 @@ -41,10 +51,10 @@ footer["arm32"] = """ inttypes["arm64"] = { "unsigned long" : "__danger_unsigned_long_on_arm64", "long" : "__danger_long_on_arm64", - "xen_pfn_t" : "__align8__ uint64_t", - "xen_ulong_t" : "__align8__ uint64_t", - "uint64_t" : "__align8__ uint64_t", -}; + "xen_pfn_t" : ("__align8__", "uint64_t"), + "xen_ulong_t" : ("__align8__", "uint64_t"), + "uint64_t" : ("__align8__", "uint64_t"), +} header["arm64"] = """ #define __aarch64___ARM64 1 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) @@ -65,7 +75,7 @@ inttypes["x86_32"] = { "long" : "uint32_t", "xen_pfn_t" : "uint32_t", "xen_ulong_t" : "uint32_t", -}; +} header["x86_32"] = """ #define __i386___X86_32 1 #pragma pack(4) @@ -76,11 +86,11 @@ footer["x86_32"] = """ # x86_64 inttypes["x86_64"] = { - "unsigned long" : "__align8__ uint64_t", - "long" : "__align8__ uint64_t", - "xen_pfn_t" : "__align8__ uint64_t", - "xen_ulong_t" : "__align8__ uint64_t", -}; + "unsigned long" : ("__align8__", "uint64_t"), + "long" : ("__align8__", "uint64_t"), + "xen_pfn_t" : ("__align8__", "uint64_t"), + "xen_ulong_t" : ("__align8__", "uint64_t"), +} header["x86_64"] = """ #if defined(__GNUC__) && !defined(__STRICT_ANSI__) # define __DECL_REG(name) union { uint64_t r ## name, e ## name; } @@ -195,8 +205,9 @@ for struct in structs: # replace: integer types integers = inttypes[arch].keys(); integers.sort(lambda a, b: cmp(len(b),len(a))); -for type in integers: - output = re.sub("\\b%s\\b" % type, inttypes[arch][type], output); +for typename in integers: + output = re.sub("\\b(?<!sizeof\()%s\\b" % typename, convertint(arch, typename, True), output); + output = re.sub("\\b(?<=sizeof\()%s\\b" % typename, convertint(arch, typename, False), output); # print results f = open(outfile, "w"); -- 2.0.2
From 1224f07ba267b4288d1d6f3d8847f931af73981d Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Wed, 24 Sep 2014 10:30:57 +0000 Subject: [PATCH 06/10] Quick build fixes Signed-off-by: Marcin Cieslak <sa...@saper.info> --- Config.mk | 2 +- tools/libxc/Makefile | 4 ++-- tools/libxl/Makefile | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Config.mk b/Config.mk index 015b90b..17b3f23 100644 --- a/Config.mk +++ b/Config.mk @@ -193,7 +193,7 @@ CFLAGS += -Wall -Wstrict-prototypes # Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...' # 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-parentheses -Wno-format -Wno-unused-value -Wno-unused-function -Wno-ignored-attributes $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement) $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement) diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index 3b04027..9281681 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -197,8 +197,8 @@ else zlib-options = $(ZLIB) endif -xc_dom_bzimageloader.o: CFLAGS += $(call zlib-options,D) -xc_dom_bzimageloader.opic: CFLAGS += $(call zlib-options,D) +#xc_dom_bzimageloader.o: CFLAGS += $(call zlib-options,D) +#xc_dom_bzimageloader.opic: CFLAGS += $(call zlib-options,D) libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l) libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index 990414b..3659838 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 -Wno-format-nonliteral CFLAGS += -I. -fPIC ifeq ($(CONFIG_Linux),y) -- 2.0.2
From 88ccf287859a7cc3cff24e831dade9806bb986b1 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Sat, 13 Sep 2014 21:05:57 +0000 Subject: [PATCH 05/10] libxl: Use yajl_gen_status_ok where appropriate Signed-off-by: Marcin Cieslak <sa...@saper.info> --- tools/libxl/libxl_internal.h | 2 +- tools/libxl/libxl_json.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index f61673c..b176046 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1772,7 +1772,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..1481140 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: @@ -634,17 +634,17 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc, libxl__json_map_node *node = NULL; rc = yajl_gen_map_open(hand); - if (rc != yajl_status_ok) + if (rc != yajl_gen_status_ok) return rc; for (idx = 0; idx < obj->u.map->count; idx++) { if (flexarray_get(obj->u.map, idx, (void**)&node) != 0) break; rc = libxl__yajl_gen_asciiz(hand, node->map_key); - if (rc != yajl_status_ok) + if (rc != yajl_gen_status_ok) return rc; rc = libxl__json_object_to_yajl_gen(gc, hand, node->obj); - if (rc != yajl_status_ok) + if (rc != yajl_gen_status_ok) return rc; } return yajl_gen_map_close(hand); -- 2.0.2
From f528aa5b405292cc7abf83c943c0f35cd8ddc888 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Sat, 13 Sep 2014 19:33:02 +0000 Subject: [PATCH 04/10] Use proper header guard for <ufs/ufs.h> Signed-off-by: Marcin Cieslak <sa...@saper.info> --- tools/libfsimage/ufs/ufs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libfsimage/ufs/ufs.h b/tools/libfsimage/ufs/ufs.h index 4e7c736..0b178e9 100644 --- a/tools/libfsimage/ufs/ufs.h +++ b/tools/libfsimage/ufs/ufs.h @@ -3,7 +3,7 @@ * Use is subject to license terms. */ -#ifndef _GRUB_UFS_H +#ifndef _GRUB_UFS_H_ #define _GRUB_UFS_H_ /* ufs specific constants */ -- 2.0.2
From 52fc00f2f9e8ecb8ab74b4bb4734e2945ebd76a9 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Sat, 13 Sep 2014 20:06:20 +0000 Subject: [PATCH 03/10] libxl_get_scheduler() cannot return ERROR_FAIL ERROR_FAIL (-3) is not a proper value for libxl_scheduler enum. Use LIBXL_SCHEDULER_UNKNOWN (0) instead. Clang complains otherwise: error: comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-compare] C99 does not guarantee that enums are ints (they can be unsigned). Signed-off-by: Marcin Cieslak <sa...@saper.info> --- tools/libxl/libxl.c | 2 +- tools/libxl/xl_cmdimpl.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 77672d0..e465a67 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -5189,7 +5189,7 @@ libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx) if ((ret = xc_sched_id(ctx->xch, (int *)&sched)) != 0) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list"); - return ERROR_FAIL; + return LIBXL_SCHEDULER_UNKNOWN; } return sched; } diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 698b3bc..cd469d5 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -4854,7 +4854,7 @@ static void output_xeninfo(void) return; } - if ((sched = libxl_get_scheduler(ctx)) < 0) { + if ((sched = libxl_get_scheduler(ctx)) == LIBXL_SCHEDULER_UNKNOWN) { fprintf(stderr, "get_scheduler sysctl failed.\n"); return; } @@ -6735,7 +6735,7 @@ int main_cpupoolcreate(int argc, char **argv) goto out_cfg; } } else { - if ((sched = libxl_get_scheduler(ctx)) < 0) { + if ((sched = libxl_get_scheduler(ctx)) == LIBXL_SCHEDULER_UNKNOWN) { fprintf(stderr, "get_scheduler sysctl failed.\n"); goto out_cfg; } -- 2.0.2
From 68a57186fadb1aea91ef588c8d7ee3813acce1b0 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Sat, 13 Sep 2014 20:09:44 +0000 Subject: [PATCH 02/10] libxl: shutdown_reason cannot be unsigned shutdown_reason may be negative, so don't cast it onto (unsigned int). Clang complains: xl_cmdimpl.c:3313:34: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare] Signed-off-by: Marcin Cieslak <sa...@saper.info> --- tools/libxl/xl_cmdimpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 698b3bc..d9e976f 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3306,7 +3306,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", -- 2.0.2
From fef7c281c622637e8b7de020dd85b14d1bc594dd Mon Sep 17 00:00:00 2001 From: Marcin Cieslak <sa...@saper.info> Date: Sat, 13 Sep 2014 15:29:49 +0000 Subject: [PATCH 01/10] Unbreak "x86/current: provide additional information to optimise get_cpu_info()" df0ae94fd56d5f9c64089364efecb1793442360b breaks clang build with: xen/include/asm/current.h:30:33: error: variable 'sp' is uninitialized when used here [-Werror,-Wuninitialized] Signed-off-by: Marcin Cieslak <sa...@saper.info> --- xen/include/asm-x86/current.h | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h index b95fd79..e133d9d 100644 --- a/xen/include/asm-x86/current.h +++ b/xen/include/asm-x86/current.h @@ -26,6 +26,7 @@ struct cpu_info { 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; } -- 2.0.2
_______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"