Skip to contentSkip to conversation

Fixes for compiling with clang

PATCH In review Roger Pau Monne 3 participants 27 messages Apr 27, 2016 – May 9, 2016

lore
Share & tools
lore
#0 lore raw

v3 cover Fixes for compiling with clang

Hello,

This is a set of bug fixes for compiling both the hypervisor and the toolstack with clang. I've only tested it with clang 3.8.0 from base FreeBSD, so I'm not sure if it's going to work with _all_ clang versions, but should be better than nothing.

AFAICT, most of the issues that clang found on the toolstack are actual bugs, so it's worth trying to fix them before the release.

Patches 1-4 are for the hypervisor, while patches 5-16 are for the toolstack.

FWIW, I've also pushed the series to my git repo:

git://xenbits.xen.org/people/royger/xen.git clang_v3

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw

PATCH v3 1/16 build: make HOSTCC conditional on the value of clang

Previously HOSTCC was always hardcoded to gcc

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Keir Fraser <[email protected]>
Cc: Tim Deegan <[email protected]>
---
Changes since v1:
- Use ?= instead of =

---
 Config.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Config.mk +2 -1
index a0e6d4e..fd8371a 100644
@@ -36,7 +36,6 @@ CONFIG_$(XEN_OS) := y
 SHELL     ?= /bin/sh
 
 # Tools to run on system hosting the build
-HOSTCC      = gcc
 HOSTCFLAGS  = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTCFLAGS += -fno-strict-aliasing
 
@@ -50,8 +49,10 @@ DESTDIR     ?= /
 clang ?= n
 ifeq ($(clang),n)
 gcc := y
+HOSTCC ?= gcc
 else
 gcc := n
+HOSTCC ?= clang
 endif
 
 
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw

PATCH v3 2/16 build: set HOSTCXX based on clang value for Kconfig xconfig target

In reply to Roger Pau Monne

The xconfig Kconfig target requires a C++ compiler because it uses Qt.

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Keir Fraser <[email protected]>
Cc: Tim Deegan <[email protected]>

---
 Config.mk | 2 ++
 1 file changed, 2 insertions(+)
Config.mk +2 -0
index fd8371a..4a5ebed 100644
@@ -50,9 +50,11 @@ clang ?= n
 ifeq ($(clang),n)
 gcc := y
 HOSTCC ?= gcc
+HOSTCXX ?= g++
 else
 gcc := n
 HOSTCC ?= clang
+HOSTCXX ?= clang++
 endif
 
 
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#3 lore raw

PATCH v3 3/16 build: pass HOST{CC/CXX} value down to Kconfig

In reply to Roger Pau Monne

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Keir Fraser <[email protected]>
Cc: Tim Deegan <[email protected]>

---
 xen/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/Makefile +3 -3
index c908544..b483823 100644
@@ -242,14 +242,14 @@ kconfig := silentoldconfig oldconfig config menuconfig defconfig \
 	randconfig
 .PHONY: $(kconfig)
 $(kconfig):
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) $@
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC=$(HOSTCC) HOSTCXX=$(HOSTCXX) $@
 
 include/config/%.conf: include/config/auto.conf.cmd $(KCONFIG_CONFIG)
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) silentoldconfig
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC=$(HOSTCC) HOSTCXX=$(HOSTCXX) silentoldconfig
 
 # Allow people to just run `make` as before and not force them to configure
 $(KCONFIG_CONFIG):
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) defconfig
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC=$(HOSTCC) HOSTCXX=$(HOSTCXX) defconfig
 
 # Break the dependency chain for the first run
 include/config/auto.conf.cmd: ;
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#4 lore raw

PATCH v3 4/16 build: remove Kconfig forced gcc selection

In reply to Roger Pau Monne

---
Cc: Doug Goldstein <[email protected]>

---
 xen/tools/kconfig/Makefile.kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/tools/kconfig/Makefile.kconfig +2 -2
index 815f306..dbd8912 100644
@@ -36,8 +36,8 @@ KBUILD_DEFCONFIG := $(ARCH)_defconfig
 CONFIG_SHELL := $(SHELL)
 
 # provide the host compiler
-HOSTCC := gcc
-HOSTCXX := g++
+HOSTCC ?= gcc
+HOSTCXX ?= g++
 
 # force target
 PHONY += FORCE
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#5 lore raw

PATCH v3 5/16 tools/headers: prevent adding two __align8__ to uint64_t in ARM headers

In reply to Roger Pau Monne

Due to the fact that on ARM headers types are substituted to uint64_t and then uint64_t is also substituted to contain the aligment, this would lead to some types containing two __align8__ directives. Fix this by first expanding Xen specific types to uint64_t only, and then replacing all the uint64_t types to __align8__ uint64_t. This relies on the fact that all Xen-specific types will have longer names, so they will always be replaced first.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/include/xen-foreign/mkheader.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/include/xen-foreign/mkheader.py +4 -4
index 0504cb8..0e42e14 100644
@@ -20,8 +20,8 @@ footer = {};
 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",
+    "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
     "uint64_t"      : "__align8__ uint64_t",
 };
 header["arm32"] = """
@@ -41,8 +41,8 @@ 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",
+    "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
     "uint64_t"      : "__align8__ uint64_t",
 };
 header["arm64"] = """
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#6 lore raw

PATCH v3 6/16 xen/tools: fix substitution of __align8__ uint64_t inside of headers

In reply to Roger Pau Monne

The current seedery doesn't work with BSD sed, so remove the try to match int64_t also (since there's none at the moment). Also, apply the same treatment to all arch headers, currently this is only done to x86_64 headers.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/include/xen-foreign/Makefile | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
tools/include/xen-foreign/Makefile +16 -4
index 270a975..e395011 100644
@@ -25,18 +25,30 @@ check-headers: checker
 	rm tmp.size
 
 arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
-	$(PYTHON) $< $* $@ $(filter %.h,$^)
+	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
+	rm [email protected]
+	$(call move-if-changed,[email protected],$@)
 
 arm64.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
-	$(PYTHON) $< $* $@ $(filter %.h,$^)
+	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
+	rm [email protected]
+	$(call move-if-changed,[email protected],$@)
 
 x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
-	$(PYTHON) $< $* $@ $(filter %.h,$^)
+	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
+	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
+	rm [email protected]
+	$(call move-if-changed,[email protected],$@)
 
 x86_64.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_64.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
 	$(PYTHON) $< $* [email protected] $(filter %.h,$^)
 	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
-	sed 's/(__align8__ \(u\?int64_t\))/(\1)/g' < [email protected] > [email protected]
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < [email protected] > [email protected]
 	rm [email protected]
 	$(call move-if-changed,[email protected],$@)
 
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#7 lore raw

PATCH v3 7/16 libxc: fix usage of uninitialized variable

In reply to Roger Pau Monne

*size should be used instead, because it contains the size of the buffer in out_buf.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- Use *size instead of 0, because it will contain the actual size of the out_buf buffer.

---
 tools/libxc/xc_dom_bzimageloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_dom_bzimageloader.c +1 -1
index 7fde42a..33ba06b 100644
@@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
         if ( !dst_len )
         {
             msg = "Error registering stream output";
-            if ( xc_dom_register_external(dom, out_buf, out_len) )
+            if ( xc_dom_register_external(dom, out_buf, *size) )
                 break;
 
             return 0;
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#9 lore raw

Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable

In reply to Roger Pau Monne
Quoted 11 lines · Roger Pau Monne

*size should be used instead, because it contains the size of the buffer in out_buf.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- Use *size instead of 0, because it will contain the actual size of the out_buf buffer.

Ian, this is a backport candidate.

Note that the code still functions without this fix because the third parameter to xc_dom_register_external is only for accounting purpose.

Wei.

Quoted 20 lines
---
 tools/libxc/xc_dom_bzimageloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_dom_bzimageloader.c +1 -1
index 7fde42a..33ba06b 100644
@@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
         if ( !dst_len )
         {
             msg = "Error registering stream output";
-            if ( xc_dom_register_external(dom, out_buf, out_len) )
+            if ( xc_dom_register_external(dom, out_buf, *size) )
                 break;
 
             return 0;
Signature · 1 line
2.6.4 (Apple Git-63)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#10 lore raw

Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable

Wei Liu writes ("Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable"):

Quoted 1 line

Ian, this is a backport candidate.

Noted, thanks.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#11 lore raw

Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable

Ian Jackson writes ("Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable"):

Quoted 4 lines

Wei Liu writes ("Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable"):

Quoted 1 line

Ian, this is a backport candidate.

Noted, thanks.

Backported to 4.6 and 4.5.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw

PATCH v3 8/16 libxl: fix shutdown_reason type in list_domains

In reply to Roger Pau Monne

It should be an enum, not an unsigned.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/xl_cmdimpl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/xl_cmdimpl.c +1 -1
index 6346017..8ff54e1 100644
@@ -4254,7 +4254,7 @@ static void list_domains(bool verbose, bool context, bool claim, bool numa,
     printf("\n");
     for (i = 0; i < nb_domain; i++) {
         char *domname;
-        unsigned shutdown_reason;
+        libxl_shutdown_reason 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",
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#13 lore raw

PATCH v3 9/16 xl: fix usage of libxl_get_scheduler

In reply to Roger Pau Monne

It returns an int, not a libxl_scheduler.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- s/sched_rc/rc/

---
 tools/libxl/xl_cmdimpl.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tools/libxl/xl_cmdimpl.c +7 -2
index 8ff54e1..dfb1b01 100644
@@ -5894,16 +5894,19 @@ static void output_xeninfo(void)
 {
     const libxl_version_info *info;
     libxl_scheduler sched;
+    int rc;
 
     if (!(info = libxl_get_version_info(ctx))) {
         fprintf(stderr, "libxl_get_version_info failed.\n");
         return;
     }
 
-    if ((sched = libxl_get_scheduler(ctx)) < 0) {
+    rc = libxl_get_scheduler(ctx);
+    if (rc < 0) {
         fprintf(stderr, "get_scheduler sysctl failed.\n");
         return;
     }
+    sched = rc;
 
     printf("xen_major              : %d\n", info->xen_version_major);
     printf("xen_minor              : %d\n", info->xen_version_minor);
@@ -8084,10 +8087,12 @@ int main_cpupoolcreate(int argc, char **argv)
             goto out_cfg;
         }
     } else {
-        if ((sched = libxl_get_scheduler(ctx)) < 0) {
+        rc = libxl_get_scheduler(ctx);
+        if (rc < 0) {
             fprintf(stderr, "get_scheduler sysctl failed.\n");
             goto out_cfg;
         }
+        sched = rc;
     }
 
     if (libxl_get_freecpus(ctx, &freemap)) {
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v3 9/16
#14 lore raw

Re: [PATCH v3 for-4.7 09/16] xl: fix usage of libxl_get_scheduler

Quoted 4 lines · Roger Pau Monne

It returns an int, not a libxl_scheduler.

Quoted 52 lines

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- s/sched_rc/rc/

---
 tools/libxl/xl_cmdimpl.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tools/libxl/xl_cmdimpl.c +7 -2
index 8ff54e1..dfb1b01 100644
@@ -5894,16 +5894,19 @@ static void output_xeninfo(void)
 {
     const libxl_version_info *info;
     libxl_scheduler sched;
+    int rc;
 
     if (!(info = libxl_get_version_info(ctx))) {
         fprintf(stderr, "libxl_get_version_info failed.\n");
         return;
     }
 
-    if ((sched = libxl_get_scheduler(ctx)) < 0) {
+    rc = libxl_get_scheduler(ctx);
+    if (rc < 0) {
         fprintf(stderr, "get_scheduler sysctl failed.\n");
         return;
     }
+    sched = rc;
 
     printf("xen_major              : %d\n", info->xen_version_major);
     printf("xen_minor              : %d\n", info->xen_version_minor);
@@ -8084,10 +8087,12 @@ int main_cpupoolcreate(int argc, char **argv)
             goto out_cfg;
         }
     } else {
-        if ((sched = libxl_get_scheduler(ctx)) < 0) {
+        rc = libxl_get_scheduler(ctx);
+        if (rc < 0) {
             fprintf(stderr, "get_scheduler sysctl failed.\n");
             goto out_cfg;
         }
+        sched = rc;
     }
 
     if (libxl_get_freecpus(ctx, &freemap)) {
Signature · 1 line
2.6.4 (Apple Git-63)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#15 lore raw

PATCH v3 10/16 libxl: add the printf-like attributes to a couple of functions

In reply to Roger Pau Monne

Or else clang complains with:

error: format string is not a string literal

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_internal.h    | 4 ++--
 tools/libxl/libxl_save_helper.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
tools/libxl/libxl_internal.h +2 -2
index 8e2cf3e..662d01a 100644
@@ -636,7 +636,7 @@ _hidden void *libxl__realloc(libxl__gc *gc_opt, void *ptr, size_t new_size) NN1;
 /* print @fmt into an allocated string large enoughto contain the result.
  * (similar to gc'd asprintf(3)). */
 _hidden char *libxl__sprintf(libxl__gc *gc_opt, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3) NN1;
-_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap);
+_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0);
 /* duplicate the string @c (similar to a gc'd strdup(3)). */
 _hidden char *libxl__strdup(libxl__gc *gc_opt,
                             const char *c /* may be NULL */) NN1;
@@ -709,7 +709,7 @@ _hidden char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid);
  */
 
 int libxl__xs_vprintf(libxl__gc *gc, xs_transaction_t t,
-                      const char *path, const char *fmt, va_list ap);
+                      const char *path, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(4, 0);
 int libxl__xs_printf(libxl__gc *gc, xs_transaction_t t,
                      const char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
 
tools/libxl/libxl_save_helper.c +1 -0
index 5fe642a..d3def6b 100644
@@ -52,6 +52,7 @@
 
 /*----- logger -----*/
 
+__attribute__((format(printf, 5, 0)))
 static void tellparent_vmessage(xentoollog_logger *logger_in,
                                 xentoollog_level level,
                                 int errnoval,
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v3 10/16
#16 lore raw

Re: [PATCH v3 for-4.7 10/16] libxl: add the printf-like attributes to a couple of functions

Quoted 5 lines · Roger Pau Monne

Or else clang complains with:

error: format string is not a string literal

Quoted 45 lines

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_internal.h    | 4 ++--
 tools/libxl/libxl_save_helper.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
tools/libxl/libxl_internal.h +2 -2
index 8e2cf3e..662d01a 100644
@@ -636,7 +636,7 @@ _hidden void *libxl__realloc(libxl__gc *gc_opt, void *ptr, size_t new_size) NN1;
 /* print @fmt into an allocated string large enoughto contain the result.
  * (similar to gc'd asprintf(3)). */
 _hidden char *libxl__sprintf(libxl__gc *gc_opt, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3) NN1;
-_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap);
+_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0);
 /* duplicate the string @c (similar to a gc'd strdup(3)). */
 _hidden char *libxl__strdup(libxl__gc *gc_opt,
                             const char *c /* may be NULL */) NN1;
@@ -709,7 +709,7 @@ _hidden char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid);
  */
 
 int libxl__xs_vprintf(libxl__gc *gc, xs_transaction_t t,
-                      const char *path, const char *fmt, va_list ap);
+                      const char *path, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(4, 0);
 int libxl__xs_printf(libxl__gc *gc, xs_transaction_t t,
                      const char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
 
tools/libxl/libxl_save_helper.c +1 -0
index 5fe642a..d3def6b 100644
@@ -52,6 +52,7 @@
 
 /*----- logger -----*/
 
+__attribute__((format(printf, 5, 0)))
 static void tellparent_vmessage(xentoollog_logger *logger_in,
                                 xentoollog_level level,
                                 int errnoval,
Signature · 1 line
2.6.4 (Apple Git-63)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#17 lore raw

PATCH v3 11/16 libxl: convert libxl__device_model_xs_path to a macro

In reply to Roger Pau Monne

Since it's unsafe to code it as a function because it would end up passing a non literal string to a printf like function.

---
Cc: Wei Liu <[email protected]>
Cc: Ian Jackson <[email protected]>
---
Changes since v2:
- Split the libxl__device_model_xs_path convert to a separate patch.
- s/libxl__device_model_xs_path/DEVICE_MODEL_XS_PATH/

---
 tools/libxl/libxl_device.c      |  2 +-
 tools/libxl/libxl_dm.c          | 20 ++++++++------------
 tools/libxl/libxl_dom.c         |  2 +-
 tools/libxl/libxl_dom_save.c    | 12 ++++++------
 tools/libxl/libxl_dom_suspend.c |  2 +-
 tools/libxl/libxl_internal.c    | 16 ----------------
 tools/libxl/libxl_internal.h    |  7 ++++---
 tools/libxl/libxl_pci.c         | 14 +++++++-------
 8 files changed, 28 insertions(+), 47 deletions(-)
tools/libxl/libxl_device.c +1 -1
index a98707c..f79e536 100644
@@ -1264,7 +1264,7 @@ int libxl__wait_for_device_model_deprecated(libxl__gc *gc,
     char *path;
     uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
 
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     return libxl__xenstore_child_wait_deprecated(gc, domid,
                                      LIBXL_DEVICE_MODEL_START_TIMEOUT,
                                      "Device Model", path, state, spawning,
tools/libxl/libxl_dm.c +8 -12
index fd12844..a1f7bd8 100644
@@ -1762,11 +1762,9 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
     perm[1].perms = XS_PERM_READ;
 retry_transaction:
     t = xs_transaction_start(ctx->xsh);
-    xs_mkdir(ctx->xsh, t,
-             libxl__device_model_xs_path(gc, dm_domid, guest_domid, ""));
+    xs_mkdir(ctx->xsh, t, DEVICE_MODEL_XS_PATH(gc, dm_domid, guest_domid, ""));
     xs_set_permissions(ctx->xsh, t,
-                       libxl__device_model_xs_path(gc, dm_domid,
-                                                   guest_domid, ""),
+                       DEVICE_MODEL_XS_PATH(gc, dm_domid, guest_domid, ""),
                        perm, ARRAY_SIZE(perm));
     if (!xs_transaction_end(ctx->xsh, t, 0))
         if (errno == EAGAIN)
@@ -1926,9 +1924,8 @@ static void stubdom_pvqemu_cb(libxl__egc *egc,
     sdss->xswait.ao = ao;
     sdss->xswait.what = GCSPRINTF("Stubdom %u for %u startup",
                                   dm_domid, sdss->dm.guest_domid);
-    sdss->xswait.path =
-        libxl__device_model_xs_path(gc, dm_domid, sdss->dm.guest_domid,
-                                    "/state");
+    sdss->xswait.path = DEVICE_MODEL_XS_PATH(gc, dm_domid, sdss->dm.guest_domid,
+                                             "/state");
     sdss->xswait.timeout_ms = LIBXL_STUBDOM_START_TIMEOUT * 1000;
     sdss->xswait.callback = stubdom_xswait_cb;
     rc = libxl__xswait_start(gc, &sdss->xswait);
@@ -2035,7 +2032,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
         free(path);
     }
 
-    path = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID, domid, "");
+    path = DEVICE_MODEL_XS_PATH(gc, LIBXL_TOOLSTACK_DOMID, domid, "");
     xs_mkdir(ctx->xsh, XBT_NULL, path);
 
     if (b_info->type == LIBXL_DOMAIN_TYPE_HVM &&
@@ -2089,8 +2086,8 @@ retry_transaction:
     }
 
     spawn->what = GCSPRINTF("domain %d device model", domid);
-    spawn->xspath = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID,
-                                                domid, "/state");
+    spawn->xspath = DEVICE_MODEL_XS_PATH(gc, LIBXL_TOOLSTACK_DOMID, domid,
+                                         "/state");
     spawn->timeout_ms = LIBXL_DEVICE_MODEL_START_TIMEOUT * 1000;
     spawn->pidpath = GCSPRINTF("%s/image/device-model-pid", dom_path);
     spawn->midproc_cb = libxl__spawn_record_pid;
@@ -2320,8 +2317,7 @@ out:
 
 int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid)
 {
-    char *path = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID,
-                                             domid, "");
+    char *path = DEVICE_MODEL_XS_PATH(gc, LIBXL_TOOLSTACK_DOMID, domid, "");
     if (!xs_rm(CTX->xsh, XBT_NULL, path))
         LOG(ERROR, "xs_rm failed for %s", path);
     /* We should try to destroy the device model anyway. */
tools/libxl/libxl_dom.c +1 -1
index 09d3bca..9b20cf5 100644
@@ -1106,7 +1106,7 @@ int libxl__qemu_traditional_cmd(libxl__gc *gc, uint32_t domid,
 {
     char *path = NULL;
     uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/command");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/command");
     return libxl__xs_printf(gc, XBT_NULL, path, "%s", cmd);
 }
 
tools/libxl/libxl_dom_save.c +6 -6
index 821f862..076be04 100644
@@ -62,10 +62,10 @@ static void domain_suspend_switch_qemu_xen_traditional_logdirty
 
     if (!lds->cmd_path) {
         uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
-        lds->cmd_path = libxl__device_model_xs_path(gc, dm_domid, domid,
-                                                    "/logdirty/cmd");
-        lds->ret_path = libxl__device_model_xs_path(gc, dm_domid, domid,
-                                                    "/logdirty/ret");
+        lds->cmd_path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid,
+                                             "/logdirty/cmd");
+        lds->ret_path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid,
+                                             "/logdirty/ret");
     }
     lds->cmd = enable ? "enable" : "disable";
 
@@ -290,7 +290,7 @@ int libxl__save_emulator_xenstore_data(libxl__domain_save_state *dss,
     const uint32_t domid = dss->domid;
     const uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
 
-    xs_root = libxl__device_model_xs_path(gc, dm_domid, domid, "");
+    xs_root = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "");
 
     entries = libxl__xs_directory(gc, 0, GCSPRINTF("%s/physmap", xs_root),
                                   &nr_entries);
@@ -482,7 +482,7 @@ int libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs,
 
     const uint32_t domid = dcs->guest_domid;
     const uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
-    const char *xs_root = libxl__device_model_xs_path(gc, dm_domid, domid, "");
+    const char *xs_root = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "");
 
     while (next < end) {
         key = next;
tools/libxl/libxl_dom_suspend.c +1 -1
index cc0b217..0648919 100644
@@ -432,7 +432,7 @@ int libxl__domain_resume_device_model(libxl__gc *gc, uint32_t domid)
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: {
         uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
 
-        path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+        path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
         state = libxl__xs_read(gc, XBT_NULL, path);
         if (state != NULL && !strcmp(state, "paused")) {
             libxl__qemu_traditional_cmd(gc, domid, "continue");
tools/libxl/libxl_internal.c +0 -16
index e7b765b..3b30f8a 100644
@@ -554,22 +554,6 @@ void libxl__update_domain_configuration(libxl__gc *gc,
     dst->b_info.video_memkb = src->b_info.video_memkb;
 }
 
-char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
-                                  uint32_t domid, const char *format,  ...)
-{
-    char *s, *fmt;
-    va_list ap;
-
-    fmt = GCSPRINTF("/local/domain/%u/device-model/%u%s", dm_domid,
-                    domid, format);
-
-    va_start(ap, format);
-    s = libxl__vsprintf(gc, fmt, ap);
-    va_end(ap);
-
-    return s;
-}
-
 /*
  * Local variables:
  * mode: C
tools/libxl/libxl_internal.h +4 -3
index 662d01a..c791418 100644
@@ -1995,9 +1995,10 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s);
 _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);
   /* Return the system-wide default device model */
 _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc);
-_hidden char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
-                                          uint32_t domid,
-                                          const char *format, ...) PRINTF_ATTRIBUTE(4, 5);
+
+#define DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, fmt, _a...)              \
+    libxl__sprintf(gc, "/local/domain/%u/device-model/%u" fmt, dm_domid,   \
+                   domid, ##_a)
 
 /*
  * Calling context and GC for event-generating functions:
tools/libxl/libxl_pci.c +7 -7
index 300fd4d..ce8d763 100644
@@ -970,9 +970,9 @@ static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t domid,
     uint32_t dm_domid;
 
     dm_domid = libxl_get_stubdom_id(CTX, domid);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     state = libxl__xs_read(gc, XBT_NULL, path);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/parameter");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/parameter");
     if (pcidev->vdevfn) {
         libxl__xs_printf(gc, XBT_NULL, path, PCI_BDF_VDEVFN","PCI_OPTIONS,
                          pcidev->domain, pcidev->bus, pcidev->dev,
@@ -987,9 +987,9 @@ static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t domid,
     libxl__qemu_traditional_cmd(gc, domid, "pci-ins");
     rc = libxl__wait_for_device_model_deprecated(gc, domid, NULL, NULL,
                                       pci_ins_check, state);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/parameter");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/parameter");
     vdevfn = libxl__xs_read(gc, XBT_NULL, path);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     if ( rc < 0 )
         LOG(ERROR, "qemu refused to add device: %s", vdevfn);
     else if ( sscanf(vdevfn, "0x%x", &pcidev->vdevfn) != 1 ) {
@@ -1310,9 +1310,9 @@ static int qemu_pci_remove_xenstore(libxl__gc *gc, uint32_t domid,
 
     dm_domid = libxl_get_stubdom_id(CTX, domid);
 
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     state = libxl__xs_read(gc, XBT_NULL, path);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/parameter");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/parameter");
     libxl__xs_printf(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
                      pcidev->bus, pcidev->dev, pcidev->func);
 
@@ -1330,7 +1330,7 @@ static int qemu_pci_remove_xenstore(libxl__gc *gc, uint32_t domid,
             return ERROR_FAIL;
         }
     }
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
 
     return 0;
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v3 11/16
#18 lore raw

Re: [PATCH v3 for-4.7 11/16] libxl: convert libxl__device_model_xs_path to a macro

Quoted 4 lines · Roger Pau Monne

Since it's unsafe to code it as a function because it would end up passing a non literal string to a printf like function.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#19 lore raw

PATCH v3 12/16 libxl: add explicit casts from yajl_gen_status to yajl_status

In reply to Roger Pau Monne

Or else clang complains with:

implicit conversion from enumeration type 'yajl_gen_status' to different enumeration type 'yajl_status' [-Werror,-Wenum-conversion]

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_json.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
tools/libxl/libxl_json.c +18 -11
index 3b695dd..6bb0695 100644
@@ -617,42 +617,48 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
     int idx = 0;
     yajl_status rc;
 
+#define CONVERT_YAJL_GEN_TO_STATUS(gen) \
+    ((gen) == yajl_gen_status_ok ? yajl_status_ok : yajl_status_error);
+
     switch (obj->type) {
     case JSON_NULL:
-        return yajl_gen_null(hand);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_null(hand));
     case JSON_BOOL:
-        return yajl_gen_bool(hand, obj->u.b);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_bool(hand, obj->u.b));
     case JSON_INTEGER:
-        return yajl_gen_integer(hand, obj->u.i);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_integer(hand, obj->u.i));
     case JSON_DOUBLE:
-        return yajl_gen_double(hand, obj->u.d);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_double(hand, obj->u.d));
     case JSON_NUMBER:
-        return yajl_gen_number(hand, obj->u.string, strlen(obj->u.string));
+        return CONVERT_YAJL_GEN_TO_STATUS(
+                  yajl_gen_number(hand, obj->u.string, strlen(obj->u.string)));
     case JSON_STRING:
-        return libxl__yajl_gen_asciiz(hand, obj->u.string);
+        return CONVERT_YAJL_GEN_TO_STATUS(
+                        libxl__yajl_gen_asciiz(hand, obj->u.string));
     case JSON_MAP: {
         libxl__json_map_node *node = NULL;
 
-        rc = yajl_gen_map_open(hand);
+        rc = CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_map_open(hand));
         if (rc != yajl_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);
+            rc = CONVERT_YAJL_GEN_TO_STATUS(
+                            libxl__yajl_gen_asciiz(hand, node->map_key));
             if (rc != yajl_status_ok)
                 return rc;
             rc = libxl__json_object_to_yajl_gen(gc, hand, node->obj);
             if (rc != yajl_status_ok)
                 return rc;
         }
-        return yajl_gen_map_close(hand);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_map_close(hand));
     }
     case JSON_ARRAY: {
         libxl__json_object *node = NULL;
 
-        rc = yajl_gen_array_open(hand);
+        rc = CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_array_open(hand));
         if (rc != yajl_status_ok)
             return rc;
         for (idx = 0; idx < obj->u.array->count; idx++) {
@@ -662,13 +668,14 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
             if (rc != yajl_status_ok)
                 return rc;
         }
-        return yajl_gen_array_close(hand);
+        return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_array_close(hand));
     }
     case JSON_ANY:
         /* JSON_ANY is not a valid value for obj->type. */
         ;
     }
     abort();
+#undef CONVERT_YAJL_GEN_TO_STATUS
 }
 
 
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#20 lore raw

PATCH v3 13/16 libxl: fix passing the type argument to xc_psr_*

In reply to Roger Pau Monne

The xc_psr_* functions expect the type to be xc_psr_cat_type instead of libxl_psr_cbm_type, so do the conversion.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_psr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/libxl/libxl_psr.c +5 -2
index 3d0dc61..40f2d5f 100644
@@ -298,6 +298,7 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
                           uint64_t cbm)
 {
     GC_INIT(ctx);
+    BUILD_BUG_ON(sizeof(libxl_psr_cbm_type) != sizeof(xc_psr_cat_type));
     int rc;
     int socketid, nr_sockets;
 
@@ -310,7 +311,8 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
     libxl_for_each_set_bit(socketid, *target_map) {
         if (socketid >= nr_sockets)
             break;
-        if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid, cbm)) {
+        if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+                                       socketid, cbm)) {
             libxl__psr_cat_log_err_msg(gc, errno);
             rc = ERROR_FAIL;
         }
@@ -328,7 +330,8 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
     GC_INIT(ctx);
     int rc = 0;
 
-    if (xc_psr_cat_get_domain_data(ctx->xch, domid, type, target, cbm_r)) {
+    if (xc_psr_cat_get_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+                                   target, cbm_r)) {
         libxl__psr_cat_log_err_msg(gc, errno);
         rc = ERROR_FAIL;
     }
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#21 lore raw

PATCH v3 14/16 oxenstored: fix error when shifting negative value

In reply to Roger Pau Monne

By explicitly casting it to unsigned.

Reasoning on why this is needed, provided by Andrew Cooper:

"Ocaml stores integers shifted left by one, and with the bottom bit set.

Values with the bottom bit clear are pointers into the GC'd heap. Values with the bottom bit set are integers, and need to be shifted by 1 bit to have calculations performed."

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- Expand commit message with Andrew's reasoning.

---
 tools/ocaml/xenstored/systemd_stubs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/ocaml/xenstored/systemd_stubs.c +2 -2
index 1bd5dea..a78a72b 100644
@@ -124,7 +124,7 @@ CAMLprim value ocaml_sd_listen_fds(value connect_to)
 	CAMLparam1(connect_to);
 	CAMLlocal1(sock_ret);
 
-	sock_ret = Val_int(-1);
+	sock_ret = Val_int(-1U);
 
 	CAMLreturn(sock_ret);
 }
@@ -144,7 +144,7 @@ CAMLprim value ocaml_sd_notify_ready(value ignore)
 	CAMLparam1(ignore);
 	CAMLlocal1(ret);
 
-	ret = Val_int(-1);
+	ret = Val_int(-1U);
 
 	CAMLreturn(ret);
 }
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v3 14/16
#22 lore raw

Re: [PATCH v3 for-4.7 14/16] oxenstored: fix error when shifting negative value

Quoted 4 lines · Roger Pau Monne

By explicitly casting it to unsigned.

Reasoning on why this is needed, provided by Andrew Cooper:

Quoted 8 lines

"Ocaml stores integers shifted left by one, and with the bottom bit set.

Values with the bottom bit clear are pointers into the GC'd heap. Values with the bottom bit set are integers, and need to be shifted by 1 bit to have calculations performed."

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#23 lore raw

PATCH v3 15/16 tools/python: corrently use LDFLAGS and CFLAGS

In reply to Roger Pau Monne

It is incorrect to add the LDFLAGS to the CFLAGS, and some compilers will error out if linker flags are passed when creating object files. Fix this by properly passing CFLAGS and LDFLAGS, instead of putting everything in CFLAGS.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/python/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tools/python/Makefile +5 -3
index 2363537..da08f46 100644
@@ -4,7 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 .PHONY: all
 all: build
 
-PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) $(LDFLAGS) $(APPEND_LDFLAGS)
+PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
+PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS)
 
 .PHONY: build
 build:
@@ -14,8 +15,9 @@ build:
 install:
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py install \
-		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
+	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
+		setup.py install $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)"  \
+		--force
 
 	$(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#24 lore raw

PATCH v3 16/16 tools/pygrub: fix usage of LDFLAGS

In reply to Roger Pau Monne

LDFLAGS cannot be appended to CFLAGS, instead pass them down as env variables.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/pygrub/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/pygrub/Makefile +4 -3
index fe8e03b..a318490 100644
@@ -2,7 +2,8 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) $(APPEND_LDFLAGS)
+PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
+PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS)
 
 .PHONY: all
 all: build
@@ -12,8 +13,8 @@ build:
 
 .PHONY: install
 install: all
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py install \
-		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" \
+	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
+		setup.py install $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)"  \
 		--install-scripts=$(LIBEXEC_BIN) --force
 	set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
 	             "`readlink -f $(DESTDIR)/$(bindir)`" != \
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#26 lore raw
In reply to Roger Pau Monne
Quoted 10 lines · Roger Pau Monne

Hello,

This is a set of bug fixes for compiling both the hypervisor and the toolstack with clang. I've only tested it with clang 3.8.0 from base FreeBSD, so I'm not sure if it's going to work with _all_ clang versions, but should be better than nothing.

AFAICT, most of the issues that clang found on the toolstack are actual bugs, so it's worth trying to fix them before the release.

Quoted 6 lines

Patches 1-4 are for the hypervisor, while patches 5-16 are for the toolstack.

FWIW, I've also pushed the series to my git repo:

git://xenbits.xen.org/people/royger/xen.git clang_v3

I've release-acked this series and pushed it to staging.

Thanks for your work!

Wei.

Quoted 8 lines

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel