qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 00/19] multi-arch+linux-user: Cleanup ELF_MACHINE


From: Peter Crosthwaite
Subject: [Qemu-devel] [PATCH 00/19] multi-arch+linux-user: Cleanup ELF_MACHINE
Date: Sat, 15 Aug 2015 16:28:10 -0700

Every arch defines ELF_MACHINE in cpu.h to an arch-specific value. This
definition is rarely needed by core code (only in a few cases). It
conflicts with the multi-arch effort where cpu.h cannot export cpu
specifics via macros like this. So remove ELF_MACHINE completely from
all the cpu.h's.

Linux-user defines both ELF_ARCH and ELF_MACHINE, but for most cases
they are the same. So provide a default of ELF_MACHINE == ELF_ARCH to
handle most cases and just minimally define ELF_MACHINE locally in
linux-user where there is a genuine difference.

While touching the code cleanup elf_check_arch in linux-user with
a similar default-based system to minimise the boiler-plate for arch
EM_ code.

Then go arch-by-arch to remove ELF_MACHINE from cpu.h. For many arches
this causes the ELF_MACHINE == ELF_ARCH default to kick in. Some arches
need their bootloader usages of ELF_MACHINE converted to use EM_FOO
directly.

Alpha is unique, in that ELF_MACHINE is completely unused by existing
code.

i386 and ppc are the most complex, where there is a genuine need to
switch ELF_MACHINE depending on the target sub-arch. In these cases
ELF_MACHINE if prefixed to be target specific. This will need further
rethinking to get multi-arch support for those two arches.

There is an argument for keeping the per-arch definitions of the EM,
but the correct place for this would be as virtual field in the QOM
CPU class. Given the refactorings of the series this new field would
be initially unused until we have the notion of a generic system mode
bootloader or refactor linux-user boot to be more QOMified. So leaving
the defs deleted for the moment for later revival.

Regards,
Peter

Peter Crosthwaite (19):
  linux_user: elfload: Default ELF_MACHINE to ELF_ARCH
  linux-user: elfload: Provide default for elf_check_arch
  arm: Remove ELF_MACHINE from cpu.h
  mb: Remove ELF_MACHINE from cpu.h
  m68k: Remove ELF_MACHINE from cpu.h
  cris: Remove ELF_MACHINE from cpu.h
  moxie: Remove ELF_MACHINE from cpu.h
  unicore: Remove ELF_MACHINE from cpu.h
  lm32: Remove ELF_MACHINE from cpu.h
  or32: Remove ELF_MACHINE from cpu.h
  tricore: Remove ELF_MACHINE from cpu.h
  xtensa: Remove ELF_MACHINE from cpu.h
  sh4: Remove ELF_MACHINE from cpu.h
  s390: Remove ELF_MACHINE from cpu.h
  sparc: Remove ELF_MACHINE from cpu.h
  mips: Remove ELF_MACHINE from cpu.h
  alpha: Remove ELF_MACHINE from cpu.h
  i386: Rename ELF_MACHINE to be x86 specific
  ppc: Rename ELF_MACHINE to be PPC specific

 hw/arm/armv7m.c                |  2 +-
 hw/cris/boot.c                 |  2 +-
 hw/i386/multiboot.c            |  2 +-
 hw/lm32/lm32_boards.c          |  4 ++--
 hw/lm32/milkymist.c            |  2 +-
 hw/m68k/an5206.c               |  2 +-
 hw/m68k/dummy_m68k.c           |  2 +-
 hw/m68k/mcf5208.c              |  2 +-
 hw/microblaze/boot.c           |  4 ++--
 hw/mips/mips_fulong2e.c        |  2 +-
 hw/mips/mips_malta.c           |  2 +-
 hw/mips/mips_mipssim.c         |  2 +-
 hw/mips/mips_r4k.c             |  2 +-
 hw/moxie/moxiesim.c            |  2 +-
 hw/openrisc/openrisc_sim.c     |  2 +-
 hw/ppc/e500.c                  |  2 +-
 hw/ppc/mac_newworld.c          |  4 ++--
 hw/ppc/mac_oldworld.c          |  4 ++--
 hw/ppc/ppc440_bamboo.c         |  2 +-
 hw/ppc/prep.c                  |  2 +-
 hw/ppc/spapr.c                 |  4 ++--
 hw/ppc/virtex_ml507.c          |  2 +-
 hw/s390x/ipl.c                 |  4 ++--
 hw/sparc/leon3.c               |  2 +-
 hw/sparc/sun4m.c               |  4 ++--
 hw/sparc64/sun4u.c             |  4 ++--
 hw/tricore/tricore_testboard.c |  2 +-
 hw/xtensa/sim.c                |  4 ++--
 hw/xtensa/xtfpga.c             |  2 +-
 linux-user/elfload.c           | 37 +++++++++++--------------------------
 target-alpha/cpu.h             |  2 --
 target-arm/cpu.h               |  2 --
 target-cris/cpu.h              |  2 --
 target-i386/cpu.h              |  4 ++--
 target-lm32/cpu.h              |  2 --
 target-m68k/cpu.h              |  2 --
 target-microblaze/cpu.h        |  2 --
 target-mips/cpu.h              |  2 --
 target-moxie/cpu.h             |  2 --
 target-openrisc/cpu.h          |  1 -
 target-ppc/cpu.h               |  4 ++--
 target-s390x/cpu.h             |  1 -
 target-sh4/cpu.h               |  2 --
 target-sparc/cpu.h             |  6 ------
 target-tricore/cpu.h           |  2 --
 target-unicore32/cpu.h         |  2 --
 target-xtensa/cpu.h            |  1 -
 47 files changed, 53 insertions(+), 99 deletions(-)

-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]