summaryrefslogtreecommitdiff
path: root/src/format/elf/section.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-04-05 19:11:16 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-04-05 19:11:16 (GMT)
commitc853ed6c88a82e2859033c4111b0edb0372bc570 (patch)
treefba98d186b6e80539c1e5aad9910316c0cb3725c /src/format/elf/section.c
parentb6fd6dc823615aaee8661e8e2365181c1ea1775f (diff)
Reorganized the ELF header (32 or 64 bits).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@148 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/elf/section.c')
-rw-r--r--src/format/elf/section.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/format/elf/section.c b/src/format/elf/section.c
index cb6a04a..b39ebee 100644
--- a/src/format/elf/section.c
+++ b/src/format/elf/section.c
@@ -50,9 +50,10 @@ bool find_elf_section_by_index(const GElfFormat *format, uint16_t index, elf_shd
{
off_t offset; /* Emplacement à venir lire */
- if (index >= format->header.e_shnum) return false;
+ if (index >= ELF_HDR(format, format->header, e_shnum)) return false;
- offset = ELF_OFF(format, format->header.e_shoff) + format->header.e_shentsize * index;
+ offset = ELF_HDR(format, format->header, e_shoff)
+ + ELF_HDR(format, format->header, e_shentsize) * index;
return read_elf_section_header(format, offset, section);
@@ -80,12 +81,12 @@ bool find_elf_section_by_name(const GElfFormat *format, const char *name, elf_sh
uint16_t i; /* Boucle de parcours */
const char *secname; /* Nom d'une section analysée */
- if (!find_elf_section_by_index(format, format->header.e_shstrndx, &strings))
+ if (!find_elf_section_by_index(format, ELF_HDR(format, format->header, e_shstrndx), &strings))
return false;
result = false;
- for (i = 0; i < format->header.e_shnum && !result; i++)
+ for (i = 0; i < ELF_HDR(format, format->header, e_shnum) && !result; i++)
{
find_elf_section_by_index(format, i, section);
@@ -124,7 +125,7 @@ bool find_elf_section_by_virtual_address(const GElfFormat *format, uint32_t addr
result = false;
- for (i = 0; i < format->header.e_shnum && !result; i++)
+ for (i = 0; i < ELF_HDR(format, format->header, e_shnum) && !result; i++)
{
find_elf_section_by_index(format, i, section);
@@ -160,7 +161,7 @@ bool find_elf_sections_by_type(const GElfFormat *format, uint32_t type, elf_shdr
*sections = NULL;
*count = 0;
- for (i = 0; i < format->header.e_shnum; i++)
+ for (i = 0; i < ELF_HDR(format, format->header, e_shnum); i++)
{
find_elf_section_by_index(format, i, &section);
@@ -299,7 +300,7 @@ bool translate_address_into_offset_using_elf_sections(const GElfFormat *format,
result = false;
- for (i = 0; i < format->header.e_shnum && !result; i++)
+ for (i = 0; i < ELF_HDR(format, format->header, e_shnum) && !result; i++)
{
find_elf_section_by_index(format, i, &section);
@@ -339,7 +340,7 @@ bool translate_offset_into_address_using_elf_sections(const GElfFormat *format,
result = false;
- for (i = 0; i < format->header.e_shnum && !result; i++)
+ for (i = 0; i < ELF_HDR(format, format->header, e_shnum) && !result; i++)
{
find_elf_section_by_index(format, i, &section);