mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[WINESYNC] dbghelp: Translate the 32-bit ELF section header to the 64-bit one.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 4005901773bf1842804c40d928a944623e11d238 by Zebediah Figura <zfigura@codeweavers.com>
This commit is contained in:
parent
1983f47206
commit
23a2d2713d
3 changed files with 34 additions and 7 deletions
|
@ -292,6 +292,36 @@ static BOOL elf_map_file_read(struct image_file_map* fmap, struct elf_map_file_d
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL elf_map_shdr(struct elf_map_file_data* emfd, struct image_file_map* fmap, unsigned int i)
|
||||
{
|
||||
if (fmap->addr_size == 32)
|
||||
{
|
||||
Elf32_Shdr shdr32;
|
||||
|
||||
if (!elf_map_file_read(fmap, emfd, &shdr32, sizeof(shdr32),
|
||||
fmap->u.elf.elfhdr.e_shoff + i * sizeof(Elf32_Shdr)))
|
||||
return FALSE;
|
||||
|
||||
fmap->u.elf.sect[i].shdr.sh_name = shdr32.sh_name;
|
||||
fmap->u.elf.sect[i].shdr.sh_type = shdr32.sh_type;
|
||||
fmap->u.elf.sect[i].shdr.sh_flags = shdr32.sh_flags;
|
||||
fmap->u.elf.sect[i].shdr.sh_addr = shdr32.sh_addr;
|
||||
fmap->u.elf.sect[i].shdr.sh_offset = shdr32.sh_offset;
|
||||
fmap->u.elf.sect[i].shdr.sh_size = shdr32.sh_size;
|
||||
fmap->u.elf.sect[i].shdr.sh_link = shdr32.sh_link;
|
||||
fmap->u.elf.sect[i].shdr.sh_info = shdr32.sh_info;
|
||||
fmap->u.elf.sect[i].shdr.sh_addralign = shdr32.sh_addralign;
|
||||
fmap->u.elf.sect[i].shdr.sh_entsize = shdr32.sh_entsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!elf_map_file_read(fmap, emfd, &fmap->u.elf.sect[i].shdr, sizeof(fmap->u.elf.sect[i].shdr),
|
||||
fmap->u.elf.elfhdr.e_shoff + i * sizeof(Elf64_Shdr)))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* elf_map_file
|
||||
*
|
||||
|
@ -385,8 +415,7 @@ static BOOL elf_map_file(struct elf_map_file_data* emfd, struct image_file_map*
|
|||
|
||||
for (i = 0; i < fmap->u.elf.elfhdr.e_shnum; i++)
|
||||
{
|
||||
if (!elf_map_file_read(fmap, emfd, &fmap->u.elf.sect[i].shdr, sizeof(fmap->u.elf.sect[i].shdr),
|
||||
fmap->u.elf.elfhdr.e_shoff + i * sizeof(fmap->u.elf.sect[i].shdr)))
|
||||
if (!elf_map_shdr(emfd, fmap, i))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, fmap->u.elf.sect);
|
||||
fmap->u.elf.sect = NULL;
|
||||
|
@ -1225,7 +1254,7 @@ static BOOL elf_load_file_from_fmap(struct process* pcs, const WCHAR* filename,
|
|||
if (elf_find_section(fmap, ".dynamic", SHT_DYNAMIC, &ism))
|
||||
{
|
||||
Elf_Dyn dyn;
|
||||
char* ptr = (char*)fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
|
||||
char* ptr = (char*)(ULONG_PTR)fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
|
||||
unsigned long len;
|
||||
|
||||
if (load_offset) ptr += load_offset - fmap->u.elf.elf_start;
|
||||
|
|
|
@ -61,13 +61,11 @@ typedef struct section macho_section;
|
|||
#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
|
||||
|
||||
#ifdef _WIN64
|
||||
#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_Shdr Elf32_Shdr
|
||||
#define Elf_Phdr Elf32_Phdr
|
||||
#define Elf_Dyn Elf32_Dyn
|
||||
#define Elf_Sym Elf32_Sym
|
||||
|
@ -100,7 +98,7 @@ struct image_file_map
|
|||
Elf64_Ehdr elfhdr;
|
||||
struct
|
||||
{
|
||||
Elf_Shdr shdr;
|
||||
Elf64_Shdr shdr;
|
||||
const char* mapped;
|
||||
}* sect;
|
||||
#endif
|
||||
|
|
|
@ -3,4 +3,4 @@ directories:
|
|||
files:
|
||||
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
||||
tags:
|
||||
wine: 799e0bfa57c4c2a7922c43031bd0d95c6add6a1a
|
||||
wine: 4005901773bf1842804c40d928a944623e11d238
|
||||
|
|
Loading…
Reference in a new issue