From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmigW-0003lf-RV for qemu-devel@nongnu.org; Tue, 20 May 2014 07:58:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmigQ-0005gr-Le for qemu-devel@nongnu.org; Tue, 20 May 2014 07:58:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50101) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmigQ-0005gh-EB for qemu-devel@nongnu.org; Tue, 20 May 2014 07:58:14 -0400 From: Laszlo Ersek Date: Tue, 20 May 2014 13:39:45 +0200 Message-Id: <1400585987-6285-6-git-send-email-lersek@redhat.com> In-Reply-To: <1400585987-6285-1-git-send-email-lersek@redhat.com> References: <1400585987-6285-1-git-send-email-lersek@redhat.com> Subject: [Qemu-devel] [PATCH 5/7] dump: select header bitness based on ELF class, not ELF architecture List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Luiz Capitulino , Qiao Nuohan , Paolo Bonzini , Ekaterina Tumanova , Christian Borntraeger , "Aneesh Kumar K.V" The specific ELF architecture (d_machine) carries Too Much Information (TM) for deciding between create_header32() and create_header64(), use "d_class" instead (ELFCLASS32 vs. ELFCLASS64). This change adapts write_dump_header() to write_elf_loads(), dump_begin() etc. that also rely on the ELF class of the target for bitness selection. Considering the current targets that support dumping, cpu_get_dump_info() works as follows: - target-s390x/arch_dump.c: (EM_S390, ELFCLASS64) only - target-ppc/arch_dump.c (EM_PPC64, ELFCLASS64) only - target-i386/arch_dump.c: sets (EM_X86_64, ELFCLASS64) vs. (EM_386, ELFCLASS32) keying off the same Long Mode Active flag. Hence no observable change. Approximately-suggested-by: Paolo Bonzini Signed-off-by: Laszlo Ersek --- dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dump.c b/dump.c index e0a606f..7e0982b 100644 --- a/dump.c +++ b/dump.c @@ -998,11 +998,11 @@ out: return ret; } static int write_dump_header(DumpState *s) { - if (s->dump_info.d_machine == EM_386) { + if (s->dump_info.d_class == ELFCLASS32) { return create_header32(s); } else { return create_header64(s); } } -- 1.8.3.1