summaryrefslogtreecommitdiff
path: root/src/format/elf
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-09-16 20:08:57 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-09-16 20:08:57 (GMT)
commitaf083f8bd6da340214ae392451dde5782fb79039 (patch)
treeffc45880157f4fdd986b1e16aa6498bef149185a /src/format/elf
parent74642fbdeefaec21885e5fb6cad432e3e3b47cdb (diff)
Used the new vmpa_t type in binary portions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@405 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
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);
}