diff options
author | Olaf Hering <olaf@aepfle.de> | 2012-06-07 18:51:42 +0100 |
---|---|---|
committer | Olaf Hering <olaf@aepfle.de> | 2012-06-07 18:51:42 +0100 |
commit | 338c4375153e39b95ddc82f2ed95f85dd73e0245 (patch) | |
tree | 823d84cdacb25a2251c5c99050b0eeef7c2dacae /tools/Rules.mk | |
parent | 00a279eb5f4d8ae568f36de14892c3859d9cf682 (diff) | |
download | xen-338c4375153e39b95ddc82f2ed95f85dd73e0245.tar.gz xen-338c4375153e39b95ddc82f2ed95f85dd73e0245.tar.bz2 xen-338c4375153e39b95ddc82f2ed95f85dd73e0245.zip |
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@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/Rules.mk')
-rw-r--r-- | tools/Rules.mk | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/Rules.mk b/tools/Rules.mk index a2a1a5846a..1e928b7b22 100644 --- a/tools/Rules.mk +++ b/tools/Rules.mk @@ -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") |