From 98d891d2c01ca96b81b53ce80ac97c707203852f Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Jun 29 2009 14:01:31 +0000 Subject: Work around broken linux-user build on ppc --- diff --git a/qemu-fix-broken-elf-coredump-build-on-ppc.patch b/qemu-fix-broken-elf-coredump-build-on-ppc.patch new file mode 100644 index 0000000..69bf495 --- /dev/null +++ b/qemu-fix-broken-elf-coredump-build-on-ppc.patch @@ -0,0 +1,103 @@ +From 028b1596140ca9f0965808ed8cbd599659ded728 Mon Sep 17 00:00:00 2001 +From: Mark McLoughlin +Date: Mon, 29 Jun 2009 14:49:03 +0100 +Subject: [PATCH] Fix broken ELF coredump build on ppc + +kvm-87 build fails on ppc: + + https://koji.fedoraproject.org/koji/getfile?taskID=1441042&name=build.log + + gcc -I. -I.. -I/builddir/build/BUILD/qemu-kvm-devel-87/target-i386 + -I/builddir/build/BUILD/qemu-kvm-devel-87 -MMD -MT elfload.o -MP + -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + -D__user= -I/builddir/build/BUILD/qemu-kvm-devel-87/tcg + -I/builddir/build/BUILD/qemu-kvm-devel-87/tcg/ppc64 + -I/builddir/build/BUILD/qemu-kvm-devel-87/fpu + -I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user + -I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/i386 -O2 -g -pipe + -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector + --param=ssp-buffer-size=4 -m64 -mminimal-toc -g -fno-strict-aliasing + -O2 -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes + -Wstrict-prototypes -Wredundant-decls -c -o elfload.o + /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c + /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:214: error: conflicting types for 'elf_greg_t' + /usr/include/asm/elf.h:123: note: previous declaration of 'elf_greg_t' was here + /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:220: error: conflicting types for 'elf_gregset_t' + /usr/include/asm/elf.h:124: note: previous declaration of 'elf_gregset_t' was here + In file included from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:697: + ../elf.h:457:1: warning: "R_PPC_NUM" redefined + In file included from /usr/include/asm/sigcontext.h:13, + from /usr/include/bits/sigcontext.h:28, + from /usr/include/signal.h:339, + from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/qemu.h:4, + from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:16: + /usr/include/asm/elf.h:81:1: warning: this is the location of the previous definition + +Code was introduced in kvm-87 by: + + 9edc5d7966 linux-user: added x86 and x86_64 support for ELF coredump + edf8e2af14 linux-user: implemented ELF coredump support for ARM target + +It seems ppc kernel-headers is unusual in exposing elf_greg_t +definitions. Other arches seem to avoid doing that. + +Signed-off-by: Mark McLoughlin +--- + linux-user/elfload.c | 6 ++++++ + 1 files changed, 6 insertions(+), 0 deletions(-) + +diff --git a/linux-user/elfload.c b/linux-user/elfload.c +index d31cca7..1b3fbe4 100644 +--- a/linux-user/elfload.c ++++ b/linux-user/elfload.c +@@ -134,6 +134,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i + regs->rip = infop->entry; + } + ++#ifdef FIX_BROKEN_PPC_BUILD + typedef target_ulong elf_greg_t; + typedef uint32_t target_uid_t; + typedef uint32_t target_gid_t; +@@ -179,6 +180,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env) + (*regs)[25] = env->segs[R_FS].selector & 0xffff; + (*regs)[26] = env->segs[R_GS].selector & 0xffff; + } ++#endif /* FIX_BROKEN_PPC_BUILD */ + + #else + +@@ -211,6 +213,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i + regs->edx = 0; + } + ++#ifdef FIX_BROKEN_PPC_BUILD + typedef target_ulong elf_greg_t; + typedef uint16_t target_uid_t; + typedef uint16_t target_gid_t; +@@ -249,6 +252,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env) + #endif + + #define USE_ELF_CORE_DUMP ++#endif /* FIX_BROKEN_PPC_BUILD */ + #define ELF_EXEC_PAGESIZE 4096 + + #endif +@@ -286,6 +290,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i + regs->ARM_r10 = infop->start_data; + } + ++#ifdef FIX_BROKEN_PPC_BUILD + typedef uint32_t elf_greg_t; + typedef uint16_t target_uid_t; + typedef uint16_t target_gid_t; +@@ -318,6 +323,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env) + } + + #define USE_ELF_CORE_DUMP ++#endif /* FIX_BROKEN_PPC_BUILD */ + #define ELF_EXEC_PAGESIZE 4096 + + enum +-- +1.6.2.5 + diff --git a/qemu.spec b/qemu.spec index 3822537..6c3fa0b 100644 --- a/qemu.spec +++ b/qemu.spec @@ -19,9 +19,12 @@ Source2: kvm.modules # Not upstream, why? Patch01: qemu-bios-bigger-roms.patch -# Fixes ppc build, cherry-picked from upstream +# Fixes ppc-softmmu target build, cherry-picked from upstream Patch02: qemu-fix-ppc-softmmu-kvm-disabled-build.patch +# Works around broken linux-user build on ppc +Patch03: qemu-fix-broken-elf-coredump-build-on-ppc.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel BuildRequires: rsync dev86 iasl @@ -204,6 +207,7 @@ such as kvmtrace and kvm_stat. %patch01 -p1 %patch02 -p1 +%patch03 -p1 %build # systems like rhel build system does not have a recent enough linker so @@ -451,6 +455,7 @@ fi - Update to kvm-87 - Drop upstreamed patches - Cherry-pick new ppc build fix from upstream +- Work around broken linux-user build on ppc - Re-enable preadv()/pwritev() since #497429 is long since fixed * Fri Jun 5 2009 Mark McLoughlin - 2:0.10.50-6.kvm86