summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-12-16 19:45:47 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-12-16 19:45:47 (GMT)
commite4b56188b664e6b986733d456e6a0ea9b2da6d53 (patch)
tree5ee91a7b9f09a3d7550fbafde83c042f078689d3
parent7c40b70d6c1e1e13dadf876c8dda60b525616d47 (diff)
Dealt with empty ranges in the early states of disassembled symbols.
-rw-r--r--ChangeLog8
-rw-r--r--src/arch/vmpa.c18
-rw-r--r--src/format/elf/helper_arm.c16
3 files changed, 29 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index f116419..4ba3351 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
15-12-16 Cyrille Bagard <nocbos@gmail.com>
+ * src/arch/vmpa.c:
+ Deal with empty ranges in the early states of disassembled symbols.
+
+ * src/format/elf/helper_arm.c:
+ Do optimization by delaying the process of sorting added symbols.
+
+15-12-16 Cyrille Bagard <nocbos@gmail.com>
+
* src/analysis/disass/area.c:
Update code.
diff --git a/src/arch/vmpa.c b/src/arch/vmpa.c
index 4c2b4cf..a289a28 100644
--- a/src/arch/vmpa.c
+++ b/src/arch/vmpa.c
@@ -812,8 +812,24 @@ int cmp_mrange_with_vmpa(const mrange_t *a, const vmpa2t *b)
{
diff = compute_vmpa_diff(&a->addr, b);
- if (diff < a->length)
+ /**
+ * On prend en compte le cas très particulier des couvertures vides.
+ *
+ * C'est typiquement le cas avec les espaces de symboles pendant la
+ * phase de désassemblage, après laquelle ces espaces deviennent bornés.
+ *
+ */
+
+ if (diff == 0 && a->length == 0)
result = 0;
+
+ /**
+ * Sinon on regarde simplement si l'adresse est contenue.
+ */
+
+ else if (diff < a->length)
+ result = 0;
+
else
result = 1;
diff --git a/src/format/elf/helper_arm.c b/src/format/elf/helper_arm.c
index f47df5d..f966296 100644
--- a/src/format/elf/helper_arm.c
+++ b/src/format/elf/helper_arm.c
@@ -118,30 +118,22 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx,
symbol = g_binary_symbol_new(STP_ROUTINE);
g_binary_symbol_attach_routine(symbol, routine);
- g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
/* Comptabilisation pour le désassemblage brut */
g_binary_format_register_code_point(G_BIN_FORMAT(format), virt, false);
-
- /*
- printf("got a jump ! >> %d - %s\n", index, name);
- printf(" -->> val = 0x%08lx\n", ELF_SYM(format, sym, st_value));
- printf(" -->> 0x%08lx =>> 0x%08lx\n", (unsigned int)ELF_REL(format, reloc, r_offset),
- ((unsigned int)ELF_SHDR(format, (*relxxx), sh_addr) + ELF_REL(format, reloc, r_offset)));
- */
-
- //symbol = g_binary_symbol_new(STP_FUNCTION));
- //g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
-
break;
default:
printf("Relocation not supported (%lld) !\n", ELF_REL_TYPE(format, reloc));
+ symbol = NULL;
break;
}
+ if (symbol != NULL)
+ _g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol, false);
+
}
return result;