From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYt8b-0001tc-1a for qemu-devel@nongnu.org; Mon, 07 Sep 2015 05:54:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYt8X-0006m3-Lz for qemu-devel@nongnu.org; Mon, 07 Sep 2015 05:54:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYt8X-0006lt-Ff for qemu-devel@nongnu.org; Mon, 07 Sep 2015 05:54:53 -0400 References: From: Paolo Bonzini Message-ID: <55ED5EE7.3060201@redhat.com> Date: Mon, 7 Sep 2015 11:54:47 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 00/19] multi-arch+linux-user: Cleanup ELF_MACHINE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , qemu-devel@nongnu.org Cc: riku.voipio@iki.fi, Peter Crosthwaite On 16/08/2015 01:28, Peter Crosthwaite wrote: > 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(-) > Peter, I suggest that you send a pull request yourself for this and the Moxie change. Paolo