summaryrefslogtreecommitdiff
path: root/src/format/elf/elf.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-02-03 23:21:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-02-03 23:21:49 (GMT)
commit425860b441b21e4aca7bf2473be26b0fe1e756e2 (patch)
tree341a0fc8b370d76566f3e332c344ffae5c065916 /src/format/elf/elf.c
parent5511e355e7810f06bd610b79bcc94402c88d7ec9 (diff)
Removed all references to binary parts (GBinPart) and updated the code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@465 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/elf/elf.c')
-rw-r--r--src/format/elf/elf.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/src/format/elf/elf.c b/src/format/elf/elf.c
index 00af26d..b659dd7 100644
--- a/src/format/elf/elf.c
+++ b/src/format/elf/elf.c
@@ -62,9 +62,6 @@ static FormatTargetMachine g_elf_format_get_target_machine(const GElfFormat *);
/* Etend la définition des portions au sein d'un binaire. */
static void g_elf_format_refine_portions(const GElfFormat *, GBinPortion *);
-/* Fournit les références aux zones binaires à analyser. */
-static GBinPart **g_elf_format_get_parts(const GElfFormat *, size_t *);
-
/* Fournit la position correspondant à une adresse virtuelle. */
static bool g_elf_format_translate_address_into_offset(const GElfFormat *, vmpa_t, off_t *);
@@ -143,7 +140,6 @@ static void g_elf_format_init(GElfFormat *format)
exe_format->get_machine = (get_target_machine_fc)g_elf_format_get_target_machine;
exe_format->refine_portions = (refine_portions_fc)g_elf_format_refine_portions;
- exe_format->get_parts = (get_parts_fc)g_elf_format_get_parts;
exe_format->translate_addr = (translate_addr_fc)g_elf_format_translate_address_into_offset;
exe_format->translate_off = (translate_off_fc)g_elf_format_translate_offset_into_address;
@@ -393,104 +389,6 @@ static void g_elf_format_refine_portions(const GElfFormat *format, GBinPortion *
/******************************************************************************
* *
-* Paramètres : format = informations chargées à consulter. *
-* count = quantité de zones listées. [OUT] *
-* *
-* Description : Fournit les références aux zones binaires à analyser. *
-* *
-* Retour : Zones binaires à analyser. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBinPart **g_elf_format_get_parts(const GElfFormat *format, size_t *count)
-{
- GBinPart **result; /* Tableau à retourner */
- uint16_t i; /* Boucle de parcours */
- elf_shdr strings; /* Section des descriptions */
- bool has_strings; /* Section trouvée ? */
- elf_shdr section; /* En-tête de section ELF */
- GBinPart *part; /* Partie à intégrer à la liste*/
- const char *name; /* Nom trouvé ou NULL */
- off_t offset; /* Début de part de programme */
- elf_phdr phdr; /* En-tête de programme ELF */
-
- result = NULL;
- *count = 0;
-
- has_strings = find_elf_section_by_index(format, ELF_HDR(format, format->header, e_shstrndx), &strings);
-
- /* Première tentative : les sections */
-
- for (i = 0; i < ELF_HDR(format, format->header, e_shnum); i++)
- {
- if (!find_elf_section_by_index(format, i, &section))
- continue;
-
- if (ELF_SHDR(format, section, sh_flags) & SHF_EXECINSTR)
- {
- part = g_binary_part_new();
-
- if (has_strings)
- {
- name = extract_name_from_elf_string_section(format, &strings,
- ELF_SHDR(format, section, sh_name));
-
- if (name != NULL)
- g_binary_part_set_name(part, name);
-
- }
-
- g_binary_part_set_values(part,
- ELF_SHDR(format, section, sh_offset),
- ELF_SHDR(format, section, sh_size),
- ELF_SHDR(format, section, sh_addr));
-
- result = (GBinPart **)realloc(result, ++(*count) * sizeof(GBinPart *));
- result[*count - 1] = part;
-
- }
-
- }
-
- /* En désespoir de cause, on se rabbat sur les parties de programme directement */
-
- if (*count == 0)
- for (i = 0; i < ELF_HDR(format, format->header, e_phnum); i++)
- {
- offset = ELF_HDR(format, format->header, e_phoff)
- + ELF_HDR(format, format->header, e_phentsize) * i;
-
- if (!read_elf_program_header(format, &offset, &phdr))
- continue;
-
- if (ELF_PHDR(format, phdr, p_flags) & PF_X)
- {
- part = g_binary_part_new();
-
- /* TODO : nom */
-
- g_binary_part_set_values(part,
- ELF_PHDR(format, phdr, p_offset),
- ELF_PHDR(format, phdr, p_filesz),
- ELF_PHDR(format, phdr, p_vaddr));
-
- result = (GBinPart **)realloc(result, ++(*count) * sizeof(GBinPart *));
- result[*count - 1] = part;
-
- }
-
- }
-
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : format = description de l'exécutable à consulter. *
* addr = adresse virtuelle à retrouver. *
* pos = position correspondante. [OUT] *