mirror of
https://github.com/reactos/reactos.git
synced 2024-11-24 12:03:31 +08:00
[WINESYNC] dbghelp: Read the ELF program header corresponding to the target's architecture.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id bd620ffb443eaa2dba997dc5597cb37c44d757b7 by Zebediah Figura <zfigura@codeweavers.com>
This commit is contained in:
parent
8428b1f8c3
commit
48c551a237
@ -332,7 +332,6 @@ static BOOL elf_map_file(struct elf_map_file_data* emfd, struct image_file_map*
|
||||
static const BYTE elf_signature[4] = { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3 };
|
||||
struct stat statbuf;
|
||||
unsigned int i;
|
||||
Elf_Phdr phdr;
|
||||
size_t tmp, page_mask = sysconf( _SC_PAGESIZE ) - 1;
|
||||
char* filename;
|
||||
unsigned len;
|
||||
@ -429,13 +428,31 @@ static BOOL elf_map_file(struct elf_map_file_data* emfd, struct image_file_map*
|
||||
fmap->u.elf.elf_start = ~0L;
|
||||
for (i = 0; i < fmap->u.elf.elfhdr.e_phnum; i++)
|
||||
{
|
||||
if (elf_map_file_read(fmap, emfd, &phdr, sizeof(phdr),
|
||||
fmap->u.elf.elfhdr.e_phoff + i * sizeof(phdr)) &&
|
||||
phdr.p_type == PT_LOAD)
|
||||
if (fmap->addr_size == 32)
|
||||
{
|
||||
tmp = (phdr.p_vaddr + phdr.p_memsz + page_mask) & ~page_mask;
|
||||
if (fmap->u.elf.elf_size < tmp) fmap->u.elf.elf_size = tmp;
|
||||
if (phdr.p_vaddr < fmap->u.elf.elf_start) fmap->u.elf.elf_start = phdr.p_vaddr;
|
||||
Elf32_Phdr phdr;
|
||||
|
||||
if (elf_map_file_read(fmap, emfd, &phdr, sizeof(phdr),
|
||||
fmap->u.elf.elfhdr.e_phoff + i * sizeof(phdr)) &&
|
||||
phdr.p_type == PT_LOAD)
|
||||
{
|
||||
tmp = (phdr.p_vaddr + phdr.p_memsz + page_mask) & ~page_mask;
|
||||
if (fmap->u.elf.elf_size < tmp) fmap->u.elf.elf_size = tmp;
|
||||
if (phdr.p_vaddr < fmap->u.elf.elf_start) fmap->u.elf.elf_start = phdr.p_vaddr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Elf64_Phdr phdr;
|
||||
|
||||
if (elf_map_file_read(fmap, emfd, &phdr, sizeof(phdr),
|
||||
fmap->u.elf.elfhdr.e_phoff + i * sizeof(phdr)) &&
|
||||
phdr.p_type == PT_LOAD)
|
||||
{
|
||||
tmp = (phdr.p_vaddr + phdr.p_memsz + page_mask) & ~page_mask;
|
||||
if (fmap->u.elf.elf_size < tmp) fmap->u.elf.elf_size = tmp;
|
||||
if (phdr.p_vaddr < fmap->u.elf.elf_start) fmap->u.elf.elf_start = phdr.p_vaddr;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* if non relocatable ELF, then remove fixed address from computation
|
||||
|
@ -61,12 +61,10 @@ typedef struct section macho_section;
|
||||
#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
|
||||
|
||||
#ifdef _WIN64
|
||||
#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_Phdr Elf32_Phdr
|
||||
#define Elf_Dyn Elf32_Dyn
|
||||
#define Elf_Sym Elf32_Sym
|
||||
#define Elf_auxv_t Elf32_auxv_t
|
||||
|
@ -3,4 +3,4 @@ directories:
|
||||
files:
|
||||
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
||||
tags:
|
||||
wine: cf78601b3781e64ea2745cf8084848acb69300a8
|
||||
wine: bd620ffb443eaa2dba997dc5597cb37c44d757b7
|
||||
|
Loading…
Reference in New Issue
Block a user