zdump: since we create ELF version 1 files use this value explicitly

The value of `EV_CURRENT` might change. The ELF specification says: "The value
of EV_CURRENT, though given as 1 above, will change as necessary to reflect the
current version number." [1]

[1] https://refspecs.linuxfoundation.org/elf/elf.pdf

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2022-03-23 12:36:09 +01:00
committed by Jan Höppner
parent eef0dd4fa4
commit 922e8cbb2f
2 changed files with 6 additions and 2 deletions

View File

@@ -16,13 +16,13 @@ void *ehdr_init(Elf64_Ehdr *ehdr, Elf64_Half phnum)
memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
ehdr->e_ident[EI_CLASS] = ELFCLASS64;
ehdr->e_ident[EI_DATA] = ELFDATA2MSB;
ehdr->e_ident[EI_VERSION] = EV_CURRENT;
ehdr->e_ident[EI_VERSION] = ELF_VERSION_1;
ehdr->e_ident[EI_OSABI] = ELFOSABI_SYSV;
ehdr->e_ident[EI_ABIVERSION] = 0;
memset(ehdr->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD);
ehdr->e_type = ET_CORE;
ehdr->e_machine = EM_S390;
ehdr->e_version = EV_CURRENT;
ehdr->e_version = ELF_VERSION_1;
ehdr->e_entry = 0;
ehdr->e_phoff = sizeof(Elf64_Ehdr);
ehdr->e_shoff = 0;

View File

@@ -21,6 +21,10 @@
#include "zg.h"
#include "dfi.h"
#ifndef ELF_VERSION_1
#define ELF_VERSION_1 0x1
#endif
/*
* S390 CPU timer note (u64)
*/