summaryrefslogtreecommitdiff
path: root/src/format/elf
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/elf')
-rw-r--r--src/format/elf/elf.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/format/elf/elf.c b/src/format/elf/elf.c
index 4a56c52..64708ee 100644
--- a/src/format/elf/elf.c
+++ b/src/format/elf/elf.c
@@ -318,6 +318,7 @@ static void g_elf_format_refine_portions(const GElfFormat *format, GBinPortion *
const char *background; /* Fond signigicatif */
GBinPortion *new; /* Nouvelle portion définie */
char desc[MAX_PORTION_DESC]; /* Description d'une portion */
+ vmpa2t addr; /* Emplacement dans le binaire */
PortionAccessRights rights; /* Droits d'une portion */
elf_shdr strings; /* Section des descriptions */
bool has_strings; /* Section trouvée ? */
@@ -350,10 +351,8 @@ static void g_elf_format_refine_portions(const GElfFormat *format, GBinPortion *
g_binary_portion_set_desc(new, desc);
- g_binary_portion_set_values(new,
- ELF_PHDR(format, phdr, p_offset),
- ELF_PHDR(format, phdr, p_filesz),
- ELF_PHDR(format, phdr, p_vaddr));
+ init_vmpa(&addr, ELF_PHDR(format, phdr, p_offset), ELF_PHDR(format, phdr, p_vaddr));
+ g_binary_portion_set_values(new, &addr, ELF_PHDR(format, phdr, p_filesz));
rights = PAC_NONE;
if (p_flags & PF_R) rights |= PAC_READ;
@@ -398,6 +397,9 @@ static void g_elf_format_refine_portions(const GElfFormat *format, GBinPortion *
g_binary_portion_set_desc(new, desc);
+ init_vmpa(&addr, ELF_SHDR(format, section, sh_offset), ELF_SHDR(format, section, sh_addr));
+ g_binary_portion_set_values(new, &addr, ELF_SHDR(format, section, sh_size));
+
rights = PAC_NONE;
if (sh_flags & SHF_ALLOC) rights |= PAC_READ;
if (sh_flags & SHF_WRITE) rights |= PAC_WRITE;
@@ -405,11 +407,6 @@ static void g_elf_format_refine_portions(const GElfFormat *format, GBinPortion *
g_binary_portion_set_rights(new, rights);
- g_binary_portion_set_values(new,
- ELF_SHDR(format, section, sh_offset),
- ELF_SHDR(format, section, sh_size),
- ELF_SHDR(format, section, sh_addr));
-
g_binary_portion_include(raw, new);
}