https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1983f47206975383907d2…
commit 1983f47206975383907d2c9d17360e2d3cfa98e5
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Fri Sep 11 13:00:07 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Sep 16 10:35:31 2020 +0200
[WINESYNC] dbghelp: Translate the 32-bit ELF header to the 64-bit one.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 799e0bfa57c4c2a7922c43031bd0d95c6add6a1a by Zebediah Figura
<zfigura(a)codeweavers.com>
---
dll/win32/dbghelp/elf_module.c | 29 +++++++++++++++++++++++++++--
dll/win32/dbghelp/image_private.h | 4 +---
sdk/tools/winesync/dbghelp.cfg | 2 +-
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c
index d0b483abbcf..edf32b59f11 100644
--- a/dll/win32/dbghelp/elf_module.c
+++ b/dll/win32/dbghelp/elf_module.c
@@ -351,8 +351,33 @@ static BOOL elf_map_file(struct elf_map_file_data* emfd, struct
image_file_map*
fmap->addr_size = e_ident[EI_CLASS] == ELFCLASS64 ? 64 : 32;
- if (!elf_map_file_read(fmap, emfd, &fmap->u.elf.elfhdr,
sizeof(fmap->u.elf.elfhdr), 0))
- goto done;
+ if (fmap->addr_size == 32)
+ {
+ Elf32_Ehdr elfhdr32;
+
+ if (!elf_map_file_read(fmap, emfd, &elfhdr32, sizeof(elfhdr32), 0))
+ goto done;
+
+ memcpy(fmap->u.elf.elfhdr.e_ident, elfhdr32.e_ident, EI_NIDENT);
+ fmap->u.elf.elfhdr.e_type = elfhdr32.e_type;
+ fmap->u.elf.elfhdr.e_machine = elfhdr32.e_machine;
+ fmap->u.elf.elfhdr.e_version = elfhdr32.e_version;
+ fmap->u.elf.elfhdr.e_entry = elfhdr32.e_entry;
+ fmap->u.elf.elfhdr.e_phoff = elfhdr32.e_phoff;
+ fmap->u.elf.elfhdr.e_shoff = elfhdr32.e_shoff;
+ fmap->u.elf.elfhdr.e_flags = elfhdr32.e_flags;
+ fmap->u.elf.elfhdr.e_ehsize = elfhdr32.e_ehsize;
+ fmap->u.elf.elfhdr.e_phentsize = elfhdr32.e_phentsize;
+ fmap->u.elf.elfhdr.e_phnum = elfhdr32.e_phnum;
+ fmap->u.elf.elfhdr.e_shentsize = elfhdr32.e_shentsize;
+ fmap->u.elf.elfhdr.e_shnum = elfhdr32.e_shnum;
+ fmap->u.elf.elfhdr.e_shstrndx = elfhdr32.e_shstrndx;
+ }
+ else
+ {
+ if (!elf_map_file_read(fmap, emfd, &fmap->u.elf.elfhdr,
sizeof(fmap->u.elf.elfhdr), 0))
+ goto done;
+ }
fmap->u.elf.sect = HeapAlloc(GetProcessHeap(), 0,
fmap->u.elf.elfhdr.e_shnum *
sizeof(fmap->u.elf.sect[0]));
diff --git a/dll/win32/dbghelp/image_private.h b/dll/win32/dbghelp/image_private.h
index 96861040412..6c6da64f247 100644
--- a/dll/win32/dbghelp/image_private.h
+++ b/dll/win32/dbghelp/image_private.h
@@ -61,14 +61,12 @@ typedef struct section macho_section;
#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
#ifdef _WIN64
-#define Elf_Ehdr Elf64_Ehdr
#define Elf_Shdr Elf64_Shdr
#define Elf_Phdr Elf64_Phdr
#define Elf_Dyn Elf64_Dyn
#define Elf_Sym Elf64_Sym
#define Elf_auxv_t Elf64_auxv_t
#else
-#define Elf_Ehdr Elf32_Ehdr
#define Elf_Shdr Elf32_Shdr
#define Elf_Phdr Elf32_Phdr
#define Elf_Dyn Elf32_Dyn
@@ -99,7 +97,7 @@ struct image_file_map
struct image_file_map* alternate; /* another ELF file (linked to
this one) */
char* target_copy;
#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
- Elf_Ehdr elfhdr;
+ Elf64_Ehdr elfhdr;
struct
{
Elf_Shdr shdr;
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index 95dc6bc4fb4..69e8113da58 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -3,4 +3,4 @@ directories:
files:
include/dbghelp.h: sdk/include/psdk/dbghelp.h
tags:
- wine: a612f1f56fefd00ebe6d8f7bcf7c826f5aa85eab
+ wine: 799e0bfa57c4c2a7922c43031bd0d95c6add6a1a