Olaf Hering
2012-Mar-27 12:42 UTC
[PATCH] tools/configure: add options to pass EXTRA_CLFAGS
# HG changeset patch # User Olaf Hering <olaf@aepfle.de> # Date 1332851995 -7200 # Node ID 9c6337771520b390ed624fa6b6b2f2edc8042701 # Parent d9e6e8632bb6b9a2144e7e148bc7ea53ea4933fd tools/configure: add options to pass EXTRA_CLFAGS 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 "-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 configure to recognize three environment variables which will be written to config/Tools.mk so they will be reused with each make invocation: 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. The new feature can be used like this in a rpm xen.spec file: env \ EXTRA_CFLAGS_XEN_TOOLS="${RPM_OPT_FLAGS}" \ EXTRA_CFLAGS_QEMU_TRADITIONAL="${RPM_OPT_FLAGS}" \ EXTRA_CFLAGS_QEMU_XEN="${RPM_OPT_FLAGS}" \ ./configure \ --libdir=%{_libdir} \ --prefix=/usr make v2: - add new EXTRA_CFLAGS_XEN_TOOLS variable to config/Tools.mk.in instead of modifying CFLAGS in this file. Also remove include order change in tools/Rules.mk since its now not needed anymore - add EXTRA_CFLAGS_XEN_TOOLS to all rules in tools/Rules.mk - update help output in tools/configure.ac Signed-off-by: Olaf Hering <olaf@aepfle.de> diff -r d9e6e8632bb6 -r 9c6337771520 config/Tools.mk.in --- a/config/Tools.mk.in +++ b/config/Tools.mk.in @@ -22,6 +22,10 @@ PREPEND_LIB := @PREPEND_LIB@ APPEND_INCLUDES := @APPEND_INCLUDES@ APPEND_LIB := @APPEND_LIB@ +EXTRA_CFLAGS_XEN_TOOLS := @EXTRA_CFLAGS_XEN_TOOLS@ +EXTRA_CFLAGS_QEMU_TRADITIONAL := @EXTRA_CFLAGS_QEMU_TRADITIONAL@ +EXTRA_CFLAGS_QEMU_XEN := @EXTRA_CFLAGS_QEMU_XEN@ + # Download GIT repositories via HTTP or GIT''s own protocol? # GIT''s protocol is faster and more robust, when it works at all (firewalls # may block it). We make it the default, but if your GIT repository downloads diff -r d9e6e8632bb6 -r 9c6337771520 tools/Makefile --- a/tools/Makefile +++ b/tools/Makefile @@ -122,6 +122,7 @@ subdir-all-qemu-xen-traditional-dir subd set -e; \ $(buildmakevars2shellvars); \ cd qemu-xen-traditional-dir; \ + env CFLAGS="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \ $(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS); \ $(MAKE) install @@ -146,6 +147,7 @@ subdir-all-qemu-xen-dir subdir-install-q source=.; \ fi; \ cd qemu-xen-dir; \ + env CFLAGS="$(EXTRA_CFLAGS_QEMU_XEN)" \ $$source/configure --enable-xen --target-list=i386-softmmu \ --source-path=$$source \ --extra-cflags="-I$(XEN_ROOT)/tools/include \ diff -r d9e6e8632bb6 -r 9c6337771520 tools/Rules.mk --- a/tools/Rules.mk +++ b/tools/Rules.mk @@ -85,18 +85,18 @@ INSTALL_PYTHON_PROG = \ $(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG) %.opic: %.c - $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS) + $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS) %.o: %.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $< $(APPEND_CFLAGS) + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $< $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS) %.o: %.cc - $(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $< $(APPEND_CFLAGS) + $(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $< $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS) %.o: %.S - $(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@ $(APPEND_CFLAGS) + $(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@ $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS) %.opic: %.S - $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS) + $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(EXTRA_CFLAGS_XEN_TOOLS) $(APPEND_CFLAGS) subdirs-all subdirs-clean subdirs-install subdirs-distclean: .phony @set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \ diff -r d9e6e8632bb6 -r 9c6337771520 tools/configure.ac --- a/tools/configure.ac +++ b/tools/configure.ac @@ -55,6 +55,12 @@ AC_ARG_VAR([APPEND_INCLUDES], [List of include folders to append to CFLAGS (without -I)]) AC_ARG_VAR([APPEND_LIB], [List of library folders to append to LDFLAGS (without -L)]) +AC_ARG_VAR([EXTRA_CFLAGS_XEN_TOOLS], + [Extra CFLAGS to build Xen tools]) +AC_ARG_VAR([EXTRA_CFLAGS_QEMU_TRADITIONAL], + [Extra CFLAGS to build qemu-xen-traditional]) +AC_ARG_VAR([EXTRA_CFLAGS_QEMU_XEN], + [Extra CFLAGS to build qemu-xen-upstream]) AX_SET_FLAGS
Olaf Hering
2012-Mar-27 13:04 UTC
Re: [PATCH] tools/configure: add options to pass EXTRA_CLFAGS
On Tue, Mar 27, Olaf Hering wrote:> # HG changeset patch > # User Olaf Hering <olaf@aepfle.de> > # Date 1332851995 -7200 > # Node ID 9c6337771520b390ed624fa6b6b2f2edc8042701 > # Parent d9e6e8632bb6b9a2144e7e148bc7ea53ea4933fd > tools/configure: add options to pass EXTRA_CLFAGS >> - add EXTRA_CFLAGS_XEN_TOOLS to all rules in tools/Rules.mkUnfortunately this approach does not seem to work: ld -melf_i386 -s -r 32bitbios.o tcgbios/tcgbiosext.o util.o pmm.o -o 32bitbios_all.o There are undefined symbols in the BIOS: U __stack_chk_fail make[9]: *** [32bitbios_all.o] Error 11 I will revisit this change. Olaf
Possibly Parallel Threads
- pv-grub will cause page fault if build with flag -fstack-protector
- [PATCH 0 of 2 RESEND] tools: add two new compile flags and perform checks on user defined folders.
- Xen Security Advisory 25 (CVE-2012-4544) - Xen domain builder Out-of-memory due to malicious kernel/ramdisk
- Xen Security Advisory 25 (CVE-2012-4544, CVE-2012-2625) - Xen domain builder Out-of-memory due to malicious kernel/ramdisk
- xen_4.4.0-1_amd64.changes ACCEPTED into unstable, unstable