Skip to content

multi-arch+linux-user: Cleanup ELF_MACHINE

Peter Crosthwaite qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest18 of 19 patches 21 repliesIn review

18 of 19 patches are in this archive. The cover letter announces 19.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19linux_user: elfload: Default ELF_MACHINE to ELF_ARCHlinux-user/elfload.c+4 -00 replies
2/19linux-user: elfload: Provide default for elf_check_archlinux-user/elfload.c+4 -240 replies
3/19arm: Remove ELF_MACHINE from cpu.hhw/arm/armv7m.c linux-user/elfload.c target-arm/cpu.h+3 -50 replies
4/19mb: Remove ELF_MACHINE from cpu.hhw/microblaze/boot.c target-microblaze/cpu.h+2 -40 replies
5/19m68k: Remove ELF_MACHINE from cpu.hhw/m68k/an5206.c hw/m68k/dummy_m68k.c hw/m68k/mcf5208.c +1 more+3 -52 replies
6/19cris: Remove ELF_MACHINE from cpu.hhw/cris/boot.c target-cris/cpu.h+1 -30 replies
7/19moxie: Remove ELF_MACHINE from cpu.hhw/moxie/moxiesim.c target-moxie/cpu.h+1 -36 replies
8/19unicore: Remove ELF_MACHINE from cpu.htarget-unicore32/cpu.h+0 -20 replies
10/19or32: Remove ELF_MACHINE from cpu.hhw/openrisc/openrisc_sim.c target-openrisc/cpu.h+1 -20 replies
11/19tricore: Remove ELF_MACHINE from cpu.hhw/tricore/tricore_testboard.c target-tricore/cpu.h+1 -31 reply
12/19xtensa: Remove ELF_MACHINE from cpu.hhw/xtensa/sim.c hw/xtensa/xtfpga.c target-xtensa/cpu.h+3 -40 replies
13/19sh4: Remove ELF_MACHINE from cpu.htarget-sh4/cpu.h+0 -21 reply
14/19s390: Remove ELF_MACHINE from cpu.hhw/s390x/ipl.c target-s390x/cpu.h+2 -30 replies
15/19sparc: Remove ELF_MACHINE from cpu.hhw/sparc/leon3.c hw/sparc/sun4m.c hw/sparc64/sun4u.c +1 more+5 -110 replies
16/19mips: Remove ELF_MACHINE from cpu.hhw/mips/mips_fulong2e.c hw/mips/mips_malta.c hw/mips/mips_mipssim.c +2 more+4 -61 reply
17/19alpha: Remove ELF_MACHINE from cpu.htarget-alpha/cpu.h+0 -20 replies
18/19i386: Rename ELF_MACHINE to be x86 specifichw/i386/multiboot.c target-i386/cpu.h+3 -31 reply
19/19ppc: Rename ELF_MACHINE to be PPC specifichw/ppc/e500.c hw/ppc/mac_newworld.c hw/ppc/mac_oldworld.c +6 more+13 -123 replies

Reviews trailers per patch

5 of 18 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMichael WalleGreg UngererRichard HendersonEduardo HabkostAurelien JarnoBastian KoppelmannLaurent VivierRiku Voipio
SeriesA-b R-b A-b
1/19
2/19
3/19
4/19
5/19R-b R-b
6/19
7/19
8/19
10/19
11/19A-b
12/19
13/19A-b
14/19
15/19
16/19R-b
17/19
18/19R-b A-b
19/19

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 8 reviewers.

Read the v1 thread

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

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(-)
Signature · 1 line
1.9.1