https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6c0765a0ec259c74a23cd8...
commit 6c0765a0ec259c74a23cd8d59b4d079b71c98443 Author: winesync ros-dev@reactos.org AuthorDate: Fri Sep 11 18:54:57 2020 +0200 Commit: Jérôme Gardou jerome.gardou@reactos.org CommitDate: Wed Sep 16 10:35:52 2020 +0200
[WINESYNC] dbghelp: Use local elf_header declaration.
Based on glibc.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
wine commit id 78845911da06fc75c6d74237f816a1547c24b20b by Jacek Caban jacek@codeweavers.com --- dll/win32/dbghelp/elf_module.c | 22 +++++++++++++++++++--- dll/win32/dbghelp/image_private.h | 20 +++++++++++++++++++- sdk/include/host/typedefs.h | 3 ++- sdk/tools/winesync/dbghelp.cfg | 2 +- 4 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c index cca07ead31e..cb30eb23d4e 100644 --- a/dll/win32/dbghelp/elf_module.c +++ b/dll/win32/dbghelp/elf_module.c @@ -359,7 +359,7 @@ static BOOL elf_map_file(struct elf_map_file_data* emfd, struct image_file_map* unsigned int i; size_t tmp, page_mask = sysinfo.dwPageSize - 1; WCHAR *dos_path; - unsigned char e_ident[EI_NIDENT]; + unsigned char e_ident[ARRAY_SIZE(fmap->u.elf.elfhdr.e_ident)];
elf_reset_file_map(fmap);
@@ -394,12 +394,28 @@ static BOOL elf_map_file(struct elf_map_file_data* emfd, struct image_file_map*
if (fmap->addr_size == 32) { - Elf32_Ehdr elfhdr32; + struct + { + UINT8 e_ident[16]; /* Magic number and other info */ + UINT16 e_type; /* Object file type */ + UINT16 e_machine; /* Architecture */ + UINT32 e_version; /* Object file version */ + UINT32 e_entry; /* Entry point virtual address */ + UINT32 e_phoff; /* Program header table file offset */ + UINT32 e_shoff; /* Section header table file offset */ + UINT32 e_flags; /* Processor-specific flags */ + UINT16 e_ehsize; /* ELF header size in bytes */ + UINT16 e_phentsize; /* Program header table entry size */ + UINT16 e_phnum; /* Program header table entry count */ + UINT16 e_shentsize; /* Section header table entry size */ + UINT16 e_shnum; /* Section header table entry count */ + UINT16 e_shstrndx; /* Section header string table index */ + } elfhdr32;
if (!elf_map_file_read(fmap, emfd, &elfhdr32, sizeof(elfhdr32), 0)) return FALSE;
- memcpy(fmap->u.elf.elfhdr.e_ident, elfhdr32.e_ident, EI_NIDENT); + memcpy(fmap->u.elf.elfhdr.e_ident, elfhdr32.e_ident, sizeof(e_ident)); 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; diff --git a/dll/win32/dbghelp/image_private.h b/dll/win32/dbghelp/image_private.h index 04885128217..64515ea3a31 100644 --- a/dll/win32/dbghelp/image_private.h +++ b/dll/win32/dbghelp/image_private.h @@ -50,6 +50,24 @@
#define IMAGE_NO_MAP ((void*)-1)
+struct elf_header +{ + UINT8 e_ident[16]; /* Magic number and other info */ + UINT16 e_type; /* Object file type */ + UINT16 e_machine; /* Architecture */ + UINT32 e_version; /* Object file version */ + UINT64 e_entry; /* Entry point virtual address */ + UINT64 e_phoff; /* Program header table file offset */ + UINT64 e_shoff; /* Section header table file offset */ + UINT32 e_flags; /* Processor-specific flags */ + UINT16 e_ehsize; /* ELF header size in bytes */ + UINT16 e_phentsize; /* Program header table entry size */ + UINT16 e_phnum; /* Program header table entry count */ + UINT16 e_shentsize; /* Section header table entry size */ + UINT16 e_shnum; /* Section header table entry count */ + UINT16 e_shstrndx; /* Section header string table index */ +}; + /* structure holding information while handling an ELF image * allows one by one section mapping for memory savings */ @@ -68,8 +86,8 @@ struct image_file_map HANDLE handle; const char* shstrtab; char* target_copy; + struct elf_header elfhdr; #if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB) - Elf64_Ehdr elfhdr; struct { Elf64_Shdr shdr; diff --git a/sdk/include/host/typedefs.h b/sdk/include/host/typedefs.h index df451c3344f..3a31aab7a93 100644 --- a/sdk/include/host/typedefs.h +++ b/sdk/include/host/typedefs.h @@ -2,7 +2,7 @@ * PROJECT: ReactOS Host Headers * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) * PURPOSE: Type definitions and useful macros for host tools - * COPYRIGHT: Copyright 2007 Herv� Poussineau (hpoussin@reactos.org) + * COPYRIGHT: Copyright 2007 Hervé Poussineau (hpoussin@reactos.org) * Copyright 2007 Colin Finck (colin@reactos.org) */
@@ -51,6 +51,7 @@ typedef void VOID, *PVOID, *LPVOID; typedef char CHAR, CCHAR, *PCHAR, *PSTR, *LPSTR; typedef const char *PCSTR, *LPCSTR; typedef unsigned char UCHAR, *PUCHAR, BYTE, *LPBYTE, BOOLEAN, *PBOOLEAN; +typedef uint8_t UINT8; typedef int16_t SHORT, *PSHORT; typedef uint16_t USHORT, *PUSHORT, WORD, *PWORD, *LPWORD, WCHAR, *PWCHAR, *PWSTR, *LPWSTR, UINT16; typedef const uint16_t *PCWSTR, *LPCWSTR; diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg index 2c4fb3b3dfd..f435483c7d9 100644 --- a/sdk/tools/winesync/dbghelp.cfg +++ b/sdk/tools/winesync/dbghelp.cfg @@ -4,4 +4,4 @@ files: include/dbghelp.h: sdk/include/psdk/dbghelp.h include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h tags: - wine: 11ea231501f4f2a54433031ada21052d81641fee + wine: 78845911da06fc75c6d74237f816a1547c24b20b