dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame qemu-fix-linux-user-build-on-ppc.patch

Mark McLoughlin 904b1d
From 8f4d4cb4e4e73d0533aa2cb421c14210c75f6edc Mon Sep 17 00:00:00 2001
Mark McLoughlin 081ecc
From: Mark McLoughlin <markmc@redhat.com>
Mark McLoughlin 081ecc
Date: Mon, 29 Jun 2009 14:49:03 +0100
Mark McLoughlin a4e945
Subject: [PATCH] Fix linux-user build on ppc
Mark McLoughlin 081ecc
Mark McLoughlin 081ecc
kvm-87 build fails on ppc:
Mark McLoughlin 081ecc
Mark McLoughlin 081ecc
  https://koji.fedoraproject.org/koji/getfile?taskID=1441042&name=build.log
Mark McLoughlin 081ecc
Mark McLoughlin 081ecc
  gcc -I. -I.. -I/builddir/build/BUILD/qemu-kvm-devel-87/target-i386
Mark McLoughlin 081ecc
  -I/builddir/build/BUILD/qemu-kvm-devel-87 -MMD -MT elfload.o -MP
Mark McLoughlin 081ecc
  -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
Mark McLoughlin 081ecc
  -D__user= -I/builddir/build/BUILD/qemu-kvm-devel-87/tcg
Mark McLoughlin 081ecc
  -I/builddir/build/BUILD/qemu-kvm-devel-87/tcg/ppc64
Mark McLoughlin 081ecc
  -I/builddir/build/BUILD/qemu-kvm-devel-87/fpu
Mark McLoughlin 081ecc
  -I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user
Mark McLoughlin 081ecc
  -I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/i386 -O2 -g -pipe
Mark McLoughlin 081ecc
  -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
Mark McLoughlin 081ecc
  --param=ssp-buffer-size=4 -m64 -mminimal-toc -g -fno-strict-aliasing
Mark McLoughlin 081ecc
  -O2 -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes
Mark McLoughlin 081ecc
  -Wstrict-prototypes -Wredundant-decls    -c -o elfload.o
Mark McLoughlin 081ecc
  /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c
Mark McLoughlin 081ecc
  /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:214: error: conflicting types for 'elf_greg_t'
Mark McLoughlin 081ecc
  /usr/include/asm/elf.h:123: note: previous declaration of 'elf_greg_t' was here
Mark McLoughlin 081ecc
  /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:220: error: conflicting types for 'elf_gregset_t'
Mark McLoughlin 081ecc
  /usr/include/asm/elf.h:124: note: previous declaration of 'elf_gregset_t' was here
Mark McLoughlin 081ecc
  In file included from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:697:
Mark McLoughlin 081ecc
  ../elf.h:457:1: warning: "R_PPC_NUM" redefined
Mark McLoughlin 081ecc
  In file included from /usr/include/asm/sigcontext.h:13,
Mark McLoughlin 081ecc
                   from /usr/include/bits/sigcontext.h:28,
Mark McLoughlin 081ecc
                   from /usr/include/signal.h:339,
Mark McLoughlin 081ecc
                   from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/qemu.h:4,
Mark McLoughlin 081ecc
                   from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:16:
Mark McLoughlin 081ecc
  /usr/include/asm/elf.h:81:1: warning: this is the location of the previous definition
Mark McLoughlin 081ecc
Mark McLoughlin 081ecc
Problem seems to be that signal.h is pulling in a bunch of ppc
Mark McLoughlin 081ecc
headers which expose elf_greg_t, R_PPC_* and PPC_FEATURE_*.
Mark McLoughlin 081ecc
Mark McLoughlin 081ecc
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Mark McLoughlin 661451
Fedora-patch: qemu-fix-linux-user-build-on-ppc.patch
Mark McLoughlin 081ecc
---
Mark McLoughlin 081ecc
 elf.h                |    2 ++
Mark McLoughlin 081ecc
 linux-user/elfload.c |   10 ++++++++++
Mark McLoughlin 081ecc
 2 files changed, 12 insertions(+), 0 deletions(-)
Mark McLoughlin 081ecc
Mark McLoughlin 081ecc
diff --git a/elf.h b/elf.h
Mark McLoughlin 081ecc
index b042002..14f8aa1 100644
Mark McLoughlin 081ecc
--- a/elf.h
Mark McLoughlin 081ecc
+++ b/elf.h
Mark McLoughlin 081ecc
@@ -454,7 +454,9 @@ typedef struct {
Mark McLoughlin 081ecc
 #define R_PPC_SECTOFF_HI	35
Mark McLoughlin 081ecc
 #define R_PPC_SECTOFF_HA	36
Mark McLoughlin 081ecc
 /* Keep this the last entry.  */
Mark McLoughlin 081ecc
+#ifndef R_PPC_NUM
Mark McLoughlin 081ecc
 #define R_PPC_NUM		37
Mark McLoughlin 081ecc
+#endif /* R_PPC_NUM */
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
 /* ARM specific declarations */
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
Mark McLoughlin 6780ef
index 3a8268b..d283f73 100644
Mark McLoughlin 081ecc
--- a/linux-user/elfload.c
Mark McLoughlin 081ecc
+++ b/linux-user/elfload.c
Mark McLoughlin 081ecc
@@ -134,6 +134,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
Mark McLoughlin 081ecc
     regs->rip = infop->entry;
Mark McLoughlin 081ecc
 }
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
+#ifdef FIX_BROKEN_PPC_BUILD
Mark McLoughlin 081ecc
 typedef target_ulong    elf_greg_t;
Mark McLoughlin 081ecc
 typedef uint32_t        target_uid_t;
Mark McLoughlin 081ecc
 typedef uint32_t        target_gid_t;
Mark McLoughlin 081ecc
@@ -179,6 +180,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env)
Mark McLoughlin 081ecc
     (*regs)[25] = env->segs[R_FS].selector & 0xffff;
Mark McLoughlin 081ecc
     (*regs)[26] = env->segs[R_GS].selector & 0xffff;
Mark McLoughlin 081ecc
 }
Mark McLoughlin 081ecc
+#endif /* FIX_BROKEN_PPC_BUILD */
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
 #else
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
@@ -211,6 +213,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
Mark McLoughlin 081ecc
     regs->edx = 0;
Mark McLoughlin 081ecc
 }
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
+#ifdef FIX_BROKEN_PPC_BUILD
Mark McLoughlin 081ecc
 typedef target_ulong    elf_greg_t;
Mark McLoughlin 081ecc
 typedef uint16_t        target_uid_t;
Mark McLoughlin 081ecc
 typedef uint16_t        target_gid_t;
Mark McLoughlin 081ecc
@@ -246,9 +249,12 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env)
Mark McLoughlin 081ecc
     (*regs)[15] = env->regs[R_ESP];
Mark McLoughlin 081ecc
     (*regs)[16] = env->segs[R_SS].selector & 0xffff;
Mark McLoughlin 081ecc
 }
Mark McLoughlin 081ecc
+#endif /* FIX_BROKEN_PPC_BUILD */
Mark McLoughlin 081ecc
 #endif
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
+#ifdef FIX_BROKEN_PPC_BUILD
Mark McLoughlin 081ecc
 #define USE_ELF_CORE_DUMP
Mark McLoughlin 081ecc
+#endif /* FIX_BROKEN_PPC_BUILD */
Mark McLoughlin 081ecc
 #define ELF_EXEC_PAGESIZE	4096
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
 #endif
Mark McLoughlin 081ecc
@@ -286,6 +292,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
Mark McLoughlin 081ecc
     regs->ARM_r10 = infop->start_data;
Mark McLoughlin 081ecc
 }
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
+#ifdef FIX_BROKEN_PPC_BUILD
Mark McLoughlin 081ecc
 typedef uint32_t elf_greg_t;
Mark McLoughlin 081ecc
 typedef uint16_t target_uid_t;
Mark McLoughlin 081ecc
 typedef uint16_t target_gid_t;
Mark McLoughlin 081ecc
@@ -318,6 +325,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env)
Mark McLoughlin 081ecc
 }
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
 #define USE_ELF_CORE_DUMP
Mark McLoughlin 081ecc
+#endif /* FIX_BROKEN_PPC_BUILD */
Mark McLoughlin 081ecc
 #define ELF_EXEC_PAGESIZE	4096
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
 enum
Mark McLoughlin 081ecc
@@ -421,6 +429,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
 /* Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP).
Mark McLoughlin 081ecc
    See arch/powerpc/include/asm/cputable.h.  */
Mark McLoughlin 081ecc
+#ifndef PPC_FEATURE_32
Mark McLoughlin 081ecc
 enum {
Mark McLoughlin 081ecc
     PPC_FEATURE_32 = 0x80000000,
Mark McLoughlin 081ecc
     PPC_FEATURE_64 = 0x40000000,
Mark McLoughlin 081ecc
@@ -452,6 +461,7 @@ enum {
Mark McLoughlin 081ecc
     PPC_FEATURE_TRUE_LE = 0x00000002,
Mark McLoughlin 081ecc
     PPC_FEATURE_PPC_LE = 0x00000001,
Mark McLoughlin 081ecc
 };
Mark McLoughlin 081ecc
+#endif /* !defined(PPC_FEATURE_32) */
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
 #define ELF_HWCAP get_elf_hwcap()
Mark McLoughlin 081ecc
 
Mark McLoughlin 081ecc
-- 
Mark McLoughlin a4e945
1.6.2.5
Mark McLoughlin 081ecc