From 922e8cbb2fa348e9c0a7fcccc6b69eae3fcf2c9d Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Wed, 23 Mar 2022 12:36:09 +0100 Subject: [PATCH] zdump: since we create ELF version 1 files use this value explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Alexander Egorenkov Reviewed-by: Steffen Eiden Signed-off-by: Jan Höppner --- zdump/df_elf.c | 4 ++-- zdump/df_elf.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/zdump/df_elf.c b/zdump/df_elf.c index 1b88a328..8837ef76 100644 --- a/zdump/df_elf.c +++ b/zdump/df_elf.c @@ -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; diff --git a/zdump/df_elf.h b/zdump/df_elf.h index e0fa7474..583217fa 100644 --- a/zdump/df_elf.h +++ b/zdump/df_elf.h @@ -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) */