[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] tools: pass EXTRA_CFLAGS via environment


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Fri, 08 Jun 2012 00:44:09 +0000
  • Delivery-date: Fri, 08 Jun 2012 00:44:19 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1339091502 -3600
# Node ID 75a2bb5db2280163265c2c6b1d536869108aa9af
# Parent  e41a97112e0cf37ec382fdc02761d0c45984010c
tools: pass EXTRA_CFLAGS via environment

Currently qemu-xen will be compiled with CFLAGS only if CFLAGS was
already in the environment during make invocation. If CFLAGS is in
environment then make will append all of the various flags specified in
xen Makefiles to this environment variable, which is then used in qemu
configure. Since qemu-xen is not ready for compiler flags like
"-std=gnu99" compilation will fail. If CFLAGS is not in environment,
then configure will use just its own "-O2 -g" because make does not
export its own CFLAGS variable.

>From a distro perspective, it is required to build libraries and
binaries with certain global cflags (arbitrary gcc options). Up to the
point when qemu-xen was imported it worked as expected by exporting
CFLAGS before 'make tools'.  Now qemu-upstream reuses these CFLAGS, but
it cant deal with the result.

This patch extends the tools Makefiles so that three new environment
variables are recognized:
  EXTRA_CFLAGS_XEN_TOOLS= specifies CFLAGS for the tools build.
  EXTRA_CFLAGS_QEMU_TRADITIONAL= specifies CFLAGS for old qemu.
  EXTRA_CFLAGS_QEMU_XEN= specifies CFLAGS for new qemu.

Special care needs to be taken in tools/firmware because the resulting
binaries are not linked with the hosts runtime libraries. These binaries
run in guest context. To avoid build errors from gcc options like
-fstack-protector, reuse existing practice to unset the new
EXTRA_CFLAGS_XEN_TOOLS for the firmware dirs.

The new feature can be used like this in a rpm xen.spec file:

   export EXTRA_CFLAGS_XEN_TOOLS="${RPM_OPT_FLAGS}"
   export EXTRA_CFLAGS_QEMU_TRADITIONAL="${RPM_OPT_FLAGS}"
   export EXTRA_CFLAGS_QEMU_XEN="${RPM_OPT_FLAGS}"
   ./configure \
        --libdir=%{_libdir} \
        --prefix=/usr
   make

   Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r e41a97112e0c -r 75a2bb5db228 tools/Makefile
--- a/tools/Makefile    Thu Jun 07 18:45:22 2012 +0100
+++ b/tools/Makefile    Thu Jun 07 18:51:42 2012 +0100
@@ -122,7 +122,9 @@ subdir-all-qemu-xen-traditional-dir subd
        set -e; \
                $(buildmakevars2shellvars); \
                cd qemu-xen-traditional-dir; \
-               $(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS); \
+               $(QEMU_ROOT)/xen-setup \
+               --extra-cflags="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \
+               $(IOEMU_CONFIGURE_CROSS); \
                $(MAKE) install
 
 subdir-clean-qemu-xen-traditional-dir:
@@ -151,7 +153,8 @@ subdir-all-qemu-xen-dir subdir-install-q
                --extra-cflags="-I$(XEN_ROOT)/tools/include \
                -I$(XEN_ROOT)/tools/libxc \
                -I$(XEN_ROOT)/tools/xenstore \
-               -I$(XEN_ROOT)/tools/xenstore/compat" \
+               -I$(XEN_ROOT)/tools/xenstore/compat \
+               $(EXTRA_CFLAGS_QEMU_XEN)" \
                --extra-ldflags="-L$(XEN_ROOT)/tools/libxc \
                -L$(XEN_ROOT)/tools/xenstore" \
                --bindir=$(LIBEXEC) \
diff -r e41a97112e0c -r 75a2bb5db228 tools/Rules.mk
--- a/tools/Rules.mk    Thu Jun 07 18:45:22 2012 +0100
+++ b/tools/Rules.mk    Thu Jun 07 18:51:42 2012 +0100
@@ -76,6 +76,8 @@ endif
 CFLAGS-$(CONFIG_X86_32) += $(call cc-option,$(CC),-mno-tls-direct-seg-refs)
 CFLAGS += $(CFLAGS-y)
 
+CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
+
 # Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
 check-$(CONFIG_X86) = $(call cc-ver-check,CC,0x030400,\
                         "Xen requires at least gcc-3.4")
diff -r e41a97112e0c -r 75a2bb5db228 tools/firmware/Rules.mk
--- a/tools/firmware/Rules.mk   Thu Jun 07 18:45:22 2012 +0100
+++ b/tools/firmware/Rules.mk   Thu Jun 07 18:51:42 2012 +0100
@@ -3,6 +3,7 @@ override XEN_TARGET_ARCH = x86_32
 
 # User-supplied CFLAGS are not useful here.
 CFLAGS =
+EXTRA_CFLAGS_XEN_TOOLS =
 
 include $(XEN_ROOT)/tools/Rules.mk
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.